https://github.com/lucas4tech/ruby-mastermind-example
Building a mastermind, a game where you have to guess your opponent's secret code in a certain number of moves using Ruby 🎯
https://github.com/lucas4tech/ruby-mastermind-example
challenge design-patterns hackhathon logic-programming ruby
Last synced: 10 months ago
JSON representation
Building a mastermind, a game where you have to guess your opponent's secret code in a certain number of moves using Ruby 🎯
- Host: GitHub
- URL: https://github.com/lucas4tech/ruby-mastermind-example
- Owner: lucas4tech
- Created: 2023-03-14T05:02:11.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-14T05:03:28.000Z (over 3 years ago)
- Last Synced: 2025-07-12T05:24:35.996Z (11 months ago)
- Topics: challenge, design-patterns, hackhathon, logic-programming, ruby
- Language: Ruby
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mastermind
Build a Mastermind game from the command line where you have 12 rounds of guessing the secret code, starting with you guessing the computer's random code.
```
1. Think about how you would set this problem up!
2. Build the game assuming the computer randomly selects the secret colors and the human player must guess them. Remember that you need to give the proper feedback on how good the guess was each turn!
3. Now refactor your code to allow the human player to choose whether they want to be the creator of the secret code or the guesser.
4. Build it out so that the computer will guess if you decide to choose your own secret colors. You may choose to implement a computer strategy that follows the rules of the game or you can modify these rules.
5. If you choose to modify the rules, you can provide the computer additional information about each guess. For example, you can start by having the computer guess randomly, but keep the ones that match exactly. You can add a little bit more intelligence to the computer player so that, if the computer has guessed the right color but the wrong position, its next guess will need to include that color somewhere.
```