chiark / gitweb /
sgt-puzzles.git
11 years agoTry to give a more friendly message if anything goes wrong during
Simon Tatham [Wed, 3 Apr 2013 19:04:00 +0000 (19:04 +0000)]
Try to give a more friendly message if anything goes wrong during
puzzle startup. The puzzle web pages now enclose the whole puzzle
(buttons, canvas, permalinks) in a div set to display:none, and
instead display an apologetic message saying 'sorry, it didn't work';
then, if we get through the whole init function without crashing, we
show the puzzle and hide the apology.

[originally from svn r9802]

11 years agoFix a grammatical confusion on the Unruly web page.
Simon Tatham [Tue, 2 Apr 2013 10:58:52 +0000 (10:58 +0000)]
Fix a grammatical confusion on the Unruly web page.

[originally from svn r9801]

11 years agoRewrite trim_rect() for robustness.
Simon Tatham [Mon, 1 Apr 2013 16:23:03 +0000 (16:23 +0000)]
Rewrite trim_rect() for robustness.

The previous version dealt adequately with rectangles _partially_
overlapping the edge of the canvas, but doesn't correctly handle a
rectangle that's completely out of bounds in one direction. Replace
with a complete rewrite which is more easily seen to be correct. Also,
while I'm at it, add a missing condition to draw_update() so that we
don't even bother calling the Javascript half of it on any rectangle
that's been trimmed into nonexistence.

[originally from svn r9800]

11 years agoGreg Hewgill points out a code path on which the angle parameter to
Simon Tatham [Mon, 1 Apr 2013 09:38:04 +0000 (09:38 +0000)]
Greg Hewgill points out a code path on which the angle parameter to
the Penrose grid generation function can fail to be initialised.

[originally from svn r9798]

11 years agoFix the icon makefile in the wake of r9795.
Simon Tatham [Sun, 31 Mar 2013 22:06:07 +0000 (22:06 +0000)]
Fix the icon makefile in the wake of r9795.

[originally from svn r9797]
[r9795 == 3fc5a644a72e747b1f88125b38b2f178a9bc7ed3]

11 years agoA UI suggestion from Ben: label the Custom element in the dropdown
Simon Tatham [Sun, 31 Mar 2013 18:36:03 +0000 (18:36 +0000)]
A UI suggestion from Ben: label the Custom element in the dropdown
with a trailing "..." to hint that it opens a further dialog box.
However, the _invisible_ Custom option is merely indicating what you
_do_ have selected, so we leave that one as it is. (So now they're no
longer exact twins of each other, of course.)

[originally from svn r9796]

11 years agoUndead was not ever actually draw_update()ing to the edges of its
Simon Tatham [Sun, 31 Mar 2013 18:25:25 +0000 (18:25 +0000)]
Undead was not ever actually draw_update()ing to the edges of its
rectangle, which showed up on the Javascript front end since the JS
canvas doesn't start out defaulting to COL_BACKGROUND. Fixed it to
draw_update to the edge of its area, and while I'm at it, narrowed the
border (since this proves we didn't really need that much space
anyway).

[originally from svn r9795]

11 years agoMake sure the right element of the game-type dropdown starts off
Simon Tatham [Sun, 31 Mar 2013 11:50:46 +0000 (11:50 +0000)]
Make sure the right element of the game-type dropdown starts off
selected. Previously we were leaving the first element on the list
selected, which is _usually_ right, but not right for Slant.

In the process of doing this, I've also reorganised to fix a crash
which shows up with non-configurable games (admittedly currently only
Nullgame :-) when we still try to call js_select_preset in spite of
not having any preset options to select.

[originally from svn r9794]

11 years agoIntroduce a mechanism by which calls to midend_supersede_game_desc()
Simon Tatham [Sun, 31 Mar 2013 09:58:52 +0000 (09:58 +0000)]
Introduce a mechanism by which calls to midend_supersede_game_desc()
can trigger a call to a front end notification function. Use this to
update the game ID permalink when Mines supersedes its game ID.

[originally from svn r9793]

11 years agoReinstate a missing semicolon.
Simon Tatham [Sun, 31 Mar 2013 09:58:50 +0000 (09:58 +0000)]
Reinstate a missing semicolon.

