1003 Commits

Author SHA1 Message Date
0880ef0583 Oops, forgot to initialise changed_ascii on all paths in r9657.
[originally from svn r9658]
[r9657 == 3b250baa02a7332510685948bf17576c397b8ceb]
2012-09-09 21:55:14 +00:00
3b250baa02 New rule: interpret_move() is passed a pointer to the game_drawstate
basically just so that it can divide mouse coordinates by the tile
size, but is definitely not expected to _write_ to it, and it hadn't
previously occurred to me that anyone might try. Therefore,
interpret_move() now gets a pointer to a _const_ game_drawstate
instead of a writable one.

All existing puzzles cope fine with this API change (as long as the
new const qualifier is also added to a couple of subfunctions to which
interpret_move delegates work), except for the just-committed Undead,
which somehow had ds->ascii and ui->ascii the wrong way round but is
otherwise unproblematic.

[originally from svn r9657]
2012-09-09 18:40:12 +00:00
55748a60cb Minor tweaks to Undead docs.
[originally from svn r9656]
2012-09-09 11:50:05 +00:00
67ddba7a15 New puzzle! Contributed by Steffen Bauer, an implementation of
'Haunted Mirror Maze', a game involving placing ghosts, zombies and
vampires in a grid so that the right numbers of them are visible along
sight-lines reflected through multiple mirrors.

[originally from svn r9652]
2012-09-08 10:48:05 +00:00
15a4fbd1cd For the convenience of Linux package maintainers, add to Makefile.gtk
and Makefile.doc a command-line parameter 'BINPREFIX' which will be
prepended to all the game binary names. E.g. 'make BINPREFIX=sgt-' and
'make BINPREFIX=sgt- install', and correspondingly 'make -f
Makefile.doc BINPREFIX=sgt-'.

Also included in this commit by mistake, changes to singles.c to add
\n to the end of all its debug() statements. I meant to commit that
separately. Oops.

[originally from svn r9606]
2012-08-17 19:58:53 +00:00
200d6533bb Fix implicit split to @_. Also add 'use warnings', which would have
spotted it for me.

[originally from svn r9605]
2012-08-17 19:45:03 +00:00
bbf800e49e Don't fail an assertion when setting up the provided clues at the
start of the solver, if they contradict each other. (Could trigger on
user-provided grids.)

[originally from svn r9594]
2012-07-29 21:29:26 +00:00
6567260eb0 Vary the behaviour of Mines's solve function depending on whether the
user is already in the 'dead' state when they press it. If so, we
reveal the rest of the mines in the grid as if it were the Windows
Minesweeper 'you lose' display, which provides information showing
what the user got wrong. (Otherwise they have to repeatedly flick back
and forth between Solve and Undo if they want to work out which flag
they placed wrongly.)

If you press Solve while alive, however, the existing behaviour
remains unchanged.

