cows and bulls

R

ramu

Hi,
can anyone please give me an algorithm to implement cows and
bulls game in c?

regards
 
R

Richard Heathfield

ramu said:
Hi,
can anyone please give me an algorithm to implement cows and
bulls game in c?

I have discovered that "Bulls and Cows", which I'd never heard of, is a
game rather like Mastermind.

Algorithms are language-neutral, so they're not really relevant here,
and in any case I suspect that your tutor wants you to work this out
for yourself. But here's a hint: there are finitely many possibilities
for each position. Your task is to find the way of generating the guess
that will eliminate as many of them as possible at a single step. Note
that you start with four digits, each of which can be 0 to 9. For your
first guess, I recommend that you choose a random number with all four
of its digits different.

You may get more hints if you ask in a more relevant newsgroup, such as
comp.programming, but nobody will do your homework for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top