Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gregolive/mastermind
Test your wits against the computer in a game of Mastermind.
https://github.com/gregolive/mastermind
Last synced: 18 days ago
JSON representation
Test your wits against the computer in a game of Mastermind.
- Host: GitHub
- URL: https://github.com/gregolive/mastermind
- Owner: gregolive
- Created: 2021-10-05T16:26:50.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-10T12:56:23.000Z (about 3 years ago)
- Last Synced: 2023-07-25T07:27:39.318Z (over 1 year ago)
- Language: Ruby
- Homepage: https://replit.com/@gregolive/Mastermind
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MASTERMIND
Test your wits against the computer in a game of Mastermind.
Choose to play as the **CODEMAKER** and come up with a secret code to fool your enemy.
Become the **CODEBREAKER** to crack the opponent's code in 12 turns or less.[Live demo](https://replit.com/@gregolive/Mastermind#game.rb) 👈
## Functionality
A command version of board game [Mastermind](https://en.wikipedia.org/wiki/Mastermind_(board_game)) made with Ruby. Players can choose to make a code usings number 1-8 that the computer player attempts to crack, or break a randomly generated code in 6, 8, 10, or 12 turns depending on the selected difficulty level.
## Reflection
Building this game was a great way to get more practice using classes and ruby and was a significant step up from making the tic tac toe project. The most difficult for me was deciding how to separate the large number of required methods into either the main Game class or a seperate module. It wasn't until I completed this project that I learned that class variables can be called in an included module without error and I would apprach the separation of methods differntly with this knowledge if I were to make another Mastermind project. For example, on many module method calls I passed in class vairables that are already accessible in the module.
The main difficulty, though, was the codebreaking logic for the commputer player. I started with random guesses, however, this practically guarantees that the code goes unbroken. By bending the rules slightly for the computer I added some basic logic to the guesses, however this is something I would like to re-visit at a later date with a high understanding of Ruby.
-Greg Olive