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.


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



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


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

Taidot: Java

Näytä lisää: cows, cow and cow, game clue java, bulls cows code, code game clue java, code mastermind, double score double, java score code, java score, java guessing game, guessing game java, double scores double, cows bulls java, guessing java game, hidden game, bulls cows java, code sample game, 1111, code mastermind game, mastermind code, clues, guess game, mastermind game code, mastermind, game app cube numbers spin

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

Projektin tunnus: #4245937

Myönnetty käyttäjälle:


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)

2 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön


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)