##INTRODUCTION Mastermind or Master Mind is a code-breaking game. The board game with pegs was invented in 1970 by Mordecai Meirowitz, an Israeli postmaster and telecommunications expert.It resembles an earlier pencil and paper game called Bulls and Cows that may date back a century or more. It has been recently implemented as an game application with similar rules as that of the board game, except the code is randomly generated.
##RULES AND PROCEDURE The game consists of a hidden randomly generated code of four colours. The player has to guess the code both the correct colours and their correct order out of possibility of eight colours, in the specified number of guesses.
The player chooses a pattern of four code pegs. Duplicates and blanks are allowed depending on player choice, so the player could even choose four code pegs of the same color or four blanks.The player tries to guess the pattern, in both order and color, within the specified turns. Each guess is made by placing a row of code pegs on the decoding board. Once placed, a feedback is provided by placing from zero to four key pegs in the small holes of the row with the guess. A colored or black key peg is placed for each code peg from the guess which is correct in both color and position. A white key peg indicates the existence of a correct color code peg placed in the wrong position.
Once feedback is provided, another guess is made; guesses and feedback continue to alternate until either the player guesses correctly, or the specified number of incorrect guesses are made.
##HOW TO RUN You can run the game after installing pygame through the command
sudo apt-get install python-pygame
and run it simply by,
index.py
######Happy gaming and happy coding!