Improved the limited shuffle mechanism in Sixteen and Twiddle. They
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 31 May 2005 11:19:11 +0000 (11:19 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 31 May 2005 11:19:11 +0000 (11:19 +0000)
commit060ba13452821aaf23aa9f0f8a6ab82c13b759ee
tree9693c20976708e7779e9170315fcefbf6e36d1f8
parent171fbdaa70df511fabad11a55abf98b57a6b03cb
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).

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5875 cda61777-01e9-0310-a592-d414129be87e
sixteen.c
twiddle.c