[originally from svn r9792]

11 years agoOops. I consistently misspelled my desired lineCap and lineJoin values
Simon Tatham [Sun, 31 Mar 2013 09:58:48 +0000 (09:58 +0000)]
Oops. I consistently misspelled my desired lineCap and lineJoin values
as "1" rather than "round". Must have had my Postscript brain in,
and/or been confused by lineWidth = "1" just beforehand. This fixes a
display glitch in Towers, where there's a tiny spike at the top left
corner of each tower due to a very sharp mitred line join.

[originally from svn r9791]

11 years agoFix a crash when changing presets in Inertia. Turns out that my
Simon Tatham [Sun, 31 Mar 2013 09:58:47 +0000 (09:58 +0000)]
Fix a crash when changing presets in Inertia. Turns out that my
Javascript-side blitter creation function had forgotten to return the
new blitter's id, so the C code was still trying to use blitter #0
after it had been thrown away and replaced.

[originally from svn r9790]

11 years agoDon't forget to restore the correct selection in the dropdown list if
Simon Tatham [Sun, 31 Mar 2013 09:58:47 +0000 (09:58 +0000)]
Don't forget to restore the correct selection in the dropdown list if
the user cancels a configuration dialog.

[originally from svn r9789]

11 years agoApply a bodge to arrange that if the user selects Custom from the game
Simon Tatham [Sun, 31 Mar 2013 09:58:46 +0000 (09:58 +0000)]
Apply a bodge to arrange that if the user selects Custom from the game
type dropdown, we still get an 'onchange' event if they select it a
second time. Normally this wouldn't happen, because onchange means
what it says and we only get it if a _different_ element is selected.

My solution is to create two list items called Custom, set one of them
as display:none to stop it showing up when the list is dropped down,
and to select it after the configuration box closes.

[originally from svn r9788]

11 years agoStop using the dangerously unescaped 'innerHTML' for <option>
Simon Tatham [Sun, 31 Mar 2013 09:58:45 +0000 (09:58 +0000)]
Stop using the dangerously unescaped 'innerHTML' for <option>
contents; use document.createTextNode like I do everywhere else.

[originally from svn r9787]

11 years agoForgot to make the web-page-building scripts executable.
Simon Tatham [Sun, 31 Mar 2013 08:55:21 +0000 (08:55 +0000)]
Forgot to make the web-page-building scripts executable.

[originally from svn r9786]

11 years agoNew front end! To complement the webification of my puzzles via Java
Simon Tatham [Sat, 30 Mar 2013 20:16:21 +0000 (20:16 +0000)]
New front end! To complement the webification of my puzzles via Java
applets, here's an alternative webification in Javascript, using
Emscripten in asm.js mode (so that as browsers incorporate asm.js
optimisation, the game generation should run really fast).

[originally from svn r9781]

11 years agoIntroduce a mechanism in this source tree for building the container
Simon Tatham [Sat, 30 Mar 2013 20:04:10 +0000 (20:04 +0000)]
Introduce a mechanism in this source tree for building the container
web pages for the Java applets. Previously, those have all been
maintained by hand in my website's svn area, which is a bit silly. Now
we have a file per puzzle in the 'html' subdirectory which contains
the puzzle's name, one or two attributes, and the instructions snippet
to go below the puzzle applet; and then there's a Perl script that
builds all the real web pages out of that by adding in the parts
common across all files: the header, footer, and middle fragment with
the <applet> tag and resizing bits and pieces.

One piece _not_ checked in here is the footer text specific to my
hosting at chiark, which I think does still belong in the www area. So
Buildscr doesn't actually build the web pages; it just delivers the
bits and pieces by which my nightly snapshot script will be able to
run the program that _does_ build them, passing that footer as an
extra argument.

[originally from svn r9780]

11 years agoEdit the paragraph in the midend_deserialise() docs which I forgot to
Simon Tatham [Sat, 30 Mar 2013 18:03:15 +0000 (18:03 +0000)]
Edit the paragraph in the midend_deserialise() docs which I forgot to
fix in r9777 when I added documentation of the function it wistfully
imagined might one day exist.

