"CliffsNotes" version of Bulls and Cows

4-digit #s are selected at random from the set of 5040 #s which contain
the digits 0 thru 9 which have no repeating digits. A computer program
is used to "guess" these numbers and the number of guesses needed is
tallied.

The program works by "scoring" the guesses by counting the number of
"bulls" (right digit, right position) & "cows" (right digit, wrong
position) and removing all those numbers which don't have the right
score and then picking for the next guess from what's left the number
which partitions the set into subsets which yields the smallest value of

e = Σ |ts|log2(|ts|) 
    s

where |ts| is the size of the set w/ score s.

This "heuristic" method is based on the Information Theory concept
called "entropy."

Source code :

http://primepuzzle.com/lee-bradley/SamplePrograms/entropya.c

entropya.c - tct - 1/25/16
usage: entropya -noentropy -num n

Current time is Thu Mar 24 06:14:22 2016

3796 6 6379 4 8235 5 5742 5 5243 7 3427 6 3058 6 8063 6 4539 6 1532 6
8910 5 4092 5 2145 6 3719 5 1456 6 3129 3 8106 7 1209 6 2185 6 4052 5
0256 5 0861 5 0379 5 4106 6 3945 5 0468 4 4510 5 9851 6 3295 7 3498 5
6741 5 2854 6 4205 6 4608 6 3671 5 2987 5 0541 6 2561 5 9368 5 5281 6
6742 6 1380 5 0821 6 0286 5 0728 5 9037 5 9405 6 0527 5 4072 6 4913 5
2395 5 0934 6 5147 5 9640 4 1753 7 0259 6 1528 5 5248 4 3096 6 9586 5
0539 6 1694 5 2504 4 8723 6 8196 5 2734 4 0457 6 1902 6 5647 6 5847 5
9450 6 4672 5 6135 5 6013 6 0459 5 4152 5 7348 5 8971 4 4326 5 1245 5
4913 6 3251 4 1435 7 3926 5 4289 6 8473 6 9234 6 3642 5 5061 5 4705 5
1246 5 2983 5 5748 5 1674 5 8931 6 8721 5 6124 4 4278 4 8407 4 0271 5
8763 5 1230 4 5076 5 5086 4 1476 4 2973 5 5248 7 4913 6 4621 5 1348 5
2017 5 9062 3 6820 5 7439 6 5382 6 0354 6 2589 6 8750 5 2108 6 2608 5
3479 6 1426 5 1435 5 9125 6 2436 6 6941 5 9805 6 3206 5 3185 5 5874 5
2835 5 9608 6 7392 6 5960 5 3629 5 2750 5 2739 7 8305 6 1237 6 0438 5
9715 5 3195 5 6052 5 9638 6 1589 6 2501 5 0897 5 9571 5 7019 7 1258 5
6529 5 5612 4 8531 7 6470 5 2147 7 3416 6 3846 6 1906 4 3672 5 5049 5
7458 6 9704 5 3607 6 1435 4 5630 6 5749 6 4350 5 9041 6 0352 6 4805 5
0569 5 1093 6 7826 5 2840 5 2975 6 9215 5 1058 5 7864 6 7043 7 3025 5
6439 5 4756 6 2738 3 1230 6 8497 5 4569 6 9246 5 6184 6 4721 6 8641 5
2560 5 8957 6 1658 6 6805 7 4380 6 6025 6 4321 6 2631 5 9214 5 3726 5

Current time is Thu Mar 24 06:19:35 2016

1 0
2 0
3 3
4 17
5 95
6 73
7 12
8 0
9 0

Average number of tries was 5.370.

C:\1_11_16>

The -noentropy option tells it *not* to use the entropy evaluation but
to just pick a random element from the reduced sets. We find there is a
measurable, albeit small, reduction in the average number of guesses
needed when entropy is used.

C:\1_11_16>entropya.exe -num 200 -noentropy

entropya.c - tct - 1/25/16
usage: entropya -noentropy -num n

Current time is Thu Mar 24 06:21:22 2016

