*By Michael Hartley*

Mastermind is a classic game. Two players play. One of the players makes up a secret code, and the other has to guess it. Each time the guesser guesses a code, the first player gives them a clue how well they did.

For example, suppose your secret code was **8563**, as shown above. And suppose my guess was **8475**, as shown below.

Then, you would respond like this :

- In my guess, the marble numbered
**8**(the red marble) is in the correct place. So you give me a green peg next to my guess. - Apart from the 8, I also guessed a
**5**(the light blue marble), but I put it in the wrong place. Because it would be correct if I moved it, you give me a*white*peg. - My other two marbles are completely wrong - so you don't give me any peg, either white or green.
- When I see the green peg and the white peg, I know that
*one*of my pegs is in the correct place, and*one other*is correct, but in the wrong place. However,**I have no idea which ones**. For all I know, it might be the 4 and 7 that are correct...

Likewise, if I guessed **3366**...

- Then I have a marble numbered
**6**(a green one) in the correct place, so you indicate this by giving me a green peg next to my guess. The other**6**doesn't earn me another peg. - Also, your secret code has one
**3**. My guess has two**3**'s, neither are in the right places. Therefore, you give me a single*white*peg, because one of my**3**'s is the right color. - Once you've given a green peg and a white peg for one of my 3's and one of my 6's, my other 3 and 6 don't match your 8 and 5, so I don't get any more pegs - just the one green and the one white.

After a few guesses, perhaps I'll have enough information to figure out the four colors in your secret code. A few more guesses, and I might have figured out what order these colors are in! I'll have cracked your code!

Or perhaps, after 12 guesses, I'll still be just as baffled as at the start...

So, if you're ready, challenge the computer now! You can get the computer to think of a secret code for your to guess, or you can ask the computer to guess your secret code.

If you prefer to play with a friend, you can get a mastermind set from here - or wait for your birthday, and ask your parents or friends to follow that link!

The online mastermind game should be visible just below this sentence. If you can't see anything, please make sure you have the java plugin from 'Sun' installed.

Enjoy!