chiark / gitweb /
sgt-puzzles.git
18 years agoloopy_diffnames[] isn't used, and provokes a warning on OS X.
Simon Tatham [Thu, 13 Oct 2005 18:27:57 +0000 (18:27 +0000)]
loopy_diffnames[] isn't used, and provokes a warning on OS X.

[originally from svn r6389]

18 years agoYikes! I've only just noticed that this copy of tree234.c was still
Simon Tatham [Wed, 12 Oct 2005 17:57:40 +0000 (17:57 +0000)]
Yikes! I've only just noticed that this copy of tree234.c was still
using unwrappered malloc/free, leaving plenty of openings for out-
of-memory segfaults. Switch to using Puzzles's memory management,
which I should have done right at the start but can only assume I
forgot about.

[originally from svn r6388]

18 years agor6384 didn't go quite far enough. In fact, a grid square which
Simon Tatham [Mon, 10 Oct 2005 17:22:33 +0000 (17:22 +0000)]
r6384 didn't go quite far enough. In fact, a grid square which
differs between oldstate and state in only the hint bit should not
have a flip animation even if hints_active is TRUE. Flip animations
should only happen for tiles which are changing their primary state.
(Put like that, it seems so obvious.)

Test case which demonstrates this fix to be right and r6384 to be
wrong: 3x3:101000000000000000000,300 . Hit Solve immediately and
then click on the red-highlighted squares.

[originally from svn r6385]
[r6384 == dd175e490a197026210ba4432eec6236971c6173]

18 years agoFixes for handling human-entered Flip games. The clicked-on square
Simon Tatham [Mon, 10 Oct 2005 16:31:26 +0000 (16:31 +0000)]
Fixes for handling human-entered Flip games. The clicked-on square
always got a flip animation even when it wasn't one of the ones
being turned, and a square with no effect at all was still counting
as a move.

Since it's an invariant of Flip's internal generator that every
square includes itself as an effect, this never comes up in auto-
generated games.

[originally from svn r6384]

18 years agoRichard Earnshaw points out that if you enter an out-of-range number
Simon Tatham [Mon, 10 Oct 2005 16:29:58 +0000 (16:29 +0000)]
Richard Earnshaw points out that if you enter an out-of-range number
in the game description, the solver will fail to notice it and
overrun an array leading to assertion failure, silent wrong answers
or (in extreme cases) segfaults. Hence, validate_desc() now spots
them and kicks them out.

[originally from svn r6383]

18 years agoUse game_set_size() to set up the temporary drawstate in
Simon Tatham [Fri, 23 Sep 2005 12:50:51 +0000 (12:50 +0000)]
Use game_set_size() to set up the temporary drawstate in
game_print(), wherever feasible. This fixes a specific bug in Loopy
(James H's new field ds->linewidth wasn't being set up, leading to
corrupted print output), but I've made the change in all affected
files because it also seems like a generally good idea to encourage
it for future games, to prevent other problems of this type.

There is one slight snag, which is that Map _can't_ do this because
its game_set_size() also initialises a blitter. I could fix this by
abstracting the common parts of Map's game_set_size() out into a
subfunction called by game_set_size() and also called directly by
game_print(); alternatively, I could introduce a means of
determining whether a `drawing *' was for screen or printing use.
Not sure which yet.

[originally from svn r6340]

18 years agoFix very strange indentation issue!
Simon Tatham [Fri, 23 Sep 2005 12:43:42 +0000 (12:43 +0000)]
Fix very strange indentation issue!

[originally from svn r6339]

18 years agoBug fix from James H: prevent LINEWIDTH ever reaching zero.
Simon Tatham [Sun, 18 Sep 2005 17:00:07 +0000 (17:00 +0000)]
Bug fix from James H: prevent LINEWIDTH ever reaching zero.

[originally from svn r6331]

18 years agoAnother optimisation patch from Mike, which (among other things)
Simon Tatham [Sun, 18 Sep 2005 12:09:16 +0000 (12:09 +0000)]
Another optimisation patch from Mike, which (among other things)
eliminates gratuitous duplication of the solver state every time it
goes round the main loop, in favour of the usual type of
`done_something' flag.

[originally from svn r6322]

18 years agoOptimisation patch from Mike: remember which squares we've entirely
Simon Tatham [Thu, 15 Sep 2005 18:09:27 +0000 (18:09 +0000)]
Optimisation patch from Mike: remember which squares we've entirely
finished dealing with, and don't do them again on the next loop.

[originally from svn r6312]

18 years agoPatch from Mike: fix an array indexing error in the clue
Simon Tatham [Tue, 13 Sep 2005 18:34:12 +0000 (18:34 +0000)]
Patch from Mike: fix an array indexing error in the clue
highlighting, and adjust the presets.

[originally from svn r6303]

18 years agoPatch from Mike:
Simon Tatham [Mon, 12 Sep 2005 17:13:26 +0000 (17:13 +0000)]
Patch from Mike:
 - remove the backtracking `Hard' level, on the grounds that it was
   incredibly slow and not really usable.
 - introduce an `Easy' difficulty level below the standard one; many
   people seem to find this puzzle unusually hard, so an easy level
   is particularly helpful.
 - highlight unfulfillable clue squares (but not yet any other types
   of obvious error).

