|
MasterMind Another faculty project; Borland C++ 3.1, 1997 The program plays the popular game "mastermind", in which players have to find the "secret code" of the opponent, by making a "guess" and receiving such informations as the number of common digits, and the number of digits also in the right position. The program not only allows the user to discover the computer's code, but also tries to discover the
user's code, thus the game being simetric. The game ends on a "which gets first the answer" basis. The program uses a "smart" heuristic for his guessing, which gives very good results (usually, the computer wins). The heuristic is: at each step, give as guess the number sequence which is at the maximum "distance" from all the previous guesses; this method is supposed to bring the maximum quantity of new information.
Available for download: the source code |