A Ruby implementation of the classic Mastermind game, created as part of The Odin Project.
Mastermind is a code-breaking game where one player (the codemaker) sets a code and another player (the codebreaker) tries to guess it within a limited number of attempts.
- Configurable Gameplay: Adjust the number of attempts and available colors by modifying
ATTEMPTS
andCOLORS
constants. - Colorful Terminal Output: Enhances visual experience with terminal colors.
- Two Modes: Play as either the codemaker or the codebreaker.
- Feedback System: Provides hints to improve your guesses.
- Ensure Ruby is installed on your system.
- Clone the repository:
git clone https://github.com/your-username/mastermind-game.git
- Navigate to the project directory:
cd odin-mastermind
- Run the game:
ruby mastermind.rb
- Start the Game: Run the command above and choose to be the codemaker or the codebreaker.
- As the Codemaker: Choose a pattern of four colors. The computer will attempt to guess it.
- As the Codebreaker: The computer sets a pattern. Guess it using main letters or whole color names (e.g., R G B Y or Red Green Blue Yellow).
- Feedback:
- Black (B): Correct color in the correct position.
- White (W): Correct color in the wrong position.
- Game End: The game ends when you guess the pattern or run out of attempts. Choose to play again if desired.
- White
- Black
- Red
- Green
- Blue
- Yellow
- Magenta
- Cyan