[originally from svn r9779]
[r9777 == 1fdafb6abf2d3ea0d37e79b5dfd9daf8eed28f22]

11 years agoAdd a midend function to return the current random seed, parallel to
Simon Tatham [Sat, 30 Mar 2013 16:59:19 +0000 (16:59 +0000)]
Add a midend function to return the current random seed, parallel to
the existing one that returns the game id. No front end has so far
needed this, but one is about to.

[originally from svn r9778]

11 years agoAdd documentation for the identify_game() function which I introduced
Simon Tatham [Sat, 30 Mar 2013 16:59:18 +0000 (16:59 +0000)]
Add documentation for the identify_game() function which I introduced
in r9749 and forgot to write up.

[originally from svn r9777]
[r9749 == 6b6442b16c5de9f5f9479b736bf865a4236047cb]

11 years agoFound a bug in nullgame! Its vestigial game_redraw lacked a
Simon Tatham [Sat, 30 Mar 2013 16:59:17 +0000 (16:59 +0000)]
Found a bug in nullgame! Its vestigial game_redraw lacked a
draw_update, which isn't really setting a good example for people
cloning it :-) Add the missing draw_update call.

[originally from svn r9776]

11 years agoRemove a redundant and also erroneous memset.
Simon Tatham [Mon, 11 Mar 2013 19:58:28 +0000 (19:58 +0000)]
Remove a redundant and also erroneous memset.

(If you're going to memset a struct to 0 before filling in the fields
you care about, do use sizeof the struct rather than sizeof the
pointer; but also, if you're filling in _every_ field, there's no need
to bother anyway.)

[originally from svn r9773]

11 years agoClarify instructions for 'Range' -- I initially read the last point as
Jacob Nevins [Sun, 10 Mar 2013 13:56:12 +0000 (13:56 +0000)]
Clarify instructions for 'Range' -- I initially read the last point as
meaning the maximum white squares in any direction, rather than the total of
all directions.

[originally from svn r9771]

11 years agoMake Unruly's keyboard controls match the documentation and other puzzles in
Jacob Nevins [Sun, 10 Mar 2013 12:49:06 +0000 (12:49 +0000)]
Make Unruly's keyboard controls match the documentation and other puzzles in
the collection -- now Enter = black and Space = white.

[originally from svn r9770]

11 years agoFix entering pencil marks from the keyboard; the cursor is no longer removed
Jacob Nevins [Sun, 10 Mar 2013 12:28:13 +0000 (12:28 +0000)]
Fix entering pencil marks from the keyboard; the cursor is no longer removed
(this brings Undead into line with Solo, etc).

[originally from svn r9769]

11 years agoStop using CLUE2CHAR to translate clues into text; just do the obvious
Simon Tatham [Sun, 24 Feb 2013 12:52:17 +0000 (12:52 +0000)]
Stop using CLUE2CHAR to translate clues into text; just do the obvious
sprintf in both locations (screen and print) that need it. Fixes a bug
in which clues greater than 9 came out as hex digits in printed
puzzles.

[originally from svn r9765]

11 years agoStop the analysis pass in Loopy's redraw routine from being
Simon Tatham [Sat, 19 Jan 2013 18:56:07 +0000 (18:56 +0000)]
Stop the analysis pass in Loopy's redraw routine from being
conditionalised on !ds->started, so that we still do all the looping
over everything even if we know it's all going to be redrawn. This is
because deciding how much needs redrawing is not the only important
thing in those loops - they also set up arrays like ds->clue_error,
which tell the individual redraw functions _what_ to draw.

Fixes a bug in which, if you start a Loopy game and make moves causing
a clue to light up red for an error and then save your game, loading
the same save file at the start of a Loopy run would fail to highlight
the erroneous clue.

(This commit diff looks large, but actually it changes almost nothing
but whitespace.)

[originally from svn r9751]

11 years agoBring Pearl's game-completion handling in line with my usual practice:
Simon Tatham [Sat, 19 Jan 2013 18:56:06 +0000 (18:56 +0000)]
Bring Pearl's game-completion handling in line with my usual practice:
the 'completed' flag is not reset if you make a new move transforming
a solved game into an unsolved state, so the game won't flash again if
you manually erase and redraw a line segment (though it still will if
you undo and redo past the first solved state in the undo history).

