Simulating Mastermind Game

The aim of the mastermind game is to guess a code given appropriate clues.

The code is a 4-digit number, drawn from 1 to 6. The code can be any number in the range 1111 to 6666.

The computer interrogates the user for a guess of a hidden code (that is generated by the computer).

The computer should return the correct clues to each guess.

The clues returned are evaluated as follows:

If the user has a correct number in the right position the guess scores a ‘bull’.

If the user has a correct guess in the wrong position the guess scores a ‘cow.

If one gets 4 bulls then one has got the correct code.

Note:

A bull should not be ‘double-counted’ as a cow.

2

Example:

Suppose the (hidden) code was 3141 and the user guesses

1234 clue/score := 3 cows

as 1234 includes 3 of the numbers in the code but they are all in the wrong position.

User guesses

2345 clue/score := 1 bull (the 4), 1 cow (the 3)

Sample Session

Suppose code is 6446 (generated by the computer)

Guess Clue-score 1234 1 cow 2345 1 bull 3256 1 bull

etc.

The user keeps guessing until they either get it or give up.

Taidot: Java

Tietoa työnantajasta:
( 9 arvostelua ) dublin, Hong Kong

Projektin tunnus: #4245937

Myönnetty käyttäjälle:

Mitodina

Hi! I did the Mastermind game in another language (in C) and for me it's not difficult. I am the ideal person for this job.

30 \$ USD 1 päivässä
(0 arvostelua)
1.0

2 freelanceria on tarjonnut keskimäärin 30 \$ tähän työhön

geniustunis

JAVA game developpement is my little game. I already done this game in "C" and it's too easy for me

30 \$ USD 1 päivässä
(0 arvostelua)
0.0