LarsBuergerr | Smokey95 |
---|---|
This is a implementation of the game Mastermind. The game is played against the computer. The game creates a secret code of four to five stones (depends on the chosen difficult) . The layer tries to guess the code. After each guess the player gets feedback about how many stones are in the right position and how many stones are in the wrong position. The game ends when the player guesses the code or when the player has used all his tries.
You won the game if you guess the secret code so that all hint stones are red. You lose the game if you used all your tries and you did not guess the secret code.
The following pattern are implemented:
The strategy pattern was used to select a gamemode according to userinput. See the implementation here
The factory pattern replaces the original enum declaration of the stones. To show the difference the game-stones are implemented using the pattern, the hint-stones are still implemented as enum. See the implementation here
The state pattern was used to keep track over current game state. There are events defined to switch the state of a game instance and methods to check the current state. See the implementation of the states here. The Events are defined here. To switch between states there is a handler (called request) implemented in game class here
The Cain-of-Responsibility is used so analyze users input. See the implementation here and in the game class
We thank the following people for their contributions to this project ( :) ):
Creator | Content | Link |
---|---|---|
Smashicons | Mouse Scroll Icon | Scroll Logo Template |
Dave Gandy | Undo Icon | Undo Icon Template |
Dave Gandy | Reset Icon | Reset Icon Template |
Dave Gandy | Save Icon | Save Icon Template |
Dave Gandy | Load Icon | Load Icon Template |
Dave Gandy | Help Icon | Help Icon Template |