(This feature was suggested by Clive Jones a couple of weeks after I
first wrote Mines, and I've finally got round to doing it!)

[originally from svn r9561]
2012-06-10 07:20:18 +00:00
48e9767a20 Fix a bug introduced by r9495 in which we try to write temporary NULs
into a string which is usually a read-only string literal. Instead,
copy each segment into writable memory as we need it, and free it
afterwards.

[originally from svn r9558]
[r9495 == d0ff371b144d4bfe3cbfb062388347c08e431393]
2012-06-06 17:59:37 +00:00
5a095b8a08 Add a hacky environment variable that lets me arrange a soak-test of a
solver I've just modified, by forcing every game generation to be
instantly followed by an attempt to re-solve the same game
_description_ without the aux_info.

I've hacked similar changes in to midend.c several times in the last
couple of months for one reason or another, and it's about time I
arranged not to have to recompile to do it!

[originally from svn r9549]
2012-06-01 18:41:26 +00:00
a46f06e90e Remove the speed optimisation in the stage 3 solver which makes the
first loop only handle rightward or downward bridges (on the basis
that that way every bridge is looked at once rather than twice). This
seems to be breaking in the wake of recent changes to the solver, in
cases such as when island A is left of island B and has enough other
outgoing edges that only one bridge remains to potentially go to B,
but B is as yet unconstrained. In this situation the only code which
is able to adjust the maximum bridge count for that edge is the stage
3 solver (nothing else calls solve_join with is_max true), but it will
only do so if it _tries_ putting two bridges there and finds it
impossible, and when it starts from island A it won't even try.

Game ID which was insoluble just before this commit:
15x15m2:2a4d3b3c2h2d2a2a3c3w4a3m1d1a4a5a2d4d6e4q3e6a2a1e1b2g3a3o2g1d32l4b2c3a4c2b22l4a

This probably means I've done something else in recent checkins which
was not in accordance with the original solver design. However, this
fix will do for the moment.

[originally from svn r9548]
2012-06-01 18:41:24 +00:00
9f87d6fda5 Another uninitialised-variable fix, this one pointing out a real bug.
Simplest fix is to just remove the 'n' parameter from
solve_island_subgroup, replacing it with a robust island_countbridges.

[originally from svn r9547]
2012-06-01 18:41:23 +00:00
d7febe24f9 Add pointless initialisations to placate a gcc warning.
(I'm confident these can't happen. maxb is initialised whenever we
break from the first loop with y < h, and when we don't break from
that loop the second loop which uses maxb is run zero times. But gcc
can't work that out, sigh.)

[originally from svn r9546]
2012-06-01 18:41:23 +00:00
3ddf5cc2d0 Write a comment outlining a design for a rewritten faster solver.
[originally from svn r9544]
2012-05-31 18:10:12 +00:00
9d2f61dcfa Bridges solver enhancement. In the stage 3 solver, we were considering
the possibility that an island might form an isolated subgraph by
connecting to one of its neighbours (and, if so, reducing the maximum
bridge count in that direction so that some bridge would have to go
elsewhere), but we were not also considering the possibility that it
might form an isolated subgraph by connecting to _more_ than one of
its neighbours. For instance, if you have a 3 adjacent to a 1, a 2 and
something else, then at least one bridge must go to the something-else.

Previously insoluble test case:
10x10m2:a2b4a5a2a2a1ga2d3b33a3a4c2aa3e1a22b2a4b4aa3b1a2b33a1e3aa2a1a2c23a3a3a4a2a

[originally from svn r9543]
2012-05-31 18:10:11 +00:00
00f74d4c7d Bridges solver fix: in map_update_possibles, collect values from
maxh/maxv for squares between islands as well as on islands.

[originally from svn r9542]
2012-05-31 18:10:10 +00:00
12cd1ee235 Patch from Jonas Koelker to improve Filling's error highlighting: as
well as marking a region as wrong if it has too many squares for the
number written in it, this patch now causes a region to be marked
wrong if it has too few squares _and no liberties_, so that it can't
just be one the user is intending to enlarge later.

[originally from svn r9534]
2012-05-14 18:42:19 +00:00
1e71966e75 Patch from Jonas Koelker for the developer docs, fixing a couple of
editing errors and adding some comments about the necessary order of
midend operations called by a front end.

[originally from svn r9533]
2012-05-14 18:42:18 +00:00
cab65638b5 GNUstep compatibility: ensure both endpoints are actually drawn by
draw_line, by the brute-force method of explicitly plotting them in
addition to the GUI's line-drawing operation.

[originally from svn r9505]
2012-05-06 14:01:39 +00:00
eae4059d3d GNUstep compatibility: add a missing #include.
[originally from svn r9504]
2012-05-06 14:01:38 +00:00
d58fc30444 GNUstep compatibility: avoid attempting blitter_save with a partially
out-of-bounds rectangle. Instead, take the intersection of the
rectangle with the window boundary and do a smaller operation on
what's left.

[originally from svn r9503]
2012-05-06 14:01:36 +00:00
cdd53f182d GNUstep compatibility: stop using the API feature isFlipped/setFlipped
to translate y-coordinates from the default of up-from-bottom to the
down-from-top expected by these puzzles, because it doesn't work right
on GNUstep. Instead, we run the API in its default mode (probably a
more robust choice anyway) and translate coordinates manually in the
front end.

In the process, I've separated the processButton: method into one for
mouse buttons and one for keys, since that was the easiest way to
ensure the coordinates passed to the mid-end for the latter are -1,-1
_after_ translation rather than before.

[originally from svn r9502]
2012-05-06 14:01:35 +00:00
9d3c8fbde0 GNUstep compatibility: remove an unused variable which the compiler
warned about.

[originally from svn r9501]
2012-05-06 14:01:35 +00:00
3fbb23e354 GNUstep compatibility: comment out some API calls that GNUstep
apparently doesn't have. Fortunately they were optional anyway.

[originally from svn r9500]
2012-05-06 14:01:34 +00:00
41dc4a2195 GNUstep compatibility: spell null selectors "NULL", not "nil".
[originally from svn r9499]
2012-05-06 14:01:32 +00:00
22ebad30e4 Add a section to mkfiles.pl to build a makefile that compiles the OS X
front end using GNUstep, yielding a Unix program built from the same
code. Should make it easier to check OS X behaviour without having to
move as far as a Mac :-) However, it doesn't compile as is, so I'll
apply fixes to the code until it does.

[originally from svn r9498]
2012-05-06 14:01:32 +00:00
d0ff371b14 Stop using the deprecated NSString stringWithCString: methods.
[originally from svn r9495]
2012-05-06 11:36:32 +00:00
14da5088e8 Update the OS X makefile so I can build on Lion. Regrettably that
means I have to withdraw support for OS X 10.3 and PPC.

[originally from svn r9494]
2012-05-06 11:35:59 +00:00
8b96f9b996 Permit users to reconfigure the default setting for each puzzle using
another of those hacky environment variables.

[originally from svn r9455]
2012-04-10 19:51:57 +00:00
ec732a4f4e Add a difficulty exception to prevent Pearl spinning forever when
asked to generate a 5x5 Tricky puzzle. (Debian bug #667963)

[originally from svn r9454]
2012-04-08 13:45:10 +00:00
b40b89f879 Typo fix from Helge Kreutzmann, forwarded from Debian.
[originally from svn r9453]
2012-04-08 13:45:09 +00:00
812800a8b2 Increase by 1 pixel the clip rectangle used to draw and erase the
Black Box finish button. Like the Guess blitter, it was assuming
non-expansion of circles.

[originally from svn r9452]
2012-04-08 13:06:47 +00:00
b4f3b57aa1 Swap a 'max' for a 'min', fixing an out-of-range colour component
being passed to the front end.

[originally from svn r9451]
2012-04-08 13:06:46 +00:00
48fef05eb6 Increase by 1 in every direction the size of the blitter used to save
the background under a Guess coloured peg in mid-drag. Currently it
assumes the circle doesn't extend into the next pixel, which the docs
for draw_circle warn might happen due to antialiasing.

[originally from svn r9450]
2012-04-08 13:06:45 +00:00
51d1f0f856 Add an explicit -lm to the link lines in Makefile.gtk, after two users
reported on the same day that this is now necessary since up-to-date
GNU tools won't consider it sufficient to have libm be a dependency of
other explicitly referenced libraries if you're directly referring to
the contents of libm yourself.

[originally from svn r9448]
2012-04-07 22:28:59 +00:00
4f81608c40 Fix redundant redrawing in Pegs. Apparently it has always redrawn
every single peg and hole on the board, every time it did any kind of
redraw at all, because I forgot to update the array in the drawstate
indicating the last-drawn state of each position. And nobody's noticed
until now!

[originally from svn r9447]
2012-04-07 22:19:18 +00:00
e3f9741317 Change some instances of 'print $thing' to 'print $thing || ""', to
prevent annoying Perl warnings when $thing is undefined.

[originally from svn r9446]
2012-04-07 22:19:17 +00:00
704890390d Error checking in Pattern, which was until now the only remaining game
that _ought_ to have it but did not.

I've tried to implement it before and found that the most obvious
approach was so effective as to constitute a spoiler, so this is a
deliberately weakened approach which in a bit of play-testing seems to
be a more sensible balance. It won't necessarily tell you at the very
instant you put a foot wrong, but it will at least ensure that (my
usual minimum standard) once you've filled in the whole grid you will
either have seen a victory flash, or an error indicator showing you
why not.

[originally from svn r9445]
2012-04-06 12:34:34 +00:00
88accd3ea5 Comment the Mac build out of Buildscr, since I no longer have a
working Mac and hence can't build it any more.

[originally from svn r9442]
2012-04-03 12:49:22 +00:00
faabfe3b62 Patch from Jonas Koelker to add keyboard control support to Pearl.
[originally from svn r9411]
2012-02-19 10:15:59 +00:00
f38adf6394 Tweak a conditional expression in pearl.c to work around a display bug
in the Java build - which turns out to be a JVM bug in OpenJDK 6,
causing the NestedVM rendition of the expression (i==1?3:4) to be
mis-JITed. OpenJDK 7 appears not to do that any more, but this
equivalent (for these purposes) rephrasing should perturb the code
just enough to dodge the problem.

[originally from svn r9408]
2012-02-17 19:07:31 +00:00
21629d7e44 Fix one-character typo in r9405 which was breaking right-clicks.
[originally from svn r9406]
[r9405 == 0c13787c2a17adc891f8e47c06b259f80bc8251a]
2012-02-13 21:10:47 +00:00
0c13787c2a David Nickerson reports odd behaviour involving a drag start point
persisting between separate mouse actions. Revamp all uses of the
ndragcoords field in an attempt to stamp that out: we now distinguish
between active drags (>0), a valid click but no drag yet (0), and a
totally invalid situation in which all mouse activity will be ignored
until the next fresh attempt (-1).

[originally from svn r9405]
2012-02-08 23:31:58 +00:00
bd20565c94 Correct kdiff setting.
[originally from svn r9403]
2012-02-02 23:04:46 +00:00
e6b4800d86 Don't try to run solver_killer_sums on a Killer cage with only one
square. It isn't equipped for it, and will try to handle it with the
4-square case and get confused. This can come up if the
DIFF_KINTERSECT pass before that split a cage, and will cause the
solver to miss valid solutions; e.g. 3x3kadu#802065940985372 would
generate an ambiguous puzzle before this change.

[originally from svn r9402]
2012-02-02 23:04:43 +00:00
e3b21ef6c5 Fix a couple of typos in messages.
[originally from svn r9401]
2012-02-02 23:04:38 +00:00
340c300c1d David Nickerson reports that it's possible to lay a line over a 'no
line here' cross mark by dragging, and furthermore, that doing so puts
that grid edge into a stuck state that no UI action short of undo can
get it back out of. Fix drags to stop at crosses, and fix execute_move
to fault any move string that nonetheless somehow managed to try to
set a line over a cross without explicitly tagging it 'R'.

[originally from svn r9400]
2012-02-02 07:18:14 +00:00
ed63f9c50e Sort out a bit of confusion between mouse- and keyboard-driven drags
in Rectangles. Mouse drags now take priority - you can't start a
keyboard drag while the mouse is held down, and starting a mouse drag
instantly cancels an unfinished keyboard drag - and also I've fixed an
assertion failure which would come up if you had the keyboard cursor
visible at the end of a mouse drag (by pressing arrow keys while the
mouse was held down).

[originally from svn r9393]
2012-01-31 08:38:42 +00:00
f3168895c8 Move a debug statement at the end of new_clues from the caller (just
after return) to the callee (just before). Might print something
useful in the soak-test context (where that debug statement will now
be printed and previously wasn't), but the main aim is to remove the
variable 'ngen' at the main call site, which triggered a set-but-not-
used warning if the debug statement that printed it was compiled out.

[originally from svn r9392]
2012-01-31 08:32:26 +00:00
070327a440 Add comments suggesting some solver upgrades to Light Up (perhaps for
a new sub-recursive difficulty level?), inspired by a user emailing in
the game ID
18x10:gBc1b2g2e2d1b2c2h2e3c2dBd1g1bBb2b1fBbBb1bBgBd2dBi1h1c2b1dBe2bBdBb3cBg
which I was able to solve without backtracking by the use of these
techniques.

[originally from svn r9388]
2012-01-23 19:12:12 +00:00