[originally from svn r9750]

11 years agoRevamp of the Windows command-line parsing and puzzle-loading code.
Simon Tatham [Sat, 19 Jan 2013 18:56:05 +0000 (18:56 +0000)]
Revamp of the Windows command-line parsing and puzzle-loading code.

The Windows puzzles now accept similar command-line syntax to the GTK
ones, in that you can give them either a game ID (descriptive, random
or just plain params) or the name of a save file. Unlike the GTK ones,
however, the save file interpretation is tried first; this is because
some puzzles (e.g. Black Box) will interpret any old string as a valid
(if boring) game ID, and unlike the GTK puzzles it's not feasible to
require users to disambiguate via a command-line option, because on
Windows a thing that might easily happen is that a user passes a save
file to a puzzle binary via 'Open With' in the GUI shell, where they
don't get the chance to add extra options.

In order to make this work sensibly in the all-in-one Windows app, I
had to get round to another thing I've been planning to do for a
while, which is to write a function to examine a saved game file and
find out which puzzle it's for. So the combined Windows binary will
auto-switch to the right game if you pass a save file on its command
line, and also if you use Load while the program is running.

Another utility function I needed is one to split the WinMain single
command line string into argv. For this I've imported a copy of
split_into_argv() from Windows PuTTY (which doesn't affect this
package's list of copyright holders, since that function was all my
own code anyway).

[originally from svn r9749]

11 years agoPattern's display was broken for non-square puzzles, because
Simon Tatham [Wed, 9 Jan 2013 08:04:24 +0000 (08:04 +0000)]
Pattern's display was broken for non-square puzzles, because
draw_numbers() was considerably confused between the width of the clue
border at the left and the height of the clue border at the top.
Unconfuse it (I think).

[originally from svn r9737]

11 years agoActually do what the comment says at the top of main() regarding not
Simon Tatham [Fri, 28 Dec 2012 11:22:13 +0000 (11:22 +0000)]
Actually do what the comment says at the top of main() regarding not
bombing out due to an option that we don't recognise but GTK will.
Somehow my basically workable plan had been completely nullified by
putting the error check in the wrong place.

[originally from svn r9733]

11 years agoFix overnight build failure last night, by making the new call to
Simon Tatham [Wed, 21 Nov 2012 18:45:07 +0000 (18:45 +0000)]
Fix overnight build failure last night, by making the new call to
gtk_widget_get_allocation conditional on GTK being new enough to have
that function.

I'm assuming until someone proves otherwise that if it isn't that new,
then it also isn't one of the versions of GTK which exhibit the bug
which that call was working around (since gtk_widget_get_allocation
came in 2.18, and the problem seems to have arisen since 2.20).

[originally from svn r9712]

11 years agoWork around an annoying GTK behaviour I noticed the other day on my
Simon Tatham [Tue, 20 Nov 2012 20:05:27 +0000 (20:05 +0000)]
Work around an annoying GTK behaviour I noticed the other day on my
Ubuntu 12.04 machine. What seems to happen is that we set up a window
containing a menu bar, a drawing area and a status bar, and set the
size of the drawing area; then the window is displayed _without_ the
menu bar; then we reduce the drawing area's size request to (1,1) to
let the user resize the window smaller; and now GTK gets round to
constructing the menu bar, and the drawing area helpfully shrinks a
bit to make room for it.

My fix is to set a 'shrink pending' flag instead of shrinking the
drawing area's size request, and defer the actual shrink operation
until the menu bar and status bar are both present.

[originally from svn r9711]

11 years agoA user points out that I could usefully clarify the Undead clue
Simon Tatham [Sat, 3 Nov 2012 16:27:49 +0000 (16:27 +0000)]
A user points out that I could usefully clarify the Undead clue
semantics when a reflected sight-line crosses the same monster twice.

[originally from svn r9694]

