26 Commits

Author SHA1 Message Date
2621183246 Allow for trailing '\0' in game_text_format() in various games.
[originally from svn r5743]
2005-05-04 12:56:04 +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
850a70a03c Copy-to-clipboard for Rectangles.
[originally from svn r5726]
2005-05-01 13:51:46 +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
cc54553226 Rather than each game backend file exporting a whole load of
functions and a couple of variables, now each one exports a single
structure containing a load of function pointers and said variables.
This should make it easy to support platforms on which it's sensible
to compile all the puzzles into a single monolithic application. The
two existing platforms are still one-binary-per-game.

[originally from svn r5126]
2005-01-17 13:48:57 +00:00
ae63b8010b Remove extraneous underscores at start and end of Rectangles seeds.
[originally from svn r4473]
2004-08-17 11:51:20 +00:00
daac529a9e After discussion with Simon, the game redraw functions are now passed a new
argument `dir' which tells them whether this redraw is due to an undo, rather
than have them second-guess it from game state.
Note that none of the actual games yet take advantage of this; so it hasn't
been tested in anger (although it has been inspected by debugging).

[originally from svn r4469]
2004-08-16 16:29:54 +00:00
58769376e5 Robustness in the face of a completely configurable expansion factor.
[originally from svn r4464]
2004-08-16 13:10:07 +00:00
d58d5c11d5 Fold in the expanded-grid mechanism for generating different kinds
of puzzle. Configurable option, turned off by default, and not
propagated in game IDs (though you can explicitly specify it in
command-line parameters, and the docs explain how).

[originally from svn r4461]
2004-08-16 12:42:11 +00:00
137c1d7bbd Added a help file, mostly thanks to Jacob.
[originally from svn r4460]
2004-08-16 12:23:56 +00:00
fc862ce0f2 Fix a memory leak.
[originally from svn r4239]
2004-05-22 13:07:23 +00:00
350683b253 Introduce routines in each game module to encode a set of game
parameters as a string, and decode it again. This is used in
midend.c to prepend the game parameters to the game seed, so that
copying out of the Specific box is sufficient to completely specify
the game you were playing.
Throughout development of these games I have referred to `seed'
internally, and `game ID' externally. Now there's a measurable
difference between them! :-)

[originally from svn r4231]
2004-05-19 11:57:09 +00:00
ba076fbdb2 Fix `visible' calculation (again).
[originally from svn r4223]
2004-05-12 18:54:16 +00:00
3c2a320143 Ahem. Seed validation was completely broken.
[originally from svn r4222]
2004-05-12 18:53:47 +00:00
1ea3c92c17 During redraws, I now do corner analysis centrally, which enables me
to maintain the `visible' array accurately and hence actually switch
it on. This prevents us having to redraw the entire playing area on
any move, which means really big grids are now sensibly playable
without display lag.

[originally from svn r4221]
2004-05-12 18:45:11 +00:00
3f9e52dae2 Remove vestigial code from the previous attempt at clever grid
generation. Grid generation should now be orders of magnitude faster
at large sizes.

[originally from svn r4220]
2004-05-12 18:28:11 +00:00
0579ca1005 Fiddle with the coordinate system to see if I can improve user
experience.

[originally from svn r4219]
2004-05-12 12:33:03 +00:00
87aec91b37 Flash on completion. Two people actually complained! :-)
[originally from svn r4218]
2004-05-12 12:32:27 +00:00
3ccdce2f6c Missing draw_update call.
[originally from svn r4216]
2004-05-11 23:22:08 +00:00
8a67b0ed2c Cosmetic fixes for Windows.
[originally from svn r4212]
2004-05-11 18:46:10 +00:00
eb8a374d0d We should turn off the dragging variables in the UI _whenever_
`enddrag' is TRUE, not just when the end of the drag was within a
sensible range.

[originally from svn r4210]
2004-05-11 18:32:48 +00:00
e5d773604f Rectangles is now actually playable, since I've used the new UI
feature to arrange a mechanism that allows you to draw a whole
rectangle at a time by dragging rather than having to click each
edge individually.

[originally from svn r4209]
2004-05-11 18:29:49 +00:00
180802b362 Framework alteration: we now support a `game_ui' structure in
addition to the `game_state'. The new structure is intended to
contain ephemeral data pertaining to the game's user interface
rather than the actual game: things stored in the UI structure are
not restored in an Undo, for example.
make_move() is passed the UI to modify as it wishes; it is now
allowed to return the _same_ game_state it was passed, to indicate
that although no move has been made there has been a UI operation
requiring a redraw.

[originally from svn r4207]
2004-05-11 17:44:30 +00:00
a1c88470a3 Added a new game, `Rectangles', taken from nikoli.co.jp.
[originally from svn r4206]
2004-05-11 17:06:50 +00:00