Guess the Change

A "change" is a bellringing term. Each "change" is a different permutation of the bells.Examples are 12345678 , 13572468 or 87654321.The game is very simple. The computer thinks of a change. You suggest a change,and you will be told how many of the bells are in the same place as the one the computer is thinking of. On the basis of this information, you keep refining your guess until you come up with the correct change.

This program demonstrates a solution strategy, given a change. The algorithm begins by choosing a random change, and then gradually refines its guess by choosing any new change which is consistent with all previous information. This may not be the optimal strategy (for example, can we perform slightly better by considering the sets of changes included/excluded by a choice, and picking the change which is likely to give us the most information?), but it performs fairly well---an average of about 12 guesses for 8 bells--- and in general better than human guessers. The use of a random change to start with has no effect on the overall performance of the algorithm but guards against it being more biased towards a particular change.

Suggest a change(permutation of numbers 1 to n for 1 < n <= 9):