Home > Computer Programming > Java game idea: Mastermind

Java game idea: Mastermind

October 18, 2012 Leave a comment Go to comments

In the original game, one player chooses a sequence of four coloured pegs being careful not to tell the other player what they chose. The second player then attempts to guess what the sequence is. Each time he guesses, the first player gives him clues as to how good the guess is by giving him a black counter for every peg that is the right colour in the right place and a white counter for every peg that is the right colour but in the wrong place.

In Java this could easily be implemented as a sequence of numbers where the number of different values each number can take is analogous to the number of colours. More colours means more difficult. You could also adjust the difficulty by changing the number of digits in the sequence. Three digits each from in the range [1-3] would be easy, but five digits each in the range [1-8] would be substantially harder.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s