11 years agoRemove an unused variable spotted by gcc 4.6.3.
Simon Tatham [Sun, 7 Oct 2012 15:41:44 +0000 (15:41 +0000)]
Remove an unused variable spotted by gcc 4.6.3.

[originally from svn r9682]

11 years agoNew puzzle! 'Unruly', contributed by Lennard Sprong, is an
Simon Tatham [Sun, 7 Oct 2012 10:18:33 +0000 (10:18 +0000)]
New puzzle! 'Unruly', contributed by Lennard Sprong, is an
implementation of a puzzle usually called 'Tohu wa Vohu'.

[originally from svn r9680]

11 years agoMake indentation consistent. (Somehow I forgot to do this before I
Simon Tatham [Mon, 10 Sep 2012 18:24:34 +0000 (18:24 +0000)]
Make indentation consistent. (Somehow I forgot to do this before I
originally committed the puzzle, as I usually do.)

[originally from svn r9660]

11 years agoForgot to add the new 'const' in the unfinished subdirectory. Oops.
Simon Tatham [Mon, 10 Sep 2012 18:05:54 +0000 (18:05 +0000)]
Forgot to add the new 'const' in the unfinished subdirectory. Oops.

[originally from svn r9659]

11 years agoOops, forgot to initialise changed_ascii on all paths in r9657.
Simon Tatham [Sun, 9 Sep 2012 21:55:14 +0000 (21:55 +0000)]
Oops, forgot to initialise changed_ascii on all paths in r9657.

[originally from svn r9658]
[r9657 == 3b250baa02a7332510685948bf17576c397b8ceb]

11 years agoNew rule: interpret_move() is passed a pointer to the game_drawstate
Simon Tatham [Sun, 9 Sep 2012 18:40:12 +0000 (18:40 +0000)]
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]

11 years agoMinor tweaks to Undead docs.
Jacob Nevins [Sun, 9 Sep 2012 11:50:05 +0000 (11:50 +0000)]
Minor tweaks to Undead docs.

[originally from svn r9656]

11 years agoNew puzzle! Contributed by Steffen Bauer, an implementation of
Simon Tatham [Sat, 8 Sep 2012 10:48:05 +0000 (10:48 +0000)]
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]

11 years agoFor the convenience of Linux package maintainers, add to Makefile.gtk
Simon Tatham [Fri, 17 Aug 2012 19:58:53 +0000 (19:58 +0000)]
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]

11 years agoFix implicit split to @_. Also add 'use warnings', which would have
Simon Tatham [Fri, 17 Aug 2012 19:45:03 +0000 (19:45 +0000)]
Fix implicit split to @_. Also add 'use warnings', which would have
spotted it for me.

[originally from svn r9605]

11 years agoDon't fail an assertion when setting up the provided clues at the
Simon Tatham [Sun, 29 Jul 2012 21:29:26 +0000 (21:29 +0000)]
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]

11 years agoVary the behaviour of Mines's solve function depending on whether the
Simon Tatham [Sun, 10 Jun 2012 07:20:18 +0000 (07:20 +0000)]
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]

11 years agoFix a bug introduced by r9495 in which we try to write temporary NULs
Simon Tatham [Wed, 6 Jun 2012 17:59:37 +0000 (17:59 +0000)]
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]

11 years agoAdd a hacky environment variable that lets me arrange a soak-test of a
Simon Tatham [Fri, 1 Jun 2012 18:41:26 +0000 (18:41 +0000)]
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]

11 years agoRemove the speed optimisation in the stage 3 solver which makes the
Simon Tatham [Fri, 1 Jun 2012 18:41:24 +0000 (18:41 +0000)]
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]

11 years agoAnother uninitialised-variable fix, this one pointing out a real bug.
Simon Tatham [Fri, 1 Jun 2012 18:41:23 +0000 (18:41 +0000)]
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]

11 years agoAdd pointless initialisations to placate a gcc warning.
Simon Tatham [Fri, 1 Jun 2012 18:41:23 +0000 (18:41 +0000)]
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]

11 years agoWrite a comment outlining a design for a rewritten faster solver.
Simon Tatham [Thu, 31 May 2012 18:10:12 +0000 (18:10 +0000)]
Write a comment outlining a design for a rewritten faster solver.