[originally from svn r6299]

18 years agoI am again gormless! When I overhauled Solo's grid generator in
Simon Tatham [Mon, 12 Sep 2005 17:09:29 +0000 (17:09 +0000)]
I am again gormless! When I overhauled Solo's grid generator in
r6160, I completely failed to ensure that generated grids were _at
most_ the required difficulty. It appears to have been only random
chance that prevented a request for a Trivial puzzle from producing
Extreme. Here's a one-line fix.

[originally from svn r6298]
[r6160 == e55838bc9b0d173ca539d0cfe714495b5c12b9dd]

18 years agoI found a slightly odd-looking line of code in this file a few days
Simon Tatham [Mon, 12 Sep 2005 12:38:58 +0000 (12:38 +0000)]
I found a slightly odd-looking line of code in this file a few days
ago, and nearly changed it to the obvious thing. After some thought,
though, I've decided the `bug' is better off unfixed, and added a
comment explaining why.

[originally from svn r6293]

18 years agoMinor improvement to initial loop generation.
Simon Tatham [Sun, 11 Sep 2005 18:05:23 +0000 (18:05 +0000)]
Minor improvement to initial loop generation.

[originally from svn r6292]

18 years agoOops; left some rogue diagnostics in.
Simon Tatham [Sun, 11 Sep 2005 14:53:39 +0000 (14:53 +0000)]
Oops; left some rogue diagnostics in.

[originally from svn r6291]

