67 Commits

Author SHA1 Message Date
18a8df1b9d Bah. Try the r5766 fix again, this time without the typo.
[originally from svn r5767]
[r5766 == 701cd045b36f9be1b0b8cfb74d9c191cb5813e98]
2005-05-11 18:49:42 +00:00
701cd045b3 Completion flashes were occasionally failing to be cleaned up if a
subsequent move animation began during them. Tracked this to
overenthusiastic use of clip() and fixed it.

[originally from svn r5766]
2005-05-11 13:03:17 +00:00
751d7a2524 solve_game() is passed the _initial_ game state, not the most recent
one; so we can't just set `ret->completed = ret->movecount' and hope
it's been set to something other than zero. Instead, we set both
move counts to 1, which is entirely arbitrary but works.

This fixes a subtle bug with the Solve feature: if you pressed
Solve, then disturbed the grid, then brought it back to the solved
state by making more forward moves (rather than using Undo), then
the first time you did this the `Moves since auto-solve' status line
would reset to zero.

[originally from svn r5759]
2005-05-07 16:07:26 +00:00
b35bedd60c Fix outdated comment
[originally from svn r5744]
2005-05-04 13:17:45 +00:00
2621183246 Allow for trailing '\0' in game_text_format() in various games.
[originally from svn r5743]
2005-05-04 12:56:04 +00:00
38c1f9b702 The Twiddle shuffling algorithm was theoretically parity-unbalanced:
it performed a fixed number of shuffling moves, and on each one it
had a 2/3 chance of flipping the permutation parity and a 1/3 chance
of keeping it the same. Markov analysis shows that over a run of
1500-odd shuffle moves this will end up being an undetectably small
actual bias in the parity of the generated grid, but it offends my
sense of pedantry nonetheless so here's a small change to make the
number of shuffling moves itself have randomly chosen parity. The
parity of generated grids should now be _exactly_ 50:50.

[originally from svn r5742]
2005-05-04 12:52:51 +00:00
c2273f2718 Ahem. The `Solve' option in orientable Twiddle needs to correct the
orientations as well as the order!

[originally from svn r5733]
2005-05-02 13:22:25 +00:00
4f7b65de2e Added an automatic `Solve' feature to most games. This is useful for
various things:
 - if you haven't fully understood what a game is about, it gives
   you an immediate example of a puzzle plus its solution so you can
   understand it
 - in some games it's useful to compare your solution with the real
   one and see where you made a mistake
 - in the rearrangement games (Fifteen, Sixteen, Twiddle) it's handy
   to be able to get your hands on a pristine grid quickly so you
   can practise or experiment with manoeuvres on it
 - it provides a good way of debugging the games if you think you've
   encountered an unsolvable grid!

[originally from svn r5731]
2005-05-02 13:17:10 +00:00
9e240e45df Introduce the concept of a `game_aux_info' structure. This is
constructed at the same time as an internally generated game seed,
so that it can preserve any interesting information known by the
program at generation time but not physically contained within the
text of the game seed itself. (Such as, for example, the solution.)
Currently not used for anything yet, but it will be.

[originally from svn r5729]
2005-05-02 10:12:26 +00:00
cb413f837b Copy-to-clipboard facility for Fifteen, Sixteen and Twiddle.
[originally from svn r5725]
2005-05-01 13:22:44 +00:00
791940b043 Introduced a new function in every game which formats a game_state
as text. This is used by front ends to implement copy-to-clipboard.
Currently the function does nothing (and is disabled) in every game
except Solo, but it's a start.

[originally from svn r5724]
2005-05-01 12:53:41 +00:00
e72931bfe2 I can never remember what that `TRUE' means in the game structure
definitions, so let's move it so that it's just next to the
functions it relates to. This also opens the way for me to add more
booleans next to other functions without getting confused as to
which is which.

[originally from svn r5723]
2005-05-01 11:07:13 +00:00
90db70378e Fix game IDs, which I broke in the orientability change. Also
introduce a sensible game ID notation for orientable games, and
finally (*blush*) turn the orientability triangles back the right
way up.

[originally from svn r5718]
2005-04-30 14:50:33 +00:00
9b870146f7 After brainstorming with Gareth, we've decided that this is a much
simpler and better way to indicate tile orientation than those
colour bars.

[originally from svn r5717]
2005-04-30 14:38:20 +00:00
d40b3172fe Bah, and of course there's a TODO comment I forgot to remove.
[originally from svn r5714]
2005-04-30 14:14:37 +00:00
d35f64096d Twiddle now has an additional mode in which tile orientation
matters. This mode is hard enough to scare the wossnames out of me,
but that's no reason not to put it in anyway!

[originally from svn r5713]
2005-04-30 14:14:14 +00:00
3be19aed94 New puzzle: `twiddle', generalised from a random door-unlocking
gadget in Metroid Prime 2.

[originally from svn r5708]
2005-04-30 12:54:22 +00:00