[originally from svn r9544]

11 years agoBridges solver enhancement. In the stage 3 solver, we were considering
Simon Tatham [Thu, 31 May 2012 18:10:11 +0000 (18:10 +0000)]
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]

11 years agoBridges solver fix: in map_update_possibles, collect values from
Simon Tatham [Thu, 31 May 2012 18:10:10 +0000 (18:10 +0000)]
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]

12 years agoPatch from Jonas Koelker to improve Filling's error highlighting: as
Simon Tatham [Mon, 14 May 2012 18:42:19 +0000 (18:42 +0000)]
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]

12 years agoPatch from Jonas Koelker for the developer docs, fixing a couple of
Simon Tatham [Mon, 14 May 2012 18:42:18 +0000 (18:42 +0000)]
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]

12 years agoGNUstep compatibility: ensure both endpoints are actually drawn by
Simon Tatham [Sun, 6 May 2012 14:01:39 +0000 (14:01 +0000)]
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]

12 years agoGNUstep compatibility: add a missing #include.
Simon Tatham [Sun, 6 May 2012 14:01:38 +0000 (14:01 +0000)]
GNUstep compatibility: add a missing #include.

[originally from svn r9504]

12 years agoGNUstep compatibility: avoid attempting blitter_save with a partially
Simon Tatham [Sun, 6 May 2012 14:01:36 +0000 (14:01 +0000)]
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]

12 years agoGNUstep compatibility: stop using the API feature isFlipped/setFlipped
Simon Tatham [Sun, 6 May 2012 14:01:35 +0000 (14:01 +0000)]
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]

12 years agoGNUstep compatibility: remove an unused variable which the compiler
Simon Tatham [Sun, 6 May 2012 14:01:35 +0000 (14:01 +0000)]
GNUstep compatibility: remove an unused variable which the compiler
warned about.

[originally from svn r9501]

12 years agoGNUstep compatibility: comment out some API calls that GNUstep
Simon Tatham [Sun, 6 May 2012 14:01:34 +0000 (14:01 +0000)]
GNUstep compatibility: comment out some API calls that GNUstep
apparently doesn't have. Fortunately they were optional anyway.

[originally from svn r9500]

12 years agoGNUstep compatibility: spell null selectors "NULL", not "nil".
Simon Tatham [Sun, 6 May 2012 14:01:32 +0000 (14:01 +0000)]
GNUstep compatibility: spell null selectors "NULL", not "nil".

[originally from svn r9499]

12 years agoAdd a section to mkfiles.pl to build a makefile that compiles the OS X
Simon Tatham [Sun, 6 May 2012 14:01:32 +0000 (14:01 +0000)]
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]

12 years agoStop using the deprecated NSString stringWithCString: methods.
Simon Tatham [Sun, 6 May 2012 11:36:32 +0000 (11:36 +0000)]
Stop using the deprecated NSString stringWithCString: methods.

[originally from svn r9495]

12 years agoUpdate the OS X makefile so I can build on Lion. Regrettably that
Simon Tatham [Sun, 6 May 2012 11:35:59 +0000 (11:35 +0000)]
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]

12 years agoPermit users to reconfigure the default setting for each puzzle using
Simon Tatham [Tue, 10 Apr 2012 19:51:57 +0000 (19:51 +0000)]
Permit users to reconfigure the default setting for each puzzle using
another of those hacky environment variables.

[originally from svn r9455]

12 years agoAdd a difficulty exception to prevent Pearl spinning forever when
Simon Tatham [Sun, 8 Apr 2012 13:45:10 +0000 (13:45 +0000)]
Add a difficulty exception to prevent Pearl spinning forever when
asked to generate a 5x5 Tricky puzzle. (Debian bug #667963)

[originally from svn r9454]

12 years agoTypo fix from Helge Kreutzmann, forwarded from Debian.
Simon Tatham [Sun, 8 Apr 2012 13:45:09 +0000 (13:45 +0000)]
Typo fix from Helge Kreutzmann, forwarded from Debian.

[originally from svn r9453]

12 years agoIncrease by 1 pixel the clip rectangle used to draw and erase the
Simon Tatham [Sun, 8 Apr 2012 13:06:47 +0000 (13:06 +0000)]
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]