18 years agoRun the final solution-reduction pass in both directions, since
Simon Tatham [Sun, 11 Sep 2005 14:22:32 +0000 (14:22 +0000)]
Run the final solution-reduction pass in both directions, since
Gareth managed to find an example (10x8#458168771440033 in r6289)
where running it in only one direction failed to eliminate an
obviously redundant piece of path.

[originally from svn r6290]
[r6289 == b25fcc3f2621b0b41f3ae7cdabe57ed07f62d2c2]

18 years agoSolve function for Inertia, using what's essentially an approximate
Simon Tatham [Sun, 11 Sep 2005 12:40:49 +0000 (12:40 +0000)]
Solve function for Inertia, using what's essentially an approximate
TSP algorithm.

[originally from svn r6289]

18 years agoMarginally greater robustness in the face of solve_game() failing to
Simon Tatham [Sun, 11 Sep 2005 11:57:24 +0000 (11:57 +0000)]
Marginally greater robustness in the face of solve_game() failing to
return an error message.

[originally from svn r6288]

18 years agoCompletely rewrite the loop-detection algorithm used to check game
Simon Tatham [Sat, 10 Sep 2005 09:39:29 +0000 (09:39 +0000)]
Completely rewrite the loop-detection algorithm used to check game
completion, _again_. In r6174 I changed it from dsf to conventional
graph theory so that it could actually highlight loops as opposed to
just discovering that one existed. Unfortunately, yesterday I
discovered a fundamental graph-theoretic error in the latter
algorithm: if you had two entirely separate loops connected by a
single path, the path would be highlighted as well as the loops.

Therefore, I've reverted to the original dsf technique, combined
with a subsequent pass to trace around each loop discovered. This
version seems to do a better job of only highlighting the actual
loops.

[originally from svn r6283]
[r6174 == 2bd8e241a93165a99f5e2c4a2dd9c3b3b1e3c6f3]

18 years agoPatch from James H which initialises a couple of Windows API object
Simon Tatham [Sat, 10 Sep 2005 08:31:22 +0000 (08:31 +0000)]
Patch from James H which initialises a couple of Windows API object
handles to NULL before accidentally trying to use them for anything.

[originally from svn r6282]

18 years agoI arranged that dying after the game was already completed didn't
Simon Tatham [Tue, 6 Sep 2005 22:28:04 +0000 (22:28 +0000)]
I arranged that dying after the game was already completed didn't
increment the deaths counter. In doing so, I incorrectly handled the
borderline case, so that a death incurred _in the act_ of collecting
the final gem also didn't increment the deaths counter. Now it does.

[originally from svn r6277]

18 years agoTake the Windows taskbar into account when deciding on the maximum
Simon Tatham [Tue, 6 Sep 2005 18:49:18 +0000 (18:49 +0000)]
Take the Windows taskbar into account when deciding on the maximum
size of the puzzle window. This has involved some _completely
stupid_ window manipulation: in order to figure out in advance how
big I want my main window to be, I first have to _create_ the status
bar so I know how tall it is; but since I can't reparent it into my
main window after I've created it, I then have to throw that status
bar away and create a new one. *sigh*

[originally from svn r6276]

18 years agoVarious patches from Ben H: a fix for an outdated comment, a couple
Simon Tatham [Mon, 5 Sep 2005 17:21:05 +0000 (17:21 +0000)]
Various patches from Ben H: a fix for an outdated comment, a couple
of spurious ps_printf() arguments removed, and an error check in the
`make install' target.

[originally from svn r6275]

18 years agoI've dithered a bit in the past about whether or not it's allowable
Simon Tatham [Mon, 5 Sep 2005 17:18:03 +0000 (17:18 +0000)]
I've dithered a bit in the past about whether or not it's allowable
to call game_set_size() twice on the same drawstate. Finally, a
definite decision: it isn't. Accordingly, midend.c arranges never to
do so, the devel docs state that puzzles may enforce by assertion
that it never happens, and the four puzzles which care (i.e. use
blitters) do so.

[originally from svn r6274]

18 years agoPatch from Ton van Overbeek to fix a small memory leak in
Simon Tatham [Sun, 4 Sep 2005 12:53:27 +0000 (12:53 +0000)]
Patch from Ton van Overbeek to fix a small memory leak in
midend_solve().

[originally from svn r6271]

18 years agoPatch from Ton van Overbeek to correct Loopy's misplaced line ends
Simon Tatham [Sun, 4 Sep 2005 12:46:19 +0000 (12:46 +0000)]
Patch from Ton van Overbeek to correct Loopy's misplaced line ends
at small tile sizes.

[originally from svn r6270]

18 years agoAnother global environment-variable override across all games. This
Simon Tatham [Sun, 4 Sep 2005 12:40:23 +0000 (12:40 +0000)]
Another global environment-variable override across all games. This
one is <game>_TILESIZE, adjusting the game's default size. I
anticipate that this will probably _mostly_ be useful for debugging.

[originally from svn r6269]

18 years agoCouple of minor updates to restore accuracy.
Simon Tatham [Sun, 4 Sep 2005 12:31:04 +0000 (12:31 +0000)]
Couple of minor updates to restore accuracy.

[originally from svn r6268]

18 years agoPatches from James H. The usual stuff (memory leak fixes and 16-bit
Simon Tatham [Sat, 3 Sep 2005 18:32:58 +0000 (18:32 +0000)]
Patches from James H. The usual stuff (memory leak fixes and 16-bit
cleanliness), plus he's enlarged the pencil-mark circles from
TILESIZE/8 to TILESIZE/7. Makes no difference at all (thanks to
integer division) when TILESIZE is the default of 20, but presumably
helps at some other tile sizes. Fine by me.

[originally from svn r6265]

18 years agoSomeone points out that the Solo text formatter would be a lot
Simon Tatham [Fri, 2 Sep 2005 13:40:16 +0000 (13:40 +0000)]
Someone points out that the Solo text formatter would be a lot
better if it marked empty cells with something other than a space.
So here's a three-bit change to turn it into a dot :-)

[originally from svn r6261]

18 years agoStop Light Up from eating system keypresses, which it was previously
Simon Tatham [Thu, 1 Sep 2005 17:25:06 +0000 (17:25 +0000)]
Stop Light Up from eating system keypresses, which it was previously
doing whenever the cursor was active.

[originally from svn r6258]

18 years agoOptimiser placation.
Simon Tatham [Thu, 1 Sep 2005 12:17:14 +0000 (12:17 +0000)]
Optimiser placation.

[originally from svn r6257]

18 years agoPalm fixes for Loopy from James H: a #ifdef SLOW_SYSTEM, and an
Simon Tatham [Thu, 1 Sep 2005 12:00:55 +0000 (12:00 +0000)]
Palm fixes for Loopy from James H: a #ifdef SLOW_SYSTEM, and an
int/long fix.

[originally from svn r6256]

18 years agoJames H's memory leak fixes to Inertia.
Simon Tatham [Thu, 1 Sep 2005 11:59:51 +0000 (11:59 +0000)]
James H's memory leak fixes to Inertia.

[originally from svn r6255]

18 years agoJames H has implemented a new `Tricky' difficulty level in Light Up:
Simon Tatham [Thu, 1 Sep 2005 11:57:56 +0000 (11:57 +0000)]
James H has implemented a new `Tricky' difficulty level in Light Up:
a non-recursive level above Easy, which therefore moves the
recursive Hard mode further up still. Play-testing suggests that in
fact Tricky is often _harder_ than the old Hard mode, since the
latter had limited depth of recursion and would therefore spot
complex deductions only if it happened to start a recursion on the
right square; Tricky may be limited in the sophistication of its
complex deductions, but it never misses one, so its puzzles tend to
be hard all over.

Also in this checkin, a new source file `nullfe.c', containing all
the annoying stub functions required to make command-line solvers
link successfully. James wrote this for (the new) lightupsolver, and
I've used it to simplify the other stand-alone solvers.

[originally from svn r6254]

18 years agoAbility to drag pencil marks around.
Simon Tatham [Wed, 31 Aug 2005 19:27:41 +0000 (19:27 +0000)]
Ability to drag pencil marks around.

[originally from svn r6250]

18 years agoTerribly cunning approach to making the pencil marks look nicer,
Simon Tatham [Wed, 31 Aug 2005 17:34:47 +0000 (17:34 +0000)]
Terribly cunning approach to making the pencil marks look nicer,
thanks to Gareth.

[originally from svn r6248]

18 years agoDebian requires -lm, where Red Hat didn't.
Simon Tatham [Wed, 31 Aug 2005 16:59:51 +0000 (16:59 +0000)]
Debian requires -lm, where Red Hat didn't.

[originally from svn r6247]

18 years agoAhem; forgot about recursion. Recursive solving now shows its
Simon Tatham [Wed, 31 Aug 2005 12:43:14 +0000 (12:43 +0000)]
Ahem; forgot about recursion. Recursive solving now shows its
working as well.

[originally from svn r6245]

18 years agoNow that Map has some seriously complex deductions, it's about time
Simon Tatham [Wed, 31 Aug 2005 12:17:01 +0000 (12:17 +0000)]
Now that Map has some seriously complex deductions, it's about time
it had a command-line solver. In order to do this, I've had to
expose the internal region numbering because the solver has to have
some way to state which region it means; and in any case it's also
useful to have human-visible region numbering so that two people can
discuss a puzzle they're solving together. So pressing L during play
now toggles the display of region numbers; and `mapsolver' uses
those same numbers when showing its working and its solutions.

[originally from svn r6244]

18 years agoForcing chains in Map give rise to a new `Hard' difficulty level.
Simon Tatham [Tue, 30 Aug 2005 19:42:45 +0000 (19:42 +0000)]
Forcing chains in Map give rise to a new `Hard' difficulty level.
Also implemented the Map analogue of Solo's pencil marks, to make
this mode more playable.

[originally from svn r6240]

18 years agoImplemented a couple more reasoning modes for Extreme difficulty
Simon Tatham [Tue, 30 Aug 2005 17:44:18 +0000 (17:44 +0000)]
Implemented a couple more reasoning modes for Extreme difficulty
level: positional set elimination (which is so obvious I really
should have thought of it myself, though it's tricky to spot) and
forcing chains (which are a type of one-level proof by
contradiction, findable through a simple breadth-first search
without requiring recursion, but so ludicrously powerful that they
are able to solve _two thirds_ of grids that the pre-Extreme Solo
generated and rated as Unreasonable).

Of course this makes Unreasonable mode harder still...

[originally from svn r6239]

18 years agoBackspace and Delete keys now function like Space in Solo.
Simon Tatham [Mon, 29 Aug 2005 11:12:05 +0000 (11:12 +0000)]
Backspace and Delete keys now function like Space in Solo.

[originally from svn r6237]

18 years agoTypo in comment :-)
Simon Tatham [Mon, 29 Aug 2005 09:14:35 +0000 (09:14 +0000)]
Typo in comment :-)

[originally from svn r6236]

18 years agoAhem. The region density at which things start to get hairy is 2/3
Simon Tatham [Mon, 29 Aug 2005 09:05:35 +0000 (09:05 +0000)]
Ahem. The region density at which things start to get hairy is 2/3
of the grid area, not 3/2!

[originally from svn r6235]

18 years agoAesthetic improvements to the Map error indicators:
Simon Tatham [Mon, 29 Aug 2005 08:57:45 +0000 (08:57 +0000)]
Aesthetic improvements to the Map error indicators:
 - the exclamation mark was a bit dot-heavy
 - allowing the indicator to be placed at a grid point as well as
   half way between two grid points allows some much more natural
   positioning.

[originally from svn r6234]

18 years agoUnreasonable mode for Map.
Simon Tatham [Sun, 28 Aug 2005 14:29:19 +0000 (14:29 +0000)]
Unreasonable mode for Map.

[originally from svn r6229]

18 years agoError highlighting in Map.
Simon Tatham [Sun, 28 Aug 2005 13:53:07 +0000 (13:53 +0000)]
Error highlighting in Map.

[originally from svn r6228]

18 years agoThere seems to be some odd behaviour when GTK is asked to draw an
Simon Tatham [Sun, 28 Aug 2005 13:52:58 +0000 (13:52 +0000)]
There seems to be some odd behaviour when GTK is asked to draw an
outline polygon with a clipping rectangle active. I don't know or
care whether this is GTK or my X server or what, but I'm working
around it by drawing the lines myself, which seems to sort it out.

[originally from svn r6227]

18 years agoHACKING.but -> devel.but
Jacob Nevins [Sun, 28 Aug 2005 09:35:55 +0000 (09:35 +0000)]
HACKING.but -> devel.but

[originally from svn r6226]

18 years agoFix array bounds violation in the solver. Oops.
Simon Tatham [Sat, 27 Aug 2005 09:53:38 +0000 (09:53 +0000)]
Fix array bounds violation in the solver. Oops.

[originally from svn r6225]

18 years agoOS X seems particularly picky about possibly uninitialised
Simon Tatham [Sat, 27 Aug 2005 09:35:14 +0000 (09:35 +0000)]
OS X seems particularly picky about possibly uninitialised
variables. Placate its optimiser (again).

[originally from svn r6223]

18 years agoNew puzzle: `Inertia', originally written for Windows by Ben
Simon Tatham [Sat, 27 Aug 2005 09:21:22 +0000 (09:21 +0000)]
New puzzle: `Inertia', originally written for Windows by Ben
Olmstead and reimplemented with the help of his source code which he
was kind enough to release into the public domain.

[originally from svn r6222]

18 years agoTrivial doc changes after recent prolificacy.
Jacob Nevins [Fri, 26 Aug 2005 19:44:25 +0000 (19:44 +0000)]
Trivial doc changes after recent prolificacy.

[originally from svn r6220]

18 years agoMemory leak and type safety fixes from James H.
Simon Tatham [Thu, 25 Aug 2005 18:14:54 +0000 (18:14 +0000)]
Memory leak and type safety fixes from James H.

[originally from svn r6219]

18 years agoPhil Bordelon points out that the general convention is to orient
Simon Tatham [Thu, 25 Aug 2005 08:07:44 +0000 (08:07 +0000)]
Phil Bordelon points out that the general convention is to orient
rectangular presets in a portrait fashion.

[originally from svn r6217]

18 years agoMike points out that I made an error in one of the presets...
Simon Tatham [Thu, 25 Aug 2005 07:57:58 +0000 (07:57 +0000)]
Mike points out that I made an error in one of the presets...

[originally from svn r6216]

18 years agoOver-enthusiastic assertion introduced in the printing revamp was
Simon Tatham [Wed, 24 Aug 2005 22:13:43 +0000 (22:13 +0000)]
Over-enthusiastic assertion introduced in the printing revamp was
causing Mines to crash one second after starting a game. Oops.

[originally from svn r6214]

18 years agoOptimiser placation for OS X gcc.
Simon Tatham [Wed, 24 Aug 2005 21:44:54 +0000 (21:44 +0000)]
Optimiser placation for OS X gcc.

[originally from svn r6212]

18 years agoNew puzzle: `Loopy', an implementation of Nikoli's `Slither Link' or
Simon Tatham [Wed, 24 Aug 2005 21:32:54 +0000 (21:32 +0000)]
New puzzle: `Loopy', an implementation of Nikoli's `Slither Link' or
`Loop the Loop' puzzle. Contributed by Mike Pinna.

[originally from svn r6211]

18 years agoMinor update to Solo's documentation due to Extreme mode.
Simon Tatham [Wed, 24 Aug 2005 17:49:52 +0000 (17:49 +0000)]
Minor update to Solo's documentation due to Extreme mode.

[originally from svn r6210]

18 years agoBrand new difficulty level in Solo. The other day Gareth and I
Simon Tatham [Wed, 24 Aug 2005 17:32:39 +0000 (17:32 +0000)]
Brand new difficulty level in Solo. The other day Gareth and I
independently discovered an advanced reasoning technique in Map, and
then it occurred to me that since Solo can also be considered as a
graph-colouring game the same technique ought to be applicable. And
it is; so here's a new difficulty level, `Extreme', which sits just
above Advanced. Grids graded `Extreme' by new-Solo will of course
fall into old-Solo's `Unreasonable' category (since they're not
soluble using the old set of non-recursive methods). A brief and
unscientific experiment suggests that about one in six Unreasonable
grids generated by old-Solo are classified Extreme by the new
solver; so the remaining Unreasonable mode (now containing a subset
of the grids it used to) hasn't actually become much harder.

