chiark / gitweb /
Improved the limited shuffle mechanism in Sixteen and Twiddle. They
authorSimon Tatham <anakin@pobox.com>
Tue, 31 May 2005 11:19:11 +0000 (11:19 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 31 May 2005 11:19:11 +0000 (11:19 +0000)
commit0c7f777ecb2301ac5c05b85d505a641d4131aff8
tree9693c20976708e7779e9170315fcefbf6e36d1f8
parent412344ff9a778ae6a07edeeedebf43a5362fae7b
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]
sixteen.c
twiddle.c