This project implements the MasterMind game in COBOL. MasterMind is a logic game in which a player must guess a sequence of numbers randomly generated by another player.
1- Initialization: Start the program and follow the instructions to enter a sequence of 3 numbers without your opponent seeing it. 2- Guess: Then, your opponent will try to guess the sequence by also proposing a sequence of 3 numbers. 3- Feedback: The program will give you feedback on the match between the guessed numbers and the secret sequence. It will indicate the number of correctly placed numbers and the number of correct but misplaced numbers. 4- Repeat: Repeat steps 2 and 3 until you find the secret sequence or get it wrong 10 times or decide to end the game.
Example :
1st entry: enter the number to find: 123
2nd entry: enter a proposition: 999 => no number find
3rd entry: enter a proposition: 199 => a good number place
4th entry: enter a proposition: 192 => a good number placed and a figure found
5th entry: enter a proposition: 132 => a good number placed and 2 numbers found
6th entry: enter a proposition: 123 => You have find ! Well done !
End of program
Make sure you have a COBOL compiler installed on your system. You can use GNU COBOL (GnuCOBOL) or another COBOL-compatible compiler. 1- Compilation: Compile the program with your COBOL compiler. For example, with GNU COBOL: 'cobc -x -free -o MasterMind MasterMind.cbl'. 2- Execution: Run the compiled program. For example, under Linux: './MasterMind'.
- The program is designed to be played by two players, but you can also play alone by performing both sets of inputs.
- The game allows a maximum of 10 attempts before declaring defeat.
- To stop the game at any time, enter "FIN" when prompted to enter a sequence. Have fun !