[originally from svn r6209]

18 years agoDon't report an error when loading a saved game from the command
Simon Tatham [Tue, 23 Aug 2005 12:49:21 +0000 (12:49 +0000)]
Don't report an error when loading a saved game from the command
line unless there really _is_ an error!

[originally from svn r6203]

18 years agoJames H points out a rogue fprintf in Net's print routine.
Simon Tatham [Mon, 22 Aug 2005 22:58:19 +0000 (22:58 +0000)]
James H points out a rogue fprintf in Net's print routine.

[originally from svn r6202]

18 years agoMemory leak in the new printing stuff, plus a couple of comment
Simon Tatham [Mon, 22 Aug 2005 18:46:38 +0000 (18:46 +0000)]
Memory leak in the new printing stuff, plus a couple of comment
corrections.

[originally from svn r6199]

18 years ago`Solve' operation on an already solved map without an aux_info was
Simon Tatham [Mon, 22 Aug 2005 09:27:52 +0000 (09:27 +0000)]
`Solve' operation on an already solved map without an aux_info was
returning NULL due to no moves being required, leading to a strange
error message. Trivial fix.

[originally from svn r6198]

18 years ago*blinks* I apparently didn't try _building_ the OS X port since the
Simon Tatham [Sun, 21 Aug 2005 10:55:17 +0000 (10:55 +0000)]
*blinks* I apparently didn't try _building_ the OS X port since the
printing upheaval. I could have sworn I had. Oh well; small errors
fixed.