12 years agoSwap a 'max' for a 'min', fixing an out-of-range colour component
Simon Tatham [Sun, 8 Apr 2012 13:06:46 +0000 (13:06 +0000)]
Swap a 'max' for a 'min', fixing an out-of-range colour component
being passed to the front end.

[originally from svn r9451]

12 years agoIncrease by 1 in every direction the size of the blitter used to save
Simon Tatham [Sun, 8 Apr 2012 13:06:45 +0000 (13:06 +0000)]
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]

12 years agoAdd an explicit -lm to the link lines in Makefile.gtk, after two users
Simon Tatham [Sat, 7 Apr 2012 22:28:59 +0000 (22:28 +0000)]
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]

12 years agoFix redundant redrawing in Pegs. Apparently it has always redrawn
Simon Tatham [Sat, 7 Apr 2012 22:19:18 +0000 (22:19 +0000)]
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]

12 years agoChange some instances of 'print $thing' to 'print $thing || ""', to
Simon Tatham [Sat, 7 Apr 2012 22:19:17 +0000 (22:19 +0000)]
Change some instances of 'print $thing' to 'print $thing || ""', to
prevent annoying Perl warnings when $thing is undefined.

[originally from svn r9446]

12 years agoError checking in Pattern, which was until now the only remaining game
Simon Tatham [Fri, 6 Apr 2012 12:34:34 +0000 (12:34 +0000)]
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]

12 years agoComment the Mac build out of Buildscr, since I no longer have a
Simon Tatham [Tue, 3 Apr 2012 12:49:22 +0000 (12:49 +0000)]
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]

12 years agoPatch from Jonas Koelker to add keyboard control support to Pearl.
Simon Tatham [Sun, 19 Feb 2012 10:15:59 +0000 (10:15 +0000)]
Patch from Jonas Koelker to add keyboard control support to Pearl.

[originally from svn r9411]

12 years agoTweak a conditional expression in pearl.c to work around a display bug
Simon Tatham [Fri, 17 Feb 2012 19:07:31 +0000 (19:07 +0000)]
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]

12 years agoFix one-character typo in r9405 which was breaking right-clicks.
Simon Tatham [Mon, 13 Feb 2012 21:10:47 +0000 (21:10 +0000)]
Fix one-character typo in r9405 which was breaking right-clicks.

[originally from svn r9406]
[r9405 == 0c13787c2a17adc891f8e47c06b259f80bc8251a]

12 years agoDavid Nickerson reports odd behaviour involving a drag start point
Simon Tatham [Wed, 8 Feb 2012 23:31:58 +0000 (23:31 +0000)]
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]

12 years agoCorrect kdiff setting.
Simon Tatham [Thu, 2 Feb 2012 23:04:46 +0000 (23:04 +0000)]
Correct kdiff setting.

[originally from svn r9403]

12 years agoDon't try to run solver_killer_sums on a Killer cage with only one
Simon Tatham [Thu, 2 Feb 2012 23:04:43 +0000 (23:04 +0000)]
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]

12 years agoFix a couple of typos in messages.
Simon Tatham [Thu, 2 Feb 2012 23:04:38 +0000 (23:04 +0000)]
Fix a couple of typos in messages.

[originally from svn r9401]

12 years agoDavid Nickerson reports that it's possible to lay a line over a 'no
Simon Tatham [Thu, 2 Feb 2012 07:18:14 +0000 (07:18 +0000)]
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]

12 years agoSort out a bit of confusion between mouse- and keyboard-driven drags
Simon Tatham [Tue, 31 Jan 2012 08:38:42 +0000 (08:38 +0000)]
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]

12 years agoMove a debug statement at the end of new_clues from the caller (just
Simon Tatham [Tue, 31 Jan 2012 08:32:26 +0000 (08:32 +0000)]
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]

12 years agoAdd comments suggesting some solver upgrades to Light Up (perhaps for
Simon Tatham [Mon, 23 Jan 2012 19:12:12 +0000 (19:12 +0000)]
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]

