I am doing a c++ project on cows and bulls where the computer has to guess the number. I have a few questions.?
I recently heard of the pigeon hole principle( i am not exactly sure about how to use it)and I am trying to use this to do my programme. Every time my first number is 0123. Based on this I have 14 possibilities.My questions are-
1.I have reduced the sample space considerably by using a tree. But does it help in arriving at the answer?
2.The next number that I use should be only from the sample space or will using some other number give better result?
This is how far I have got. Thanks in advance.

Recommended Answers

All 2 Replies

Your basic problem is if you don't know how to use something, you can't program it. Any algorithm you try to use in a program you need to understand.

Sit down with paper, pencil, and a good description of the principle and work out how it operates. Be sure to test the idea with highest and lowest values, and values that don't work to understand how to error check.

I too agree with waltP, as I really do not understand what the requirement is

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.