[originally from svn r6197]

18 years agoRetire redundant print_line_width() in Net: a relic from a failed
Simon Tatham [Sat, 20 Aug 2005 15:49:43 +0000 (15:49 +0000)]
Retire redundant print_line_width() in Net: a relic from a failed
printing strategy, irrelevant to the one which worked.

[originally from svn r6194]

18 years agoNative Windows printing support, using the infrastructure I put in
Simon Tatham [Sat, 20 Aug 2005 15:48:55 +0000 (15:48 +0000)]
Native Windows printing support, using the infrastructure I put in
place in r6190. I'm quite pleased that I didn't have to modify the
printing infrastructure _at all_ to make this work; the only source
change required outside windows.c was the addition of a trivial
utility function midend_get_params(), and that was for the benefit
of bulk puzzle generation rather than anything to do with actual
printing.

As far as I can tell, all printable puzzles now print almost
indistinguishably from the way they print under Unix. If you look
closely the font is slightly different, and the Windows standard
hatching doesn't seem to be quite as nice as the kind I did by hand
in ps.c (and, particularly annoyingly, hatched areas don't show up
at all for me when I print to a file and use gv, though they come
out fine on the printer itself); but it's all there, and it all
works.

[originally from svn r6193]
[r6190 == af59dcf6858264103bbc621761feee3aed5aaf2a]

