Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Master Mind (Cows & Bulls)

Status
Not open for further replies.

todor81

Programmer
Dec 14, 2001
5
BG
Hi, there
can anybody tell me a strategy to write a C program, that plays Master mind (Cows & Bulls):
- the computer must guess the player's number in 7 suggestions.
- meanwile the computer plays "unhonest" game - it doesn't have a number and succesfully answers the user's suggestions so it doesn't lie.

10x a lot.
 
can you give me a little more detail on the game. Like what kind of answers the computer answers? and the number range you can pick. Nail the code
 
The numbers are with four digits and no digits can be repeated.
1234 - yes
1165 - no
The user selects a number (e.g. 7642) and the PC must guess it in 7 moves.
PC says 1234 - there is 1 cow and 0 bulls, because 2 is in the number, but not in the right place.
PC says 7624 - there are 2 bulls (7 and 6, because they are in the right position) and 2 cows (2 and 4).
At last 7642 - 4 bulls and the game's finished.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top