2354 4 1924 7 1350 5 9358 6 4856 6 7250 5 4956 5 4780 4 9186 6 6847 6
3641 4 2765 7 8351 4 9012 5 0627 3 0738 4 0214 4 1850 4 4251 7 2017 4
3125 6 9826 6 6214 5 8016 5 5089 7 4519 4 1627 4 7156 6 7561 6 3194 4
0584 7 6824 7 7130 6 5431 5 9732 7 5693 5 4389 4 0613 4 5780 4 3584 4
1740 6 3278 5 1749 4 8437 5 2341 6 0682 5 2816 6 5693 5 5714 5 4923 6
4801 6 6789 6 3268 5 8047 4 5716 6 2856 6 1745 6 0568 5 6028 5 1405 4
0469 5 6527 5 3954 6 5812 5 2041 6 8931 4 0432 5 6273 5 4856 4 7953 6
4293 7 2043 6 1625 5 0297 6 6740 5 4768 6 4537 5 1578 7 8917 5 2859 5
9452 7 5470 5 7863 6 5402 5 5940 5 1937 4 4213 6 7895 5 1093 5 4369 5
6230 5 7206 7 9364 6 0768 5 6548 7 5261 5 8453 4 4536 4 3791 6 0629 6
0512 5 8370 6 8207 7 3259 5 3756 5 2308 5 4329 5 6275 6 8036 4 3546 6
5139 5 0652 5 1572 5 3657 6 4086 4 4589 6 0375 4 5981 6 7253 5 1423 5
0432 5 0478 6 2709 6 4137 6 4560 6 8126 6 9265 5 1754 5 3710 6 9081 5
2479 6 9081 5 3492 5 8106 5 3841 5 8576 5 4210 7 6752 6 6842 5 4351 6
0967 7 9821 7 1628 6 2853 4 5708 6 7896 7 9527 7 7306 7 3468 6 8251 5
0742 5 3742 6 5917 7 8745 7 3416 6 9307 6 1865 6 8952 5 6234 4 6140 6
6380 5 1960 5 5630 6 2638 5 0146 5 2867 4 0456 3 4805 4 8634 5 4783 6
9402 6 8236 5 5806 5 6034 5 2157 6 5289 5 6950 6 3067 6 2590 7 9542 6
5401 5 9052 5 3765 5 4693 6 4982 5 8130 7 1246 3 0184 6 4982 8 1509 5
2598 6 7154 6 3826 6 5321 5 5837 7 6782 6 1705 4 9376 6 7912 8 3162 4

Current time is Thu Mar 24 06:21:23 2016

1 0
2 0
3 3
4 32
5 73
6 66
7 24
8 2
9 0

Average number of tries was 5.410.

C:\1_11_16>

An interactive version (user enters scores for each guess by the
computer) of the program is @

http://primepuzzle.com/tc/entropy.c

http://primepuzzle.com/tc/entropy.exe

C:\1_11_16>entropy.exe

entropy.c - tct - 1/25/16

Think of a 4-digit number. Use digits 0 thru 9.
No repeating digits.

My guess for your 4-digit number is 9764.

Compare your number to my guess. Count the bulls (right digit,
right position) and the cows (right digit, wrong position).
Enter two numbers, e.g. 0 2 for 0 bulls 2 cows : 0 2

My guess for your 4-digit number is 8493.

Compare your number to my guess. Count the bulls (right digit,
right position) and the cows (right digit, wrong position).
Enter two numbers, e.g. 0 2 for 0 bulls 2 cows : 0 1

My guess for your 4-digit number is 1927.

Compare your number to my guess. Count the bulls (right digit,
right position) and the cows (right digit, wrong position).
Enter two numbers, e.g. 0 2 for 0 bulls 2 cows : 1 2

My guess for your 4-digit number is 7910.

Compare your number to my guess. Count the bulls (right digit,
right position) and the cows (right digit, wrong position).
Enter two numbers, e.g. 0 2 for 0 bulls 2 cows : 2 2

My guess for your 4-digit number is 7901.

Compare your number to my guess. Count the bulls (right digit,
right position) and the cows (right digit, wrong position).
Enter two numbers, e.g. 0 2 for 0 bulls 2 cows : 4 0

It took me 5 tries!
I am beyond awesome.