18 years agoRichard B points out a cut and paste error.
Simon Tatham [Fri, 19 Aug 2005 12:29:08 +0000 (12:29 +0000)]
Richard B points out a cut and paste error.

[originally from svn r6192]

18 years agoBah, there's always one. Remove the now-erroneous `*.py' from the
Simon Tatham [Fri, 19 Aug 2005 07:49:44 +0000 (07:49 +0000)]
Bah, there's always one. Remove the now-erroneous `*.py' from the
makedist script.

[originally from svn r6191]

18 years agoSubstantial infrastructure upheaval. I've separated the drawing API
Simon Tatham [Thu, 18 Aug 2005 17:50:14 +0000 (17:50 +0000)]
Substantial infrastructure upheaval. I've separated the drawing API
as seen by the back ends from the one implemented by the front end,
and shoved a piece of middleware (drawing.c) in between to permit
interchange of multiple kinds of the latter. I've also added a
number of functions to the drawing API to permit printing as well as
on-screen drawing, and retired print.py in favour of integrated
printing done by means of that API.

The immediate visible change is that print.py is dead, and each
puzzle now does its own printing: where you would previously have
typed `print.py solo 2x3', you now type `solo --print 2x3' and it
should work in much the same way.

Advantages of the new mechanism available right now:
 - Map is now printable, because the new print function can make use
   of the output from the existing game ID decoder rather than me
   having to replicate all those fiddly algorithms in Python.
 - the new print functions can cope with non-initial game states,
   which means each puzzle supporting --print also supports
   --with-solutions.
 - there's also a --scale option permitting users to adjust the size
   of the printed puzzles.

Advantages which will be available at some point:
 - the new API should permit me to implement native printing
   mechanisms on Windows and OS X.

[originally from svn r6190]

18 years agoJust noticed another thing that could easily catch me out when
Simon Tatham [Mon, 15 Aug 2005 14:12:07 +0000 (14:12 +0000)]
Just noticed another thing that could easily catch me out when
adding a new puzzle.

[originally from svn r6189]

18 years agoMemory leak fixes from James H.
Simon Tatham [Sat, 13 Aug 2005 21:35:41 +0000 (21:35 +0000)]
Memory leak fixes from James H.

[originally from svn r6188]

18 years agoNew puzzle: `Map'. Vaguely original, for a change.
Simon Tatham [Sat, 13 Aug 2005 10:43:26 +0000 (10:43 +0000)]
New puzzle: `Map'. Vaguely original, for a change.

(This puzzle is theoretically printable, but I haven't added it in
print.py since there's rather a lot of painful processing required
to get from the game ID to the puzzle's visual appearance. It
probably won't become printable unless I get round to implementing a
more integrated printing architecture.)

[originally from svn r6186]

