6. Conclusion From the systematic way in which the next trial arrangement is constructed it is clear that the number of Cows must be 0, 1, or 2. Simple arguments show that the conclusions drawn in each case are correct. It is interesting to find the worst number of trials for a given M (number of colors) and N (number of positions), called Mastersize. We have tried a large number of examples on our program and it has never taken more than 12 trials for M = 8 and N = 5. It appears that, in the worst case, the algorithm takes less than (M + N) attempts. It is quite pleasant to observe that repetitions in the secret code actually reduce the number of attempts.
/lp/association-for-computing-machinery/turtles-and-defense-5nfXszNjAQ