Many people had play the game mastermind before. There is a systematically way to play the game.

I have made an applet that will solve a number between 0000 and 9999.

The user need to give the value of p and c for the applet to make the next guess.

The value of p is the number of digits that are both position and numerically correct.

The value of c is the number of digits that is only numerically correct.

The method is described below.

1)Let PRESENT_GUESS=0000

2)Get user input for P and C

3)If P=4 then EXIT

4)PRESENT_GUESS=PRESENT_GUESS+1

5)If PRESENT_GUESS statisfy all values of P and C for each previous guess then GOTO 2

6)GOTO 4

Click here to load applet

Click here to load statistic page