18 years ago16-bit-cleanness fixes from James H (again). It would be really nice
Simon Tatham [Thu, 11 Aug 2005 11:06:13 +0000 (11:06 +0000)]
16-bit-cleanness fixes from James H (again). It would be really nice
to have some means of automatically spotting this sort of problem on
a desktop platform, but I can't immediately think of one; building a
trick compiler which thinks `int' is 16 bits would be the obvious
option, but it would immediately break the ABIs to all the system
functions.

[originally from svn r6184]

18 years agoVery fiddly corrections to the loop highlighting. ERRSLASH means the
Simon Tatham [Tue, 9 Aug 2005 18:09:07 +0000 (18:09 +0000)]
Very fiddly corrections to the loop highlighting. ERRSLASH means the
slash in this square is red, so it does indeed imply that some of
the edge markings are also red; but it doesn't mean _all_ the edge
markings must be red. So instead of assuming ERRSLASH implies all
edge error markers, we set the correct set of edge error markers at
the same time as setting ERRSLASH, at which point we know which kind
of slash it is so we know which ones to set.

[originally from svn r6175]

18 years agoImplement error checking in Slant. Clue points are now highlighted
Simon Tatham [Tue, 9 Aug 2005 17:14:25 +0000 (17:14 +0000)]
Implement error checking in Slant. Clue points are now highlighted
in red if it's impossible to fulfill them (either through too many
neighbours connecting to them, or too many not connecting to them),
and edges are highlighted in red if they form part of a loop.

In order to do this I've had to revamp the redraw function
considerably. Each square is now drawn including its top and left
grid edges, but _not_ its bottom or right ones - which means that I
need to draw an extra strip of empty squares outside the actual grid
in order to draw the few pixels which appear on the grid bottom and
right borders and also to red-highlight border clues.

[originally from svn r6174]

18 years agoRemove conditional definition of MAX_GRIDGEN_TRIES, for consistency
Simon Tatham [Sun, 7 Aug 2005 08:47:08 +0000 (08:47 +0000)]
Remove conditional definition of MAX_GRIDGEN_TRIES, for consistency
between Palm and other ports when fed the same random seed.

[originally from svn r6172]

18 years agoPlacate optimiser.
Simon Tatham [Sun, 7 Aug 2005 08:01:51 +0000 (08:01 +0000)]
Placate optimiser.

[originally from svn r6171]

18 years agoStreamline `slantsolver' a bit (avoid showing advanced working on
Simon Tatham [Sat, 6 Aug 2005 14:52:26 +0000 (14:52 +0000)]
Streamline `slantsolver' a bit (avoid showing advanced working on
easy puzzles, and stop having a second encoding of the difficulty
levels).

[originally from svn r6170]

18 years agoDocument hard mode in Slant, and also fix an obvious memory
Simon Tatham [Sat, 6 Aug 2005 10:38:34 +0000 (10:38 +0000)]
Document hard mode in Slant, and also fix an obvious memory
management error in game_configure().

[originally from svn r6169]

18 years agoIntroduce an environment variable setting (SLANT_SWAP_BUTTONS=yes)
Simon Tatham [Sat, 6 Aug 2005 10:33:46 +0000 (10:33 +0000)]
Introduce an environment variable setting (SLANT_SWAP_BUTTONS=yes)
to reverse the effect of the mouse buttons. Gareth has been
complaining about this for days: apparently he finds precisely the
opposite control system intuitive to me.

This is a horrendous hack, and pushes me one step closer to losing
my temper and designing a proper preferences architecture.

[originally from svn r6168]

18 years agoA bunch of new reasoning techniques in the Slant solver, leading to
Simon Tatham [Sat, 6 Aug 2005 10:24:52 +0000 (10:24 +0000)]
A bunch of new reasoning techniques in the Slant solver, leading to
a new Hard mode. Also added a command-line `slantsolver' which can
grade puzzles and show working.

[originally from svn r6167]

18 years agoCleanups to completion flashes: all four of these games used to
Simon Tatham [Fri, 5 Aug 2005 17:17:23 +0000 (17:17 +0000)]
Cleanups to completion flashes: all four of these games used to
redraw the whole window _every_ time game_redraw() was called during
a flash. Now they only redraw the whole window every time the
background colour actually changes. Thanks to James H for much of
the work.

[originally from svn r6166]

18 years agoNew puzzle: `Light Up', by James H.
Simon Tatham [Thu, 4 Aug 2005 19:14:10 +0000 (19:14 +0000)]
New puzzle: `Light Up', by James H.

Also in this checkin (committed by mistake - I meant to do it
separately), a behind-the-scenes change to Slant to colour the two
non-touching classes of diagonals in different colours. Both colours
are set to black by default, but configuration by way of
SLANT_COLOUR_* can distinguish them if you want.

[originally from svn r6164]

18 years agoEnvironment-based configuration wasn't sensibly usable in games with
Simon Tatham [Thu, 4 Aug 2005 18:09:48 +0000 (18:09 +0000)]
Environment-based configuration wasn't sensibly usable in games with
spaces in the name. Fixed. (One day I really must get round to
turning this into a proper config mechanism.)

[originally from svn r6163]

18 years agoPatch from James H: tinker with the presets on SLOW_SYSTEMs.
Simon Tatham [Thu, 4 Aug 2005 17:08:26 +0000 (17:08 +0000)]
Patch from James H: tinker with the presets on SLOW_SYSTEMs.

[originally from svn r6162]

18 years agoBug fix from James H: solve_game() was returning error messages in
Simon Tatham [Thu, 4 Aug 2005 17:07:51 +0000 (17:07 +0000)]
Bug fix from James H: solve_game() was returning error messages in
the return value rather than in *error. In the old days type-
checking would have caught this, but now of course they're the same
type.

[originally from svn r6161]

18 years agoI am COMPLETELY GORMLESS. The Solo grid generator, when eliminating
Simon Tatham [Thu, 4 Aug 2005 11:16:10 +0000 (11:16 +0000)]
I am COMPLETELY GORMLESS. The Solo grid generator, when eliminating
clues from a filled grid, was using the algorithm

 - loop over the whole grid looking for a clue (or symmetry group of
   clues) which can be safely removed
 - remove it
 - loop over the whole grid again, and so on.

