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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
simon [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.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6158
cda61777-01e9-0310-a592-
d414129be87e
simon [Tue, 2 Aug 2005 23:24:03 +0000 (23:24 +0000)]
Bah! There's _always_ one. Display glitch corrected.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6156
cda61777-01e9-0310-a592-
d414129be87e
simon [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.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6155
cda61777-01e9-0310-a592-
d414129be87e
simon [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.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6153
cda61777-01e9-0310-a592-
d414129be87e
simon [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.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6152
cda61777-01e9-0310-a592-
d414129be87e
jacob [Fri, 29 Jul 2005 23:05:10 +0000 (23:05 +0000)]
missing `i' in `\e'
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6151
cda61777-01e9-0310-a592-
d414129be87e
simon [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.)
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6150
cda61777-01e9-0310-a592-
d414129be87e
simon [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.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6149
cda61777-01e9-0310-a592-
d414129be87e
simon [Fri, 29 Jul 2005 11:34:02 +0000 (11:34 +0000)]
Ben Hutchings reports that gcc 4 gives an optimiser warning because
it can't tell that one branch of a particular switch is always
taken. Adding a default clause with an automatic assertion failure
apparently fixes it.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6148
cda61777-01e9-0310-a592-
d414129be87e
simon [Fri, 29 Jul 2005 11:24:55 +0000 (11:24 +0000)]
Patches from Ben Hutchings to fix failures of sscanf error checking.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6147
cda61777-01e9-0310-a592-
d414129be87e
jacob [Fri, 29 Jul 2005 08:20:40 +0000 (08:20 +0000)]
Tweak a paragraph after discussion with Simon.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6144
cda61777-01e9-0310-a592-
d414129be87e
simon [Thu, 28 Jul 2005 17:12:18 +0000 (17:12 +0000)]
Shiny new developer documentation to replace the old sketchy HACKING
guide.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6142
cda61777-01e9-0310-a592-
d414129be87e
simon [Sun, 24 Jul 2005 10:39:33 +0000 (10:39 +0000)]
The very core of cross() is capable of suffering integer overflow on
large puzzles. Resort to hand-hacked 64-bit arithmetic for doing dot
products; everything else remains in `long' for the moment.
(Ideally I'd auto-detect the presence of `long long' and use it in
place of my cheap plastic imitation where possible, but since I
currently don't have a configure mechanism that'll have to wait.)
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6137
cda61777-01e9-0310-a592-
d414129be87e
simon [Sun, 24 Jul 2005 10:09:04 +0000 (10:09 +0000)]
Another diagnostic mode for Untangle: if compiled with
`-DSHOW_CROSSINGS', it will show each edge in red if it is crossed
by anything, and in black otherwise. Distracting and not
particularly useful during play, but occasionally handy for
debugging cross().
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6136
cda61777-01e9-0310-a592-
d414129be87e
simon [Sun, 24 Jul 2005 10:05:11 +0000 (10:05 +0000)]
(GTK only so far) Allow the argument passed to a game binary to be
either a game ID or a save file name. (The former takes priority,
because you can usually find a synonym for the latter, such as by
prepending `./' or `$PWD/'.)
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6135
cda61777-01e9-0310-a592-
d414129be87e
simon [Fri, 22 Jul 2005 12:07:56 +0000 (12:07 +0000)]
Solve animation (currently only in Untangle) was failing to set
me->anim_pos to zero, meaning that if it happened immediately after
a completion flash then anim_pos would start off half way through
its run.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6127
cda61777-01e9-0310-a592-
d414129be87e
simon [Fri, 22 Jul 2005 11:55:50 +0000 (11:55 +0000)]
The `Solve' operation now rotates and/or reflects the solution grid
to bring it as close as possible to the current game state. This
means that if you request `Solve' after solving a puzzle yourself,
with the intention of finding out how similar your solution is to
the program's, then you will mostly see the differences in _shape_
rather than those being masked by the fact that yours happened to be
the other way up.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6126
cda61777-01e9-0310-a592-
d414129be87e