Oh, in the data mining of school in school, I talked about the amount of information about the amount of information.
Guess the digital game:
? There are four decimal numbers, generally guess 8 times
? Each time returns AABB (a represents the correct number and the location is correct, b means the correct number but the location is incorrect)
Such as: Supplement to guess the number 1234, if the player guess 0134, returns 2A1B (3, 4 is A, 1 is b)
Idea:
? Simulating people guess the process, first construct a collection including all possible numbers (10 * 9 * 8 * 7 = 5040), first guess one, delete the original collection in accordance with the return of Xaxb Then, then the next one is selected. Selecting a principle that: select the number of the remaining collections, namely: The return value obtained by the number selected is similar to the probability of any one of Xaxb.
? I use the amount of information, namely:
?? For each of the numbers N, each of the Number N, with each return value (from 0A0B to 4A0B, there are 15 kinds), see how many remaining, using Pi Returns the situation, then according to the information equation: INFO (N) = σ (pi / size) * log (pi / size), then take MAX (INFO (I)) i = 0..size; the largest INFO (n) The corresponding number is the number selected.
http://www.blogbus.com/blogbus/blog/Userfiles/16192/1089196646.rar
The compressed package includes source code and executable generated by VC6.0 compiling
Guesnumgame.dsw: Easy guess digital game
Guessnum.dsw: Guess numbers by the computer, basically 6-7 times
Guesnumall.cpp: has not yet been edited, intend to use the decision tree method to guess the number, and can calculate how many times the number is required for all numbers
The idea is simple, but it is very slow to calculate, and can I stand if the RELEASE version is still so fast?