This was due to my vague feeling that removing one clue might affect
whether another can be removed. Of course this can happen - two
clues can be alternative ways of deducing the same vital fact so
that removing one makes the other necessary - but what _can't_
happen is for removing one clue to make another _become_ removable,
since you can only do that by _adding_ information. In other words,
after testing a clue and determining that it can't be removed, you
never need to test it again. Thus, a much simpler algorithm is

 - loop over the possible clues (or symmetry groups) _once_, in a
   random order
 - for each clue (group), if it is removable, remove it.

This still guarantees to leave the grid in a state where no further
clues can be removed, but it greatly cuts down puzzle generation
time and also simplifies the code. I am a fool for not having
spotted this in three and a half months!

[originally from svn r6160]

18 years agoCleanups from James H: a few missing statics, a precautionary cast
Simon Tatham [Wed, 3 Aug 2005 12:44:51 +0000 (12:44 +0000)]
Cleanups from James H: a few missing statics, a precautionary cast
or two, a debugging fix, a couple of explicit initialisations of
variables that were previously read uninitialised, and a fix for a
whopping great big memory leak in Slant owing to me having
completely forgotten to write free_game().

[originally from svn r6159]

18 years agoSlant uses the same generation strategy as Solo, despite not having
Simon Tatham [Wed, 3 Aug 2005 11:06:16 +0000 (11:06 +0000)]
Slant uses the same generation strategy as Solo, despite not having
the property which devel.but claimed to be the reason why that
strategy works. A bit of thought revealed what the _real_ reason is
why this strategy works in some puzzles and not others, so I've
rewritten the paragraph to be more accurate.

[originally from svn r6158]

18 years agoBah! There's _always_ one. Display glitch corrected.
Simon Tatham [Tue, 2 Aug 2005 23:24:03 +0000 (23:24 +0000)]
Bah! There's _always_ one. Display glitch corrected.

[originally from svn r6156]

18 years agoNew puzzle: `Slant', picked from the Japanese-language section of
Simon Tatham [Tue, 2 Aug 2005 23:16:46 +0000 (23:16 +0000)]
New puzzle: `Slant', picked from the Japanese-language section of
nikoli.co.jp (which has quite a few puzzles that they don't seem to
have bothered to translate into English).

Minor structural change: the disjoint set forest code used in the
Net solver has come in handy again, so I've moved it out into its
own module dsf.c.

[originally from svn r6155]

18 years agoVarious cleanups and clarifications to devel.but; some from Richard
Simon Tatham [Mon, 1 Aug 2005 11:27:01 +0000 (11:27 +0000)]
Various cleanups and clarifications to devel.but; some from Richard
B and some from me. Also an additional utility function
`random_copy' from Richard B, which he says is useful in a new
puzzle he's working on and which seems likely to come in handy again
at some point.

[originally from svn r6153]

18 years agoNew end-game approach to Black Box. Instead of revealing the ball
Simon Tatham [Sun, 31 Jul 2005 14:56:18 +0000 (14:56 +0000)]
New end-game approach to Black Box. Instead of revealing the ball
positions immediately when you make an error, the game now reveals
as little information as is necessary to prove you wrong (including
none - if an existing laser path you know about is inconsistent with
your guesses, the game will just point it out and tell you nothing
new!) and you can try again. Errors are counted in much the same way
as deaths in Mines.

[originally from svn r6152]

18 years agomissing `i' in `\e'
Jacob Nevins [Fri, 29 Jul 2005 23:05:10 +0000 (23:05 +0000)]
missing `i' in `\e'

[originally from svn r6151]

18 years agoOne more fix from Ben H. Also switched round the arena colour
Simon Tatham [Fri, 29 Jul 2005 16:45:52 +0000 (16:45 +0000)]
One more fix from Ben H. Also switched round the arena colour
selection in the redraw function, so that locked squares are no
longer displayed once the game is at an end. (It looked untidy and
disorienting for lighter-coloured locked squares to suddenly become
darker when the box was opened. You can still flip back and forth to
your previous game state using undo/redo if you want to compare the
results against your lock pattern.)

[originally from svn r6150]

18 years agoVarious fixes and cleanups suggested by Ben Hutchings:
Simon Tatham [Fri, 29 Jul 2005 12:07:10 +0000 (12:07 +0000)]
Various fixes and cleanups suggested by Ben Hutchings:
 - clarified wording of messages in validate_params(), including in
   particular a correction from `< 255' to `<= 255'
 - fixed random_upto() in game generation which caused the maximum
   number of balls never to be used when there was uncertainty
 - fixed widespread miscalculation of rectangular-array indices
   (multiplication by h instead of w, which would have broken
   non-square grids rather profoundly)
 - corrected an ANSI namespace violation
 - removed real functionality from the inside of assert()
   statements, so that the game should still work when compiled
   -DNDEBUG
 - couple of unnecessary linear-time loops removed.

[originally from svn r6149]