sgt/puzzles
18 years agoNew puzzle from James H: `Bridges', another Nikoli job.
simon [Fri, 21 Oct 2005 08:07:31 +0000 (08:07 +0000)]
New puzzle from James H: `Bridges', another Nikoli job.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6409 cda61777-01e9-0310-a592-d414129be87e

18 years agoMiscellaneous fixes. Correct a comparison of y with w causing
simon [Mon, 17 Oct 2005 18:41:05 +0000 (18:41 +0000)]
Miscellaneous fixes. Correct a comparison of y with w causing
assertion failures in portrait-type grids; retire an unused array in
the game generation function (my original generation strategy needed
it, but the final one didn't); correct a typo; further restrict the
generable sizes of game and include a special case for 4x4dt to
prevent a tight loop.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6405 cda61777-01e9-0310-a592-d414129be87e

18 years agoJust noticed a longhand shuffling operation which I must have missed
simon [Mon, 17 Oct 2005 18:32:24 +0000 (18:32 +0000)]
Just noticed a longhand shuffling operation which I must have missed
when I converted them all into calls to shuffle().

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6404 cda61777-01e9-0310-a592-d414129be87e

18 years agoJanes H provides a small workaround for a Palm tools bug.
simon [Sat, 15 Oct 2005 16:03:14 +0000 (16:03 +0000)]
Janes H provides a small workaround for a Palm tools bug.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6403 cda61777-01e9-0310-a592-d414129be87e

18 years agoSmall error in solver diagnostics.
simon [Sat, 15 Oct 2005 15:01:40 +0000 (15:01 +0000)]
Small error in solver diagnostics.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6402 cda61777-01e9-0310-a592-d414129be87e

18 years agoRevamp of the control mechanism to permit drag- as well as
simon [Fri, 14 Oct 2005 12:23:41 +0000 (12:23 +0000)]
Revamp of the control mechanism to permit drag- as well as
click-based control. Only used for right-dragging to clear a large
area to NONTENT.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6400 cda61777-01e9-0310-a592-d414129be87e

18 years agoNew puzzle: `Tents'. Requires a potentially shared algorithms module
simon [Thu, 13 Oct 2005 18:30:24 +0000 (18:30 +0000)]
New puzzle: `Tents'. Requires a potentially shared algorithms module
maxflow.c. Also in this checkin, fixes to the OS X and GTK back ends
to get ALIGN_VNORMAL right. This is the first time I've used it! :-)

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6390 cda61777-01e9-0310-a592-d414129be87e

18 years agoloopy_diffnames[] isn't used, and provokes a warning on OS X.
simon [Thu, 13 Oct 2005 18:27:57 +0000 (18:27 +0000)]
loopy_diffnames[] isn't used, and provokes a warning on OS X.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6389 cda61777-01e9-0310-a592-d414129be87e

18 years agoYikes! I've only just noticed that this copy of tree234.c was still
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6388 cda61777-01e9-0310-a592-d414129be87e

18 years agor6384 didn't go quite far enough. In fact, a grid square which
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6385 cda61777-01e9-0310-a592-d414129be87e

18 years agoFixes for handling human-entered Flip games. The clicked-on square
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6384 cda61777-01e9-0310-a592-d414129be87e

18 years agoRichard Earnshaw points out that if you enter an out-of-range number
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6383 cda61777-01e9-0310-a592-d414129be87e

18 years agoUse game_set_size() to set up the temporary drawstate in
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6340 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6339 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6331 cda61777-01e9-0310-a592-d414129be87e

18 years agoAnother optimisation patch from Mike, which (among other things)
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6322 cda61777-01e9-0310-a592-d414129be87e

18 years agoOptimisation patch from Mike: remember which squares we've entirely
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6312 cda61777-01e9-0310-a592-d414129be87e

18 years agoPatch from Mike: fix an array indexing error in the clue
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6303 cda61777-01e9-0310-a592-d414129be87e

18 years agoPatch from Mike:
simon [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).

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6299 cda61777-01e9-0310-a592-d414129be87e

18 years agoI am again gormless! When I overhauled Solo's grid generator in
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6298 cda61777-01e9-0310-a592-d414129be87e

18 years agoI found a slightly odd-looking line of code in this file a few days
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6293 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6292 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6291 cda61777-01e9-0310-a592-d414129be87e

18 years agoRun the final solution-reduction pass in both directions, since
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6290 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6289 cda61777-01e9-0310-a592-d414129be87e

18 years agoMarginally greater robustness in the face of solve_game() failing to
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6288 cda61777-01e9-0310-a592-d414129be87e

18 years agoCompletely rewrite the loop-detection algorithm used to check game
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6283 cda61777-01e9-0310-a592-d414129be87e

18 years agoPatch from James H which initialises a couple of Windows API object
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6282 cda61777-01e9-0310-a592-d414129be87e

18 years agoI arranged that dying after the game was already completed didn't
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6277 cda61777-01e9-0310-a592-d414129be87e

18 years agoTake the Windows taskbar into account when deciding on the maximum
simon [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*

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6276 cda61777-01e9-0310-a592-d414129be87e

18 years agoVarious patches from Ben H: a fix for an outdated comment, a couple
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6275 cda61777-01e9-0310-a592-d414129be87e

18 years agoI've dithered a bit in the past about whether or not it's allowable
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6274 cda61777-01e9-0310-a592-d414129be87e

18 years agoPatch from Ton van Overbeek to fix a small memory leak in
simon [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().

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6271 cda61777-01e9-0310-a592-d414129be87e

18 years agoPatch from Ton van Overbeek to correct Loopy's misplaced line ends
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6270 cda61777-01e9-0310-a592-d414129be87e

18 years agoAnother global environment-variable override across all games. This
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6269 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6268 cda61777-01e9-0310-a592-d414129be87e

18 years agoPatches from James H. The usual stuff (memory leak fixes and 16-bit
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6265 cda61777-01e9-0310-a592-d414129be87e

18 years agoSomeone points out that the Solo text formatter would be a lot
simon [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 :-)

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6261 cda61777-01e9-0310-a592-d414129be87e

18 years agoStop Light Up from eating system keypresses, which it was previously
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6258 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6257 cda61777-01e9-0310-a592-d414129be87e

18 years agoPalm fixes for Loopy from James H: a #ifdef SLOW_SYSTEM, and an
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6256 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6255 cda61777-01e9-0310-a592-d414129be87e

18 years agoJames H has implemented a new `Tricky' difficulty level in Light Up:
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6254 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6250 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6248 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6247 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6245 cda61777-01e9-0310-a592-d414129be87e

18 years agoNow that Map has some seriously complex deductions, it's about time
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6244 cda61777-01e9-0310-a592-d414129be87e

18 years agoForcing chains in Map give rise to a new `Hard' difficulty level.
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6240 cda61777-01e9-0310-a592-d414129be87e

18 years agoImplemented a couple more reasoning modes for Extreme difficulty
simon [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...

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6239 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6237 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6236 cda61777-01e9-0310-a592-d414129be87e

18 years agoAhem. The region density at which things start to get hairy is 2/3
simon [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!

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6235 cda61777-01e9-0310-a592-d414129be87e

18 years agoAesthetic improvements to the Map error indicators:
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6234 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6229 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6228 cda61777-01e9-0310-a592-d414129be87e

18 years agoThere seems to be some odd behaviour when GTK is asked to draw an
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6227 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6226 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6225 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6223 cda61777-01e9-0310-a592-d414129be87e

18 years agoNew puzzle: `Inertia', originally written for Windows by Ben
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6222 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6220 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6219 cda61777-01e9-0310-a592-d414129be87e

18 years agoPhil Bordelon points out that the general convention is to orient
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6217 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6216 cda61777-01e9-0310-a592-d414129be87e

18 years agoOver-enthusiastic assertion introduced in the printing revamp was
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6214 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6212 cda61777-01e9-0310-a592-d414129be87e

18 years agoNew puzzle: `Loopy', an implementation of Nikoli's `Slither Link' or
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6211 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6210 cda61777-01e9-0310-a592-d414129be87e

18 years agoBrand new difficulty level in Solo. The other day Gareth and I
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6209 cda61777-01e9-0310-a592-d414129be87e

18 years agoDon't report an error when loading a saved game from the command
simon [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!

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6203 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6202 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6199 cda61777-01e9-0310-a592-d414129be87e

18 years ago`Solve' operation on an already solved map without an aux_info was
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6198 cda61777-01e9-0310-a592-d414129be87e

18 years ago*blinks* I apparently didn't try _building_ the OS X port since the
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6197 cda61777-01e9-0310-a592-d414129be87e

18 years agoRetire redundant print_line_width() in Net: a relic from a failed
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6194 cda61777-01e9-0310-a592-d414129be87e

18 years agoNative Windows printing support, using the infrastructure I put in
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6193 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6192 cda61777-01e9-0310-a592-d414129be87e

18 years agoBah, there's always one. Remove the now-erroneous `*.py' from the
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6191 cda61777-01e9-0310-a592-d414129be87e

18 years agoSubstantial infrastructure upheaval. I've separated the drawing API
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6190 cda61777-01e9-0310-a592-d414129be87e

18 years agoJust noticed another thing that could easily catch me out when
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6189 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6188 cda61777-01e9-0310-a592-d414129be87e

18 years agoNew puzzle: `Map'. Vaguely original, for a change.
simon [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.)

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6186 cda61777-01e9-0310-a592-d414129be87e

18 years agoOops. Back out a local change I shouldn't have committed in r6184.
simon [Thu, 11 Aug 2005 11:06:59 +0000 (11:06 +0000)]
Oops. Back out a local change I shouldn't have committed in r6184.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6185 cda61777-01e9-0310-a592-d414129be87e

18 years ago16-bit-cleanness fixes from James H (again). It would be really nice
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6184 cda61777-01e9-0310-a592-d414129be87e

18 years agoVery fiddly corrections to the loop highlighting. ERRSLASH means the
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6175 cda61777-01e9-0310-a592-d414129be87e

18 years agoImplement error checking in Slant. Clue points are now highlighted
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6174 cda61777-01e9-0310-a592-d414129be87e

18 years agoRemove conditional definition of MAX_GRIDGEN_TRIES, for consistency
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6172 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6171 cda61777-01e9-0310-a592-d414129be87e

18 years agoStreamline `slantsolver' a bit (avoid showing advanced working on
simon [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).

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6170 cda61777-01e9-0310-a592-d414129be87e

18 years agoDocument hard mode in Slant, and also fix an obvious memory
simon [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().

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6169 cda61777-01e9-0310-a592-d414129be87e

18 years agoIntroduce an environment variable setting (SLANT_SWAP_BUTTONS=yes)
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6168 cda61777-01e9-0310-a592-d414129be87e

18 years agoA bunch of new reasoning techniques in the Slant solver, leading to
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6167 cda61777-01e9-0310-a592-d414129be87e

18 years agoCleanups to completion flashes: all four of these games used to
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6166 cda61777-01e9-0310-a592-d414129be87e

18 years agoNew puzzle: `Light Up', by James H.
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6164 cda61777-01e9-0310-a592-d414129be87e

18 years agoEnvironment-based configuration wasn't sensibly usable in games with
simon [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.)

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6163 cda61777-01e9-0310-a592-d414129be87e

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

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6162 cda61777-01e9-0310-a592-d414129be87e

18 years agoBug fix from James H: solve_game() was returning error messages in
simon [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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6161 cda61777-01e9-0310-a592-d414129be87e

18 years agoI am COMPLETELY GORMLESS. The Solo grid generator, when eliminating
simon [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!

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6160 cda61777-01e9-0310-a592-d414129be87e

18 years agoCleanups from James H: a few missing statics, a precautionary cast
simon [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().

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6159 cda61777-01e9-0310-a592-d414129be87e