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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cows & bulls game said that: A b

Status
Not open for further replies.

348934

Programmer
Apr 2, 2003
2
NZ
Cows & bulls game said that:

A bull is a symbol in the guess that matches a symbol of the code both by position and value.
A cow is a symbol in the guess that matches one of the code by value, but not by a position.
example:
the code is : ROYY
yhe guess is: RYBR
then the score would be one bull (R) and one cow(Y).

the program must read some guesses and thier scores.
and output all the codes consistent with the sequence of guesses and responses:
if we enter:
RRRR 2 0
RRBB 2 2

the program must output:
RBRB
RBBR
BRRB
BRBR

Can anyone help me how to do this using ProLog... or even how to start?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top