ref: 0c7f777ecb2301ac5c05b85d505a641d4131aff8
parent: 412344ff9a778ae6a07edeeedebf43a5362fae7b
author: Simon Tatham <anakin@pobox.com>
date: Tue May 31 07:19:11 EDT 2005
Improved the limited shuffle mechanism in Sixteen and Twiddle. They were already making sure that no shuffle move was the precise inverse of the previous one, or contributed to repeating the previous one so many times as to turn it into effectively fewer moves (doing the same rotation three times in Twiddle, or shifting a row by more than half its length in Sixteen). However, they were only checking against the _last_ move, which meant that in any situation where there were completely disjoint move spaces (4x4n2 Twiddle, or any Sixteen at all) it was still possible to have A then B then inv(A) occurring in the shuffle, leading to an unnecessarily easy game. Now both shuffle routines keep separate track of all _non-overlapping_ recent moves, and will avoid inverting any move which hasn't had another move overlap it since it was made. This should reduce the incidence of too-easy limited shuffle games, although it can't be prevented _entirely_ (since, if nothing else, it's always possible to increase the shuffle limit past the maximum group radius). [originally from svn r5875]