12 years agoThe Light Up solver limits its recursion depth, so if it fails to find
Simon Tatham [Mon, 23 Jan 2012 18:56:05 +0000 (18:56 +0000)]
The Light Up solver limits its recursion depth, so if it fails to find
a solution then it should not deduce that no solution exists. Change
wording of the error message returned from the Solve user action.

[originally from svn r9387]

12 years agoFix default parameter assignment in Light Up when validating an
Simon Tatham [Mon, 23 Jan 2012 18:56:04 +0000 (18:56 +0000)]
Fix default parameter assignment in Light Up when validating an
incomplete parameter string: if the user hand-types a game ID along
the lines of '18x10:stuff', we should not assume SYMM_ROT4 in the
resulting game_params, since it'll be failed by validate_params.

[originally from svn r9386]

12 years agoTrivial and silly patch to allow users to configure the Signpost
Simon Tatham [Sun, 22 Jan 2012 15:52:14 +0000 (15:52 +0000)]
Trivial and silly patch to allow users to configure the Signpost
victory roll so that adjacent arrows rotate in opposite directions,
giving the impression that they're an interlocking field of gears.
Possibly even more brain-twisting than the original version :-)

[originally from svn r9384]

12 years agoIt's a new year.
Jacob Nevins [Sun, 22 Jan 2012 15:44:04 +0000 (15:44 +0000)]
It's a new year.
(It was a new year this time last year, too.)

[originally from svn r9382]

12 years agoTweak right-click processing to be less finicky.
Simon Tatham [Sun, 22 Jan 2012 15:12:56 +0000 (15:12 +0000)]
Tweak right-click processing to be less finicky.

[originally from svn r9381]

12 years agoNew puzzle! Or rather, new-ish, because this one has been lying around
Simon Tatham [Sun, 22 Jan 2012 14:14:26 +0000 (14:14 +0000)]
New puzzle! Or rather, new-ish, because this one has been lying around
in the 'unfinished' directory for a while, and has now been finished
up thanks to James Harvey putting in some effort and galvanising me to
put in the rest. This is 'Pearl', an implementation of Nikoli's 'Masyu'.

The code in Loopy that generates a random loop along grid edges to use
as the puzzle solution has been abstracted out into loopgen.[ch] so
that Pearl can use it for its puzzle solutions too. I've also
introduced a new utility module called 'tdq' (for 'to-do queue').

[originally from svn r9379]

12 years agoFix a bug causing premature defeatism in the Bridges solver. Deducing
Simon Tatham [Tue, 17 Jan 2012 18:53:02 +0000 (18:53 +0000)]
Fix a bug causing premature defeatism in the Bridges solver. Deducing
a better upper bound on the number of bridges leaving a given island
in a given direction was not counted as having 'done something'; so a
solver run could make several such deductions, but then terminate in
the belief that it hadn't achieved anything, when just going back
round the main solver loop would have enabled it to make further
deductions based on those new bounds.

[originally from svn r9377]

12 years agoAllow --save to work with --soln, causing saved game files to be
Simon Tatham [Wed, 28 Dec 2011 18:17:30 +0000 (18:17 +0000)]
Allow --save to work with --soln, causing saved game files to be
written out with the Solve operation having already been performed.

[originally from svn r9375]

12 years agoFix bug in error reporting for --save caused by freeing 'realname'
Simon Tatham [Wed, 28 Dec 2011 18:07:46 +0000 (18:07 +0000)]
Fix bug in error reporting for --save caused by freeing 'realname'
before the error messages wanted to use it.

[originally from svn r9374]

12 years agoFix bug in --save caused by failure to initialise ctx.error to zero
Simon Tatham [Wed, 28 Dec 2011 18:07:46 +0000 (18:07 +0000)]
Fix bug in --save caused by failure to initialise ctx.error to zero
before later checking to see if an errno code was dumped in it.

[originally from svn r9373]

12 years agoIn Group, the keyboard-controlled cursor should respect user
Simon Tatham [Wed, 21 Dec 2011 13:46:48 +0000 (13:46 +0000)]
In Group, the keyboard-controlled cursor should respect user
rearrangement of the rows and columns.

[originally from svn r9372]