chiark / gitweb /
sgt-puzzles.git
8 years agoFix a display glitch in Keen's pencil-mode cursor.
Jonas Kölker [Thu, 1 Oct 2015 19:59:30 +0000 (21:59 +0200)]
Fix a display glitch in Keen's pencil-mode cursor.

Draw pencil-mode cursor before corners of thick lines in order to make
the thick lines appear on top of the north-west corner of the pencil
cursor, just like they do with the non-pencil cursor.

8 years agoRecompute solutions in Inertia if the user strays from the path.
Jonas Kölker [Thu, 1 Oct 2015 19:29:42 +0000 (21:29 +0200)]
Recompute solutions in Inertia if the user strays from the path.

8 years agoFix an instance generation hang in Signpost.
Jonas Kölker [Thu, 1 Oct 2015 19:22:24 +0000 (21:22 +0200)]
Fix an instance generation hang in Signpost.

Also expand the set of permissible parameters (add 1xN, Nx1 and 2x2).

8 years agoGreatly improve and speed up the Filling instance generation.
Jonas Kölker [Thu, 1 Oct 2015 19:12:13 +0000 (21:12 +0200)]
Greatly improve and speed up the Filling instance generation.

8 years agoGreatly increase the speed of the Filling solver.
Jonas Kölker [Thu, 1 Oct 2015 17:57:49 +0000 (19:57 +0200)]
Greatly increase the speed of the Filling solver.

8 years agoTowers: allow marking of clues as done with the keyboard
Jonas Kölker [Thu, 1 Oct 2015 16:41:15 +0000 (18:41 +0200)]
Towers: allow marking of clues as done with the keyboard

8 years agoAllow marking of clues as exhausted in Unequal.
Jonas Kölker [Thu, 1 Oct 2015 16:26:50 +0000 (18:26 +0200)]
Allow marking of clues as exhausted in Unequal.

8 years agoDisplay improvements to Range.
Jonas Kölker [Thu, 1 Oct 2015 15:50:59 +0000 (17:50 +0200)]
Display improvements to Range.

Make the grid look a lot less heavy; enhance highlighting of error
clues; highlight enclosed small regions much more prettily.

8 years agoFix a misrendering in Guess.
Jonas Kölker [Thu, 1 Oct 2015 15:42:48 +0000 (17:42 +0200)]
Fix a misrendering in Guess.

When the cursor was visible, redrawing after undo-redo or label
toggling or resizing would draw background over the top of the
circular cursor.

8 years agoFix a memory error in Guess cursor handling.
Jonas Kölker [Thu, 1 Oct 2015 12:00:47 +0000 (14:00 +0200)]
Fix a memory error in Guess cursor handling.

8 years agoCancel dragging in Pearl by pressing Escape or Backspace.
Jonas Kölker [Tue, 22 Sep 2015 09:41:41 +0000 (11:41 +0200)]
Cancel dragging in Pearl by pressing Escape or Backspace.

8 years agoChange Pearl's cursor logic.
Jonas Kölker [Tue, 22 Sep 2015 09:37:17 +0000 (11:37 +0200)]
Change Pearl's cursor logic.

Keyboard dragging while holding Control now moves the cursor to the
target square. Shift-Control-arrowkey performs the previous behavior
of Control-arrowkey.

8 years agoRefactor Pearl's mark_in_direction, and invert a parameter.
Jonas Kölker [Tue, 22 Sep 2015 09:19:53 +0000 (11:19 +0200)]
Refactor Pearl's mark_in_direction, and invert a parameter.

8 years agoRefactor modifier handling in Pearl's cursor code.
Jonas Kölker [Tue, 22 Sep 2015 09:18:31 +0000 (11:18 +0200)]
Refactor modifier handling in Pearl's cursor code.

8 years agoAdd more keyboard controls to Slant.
Jonas Kölker [Mon, 21 Sep 2015 16:34:53 +0000 (18:34 +0200)]
Add more keyboard controls to Slant.

8 years agoSlant: hide keyboard cursor when using the mouse.
Jonas Kölker [Mon, 21 Sep 2015 16:22:34 +0000 (18:22 +0200)]
Slant: hide keyboard cursor when using the mouse.

8 years agoRectangles: cancel keyboard drag with Escape.
Jonas Kölker [Mon, 21 Sep 2015 15:44:50 +0000 (17:44 +0200)]
Rectangles: cancel keyboard drag with Escape.

8 years agoFilling: enable keyboard-driven cursor dragging mode.
Jonas Kölker [Mon, 21 Sep 2015 15:41:10 +0000 (17:41 +0200)]
Filling: enable keyboard-driven cursor dragging mode.

8 years agoRange: add pencil marks to squares by Shift-cursor keys.
Jonas Kölker [Mon, 21 Sep 2015 15:39:47 +0000 (17:39 +0200)]
Range: add pencil marks to squares by Shift-cursor keys.

8 years agoPattern: color multiple squares with Ctrl- or Shift-cursor keys.
Jonas Kölker [Mon, 21 Sep 2015 15:33:02 +0000 (17:33 +0200)]
Pattern: color multiple squares with Ctrl- or Shift-cursor keys.

8 years agoAdd game_text_format to Tents.
Jonas Kölker [Mon, 21 Sep 2015 15:14:55 +0000 (17:14 +0200)]
Add game_text_format to Tents.

Replaces an inactive stub implementation.

8 years agoAdd game_text_format to Pattern.
Jonas Kölker [Mon, 21 Sep 2015 15:02:47 +0000 (17:02 +0200)]
Add game_text_format to Pattern.

8 years agoAdd game_text_format to Inertia.
Jonas Kölker [Mon, 21 Sep 2015 14:57:14 +0000 (16:57 +0200)]
Add game_text_format to Inertia.

8 years agoAdd game_text_format to Flip.
Jonas Kölker [Mon, 21 Sep 2015 14:54:38 +0000 (16:54 +0200)]
Add game_text_format to Flip.

8 years agoAdd game_text_format to Pearl.
Jonas Kölker [Mon, 21 Sep 2015 14:53:20 +0000 (16:53 +0200)]
Add game_text_format to Pearl.

8 years agoAdd game_text_format to Dominosa.
Jonas Kölker [Mon, 21 Sep 2015 14:49:56 +0000 (16:49 +0200)]
Add game_text_format to Dominosa.

8 years agoUnequal: stop ignoring keys 'h' and 'm' while cursor active.
Jonas Kölker [Mon, 21 Sep 2015 14:41:03 +0000 (16:41 +0200)]
Unequal: stop ignoring keys 'h' and 'm' while cursor active.

At least, so long as 'h' and 'm' are not "numbers".

8 years agoFix a memory leak in Range's find_errors.
Jonas Kölker [Mon, 21 Sep 2015 14:21:48 +0000 (16:21 +0200)]
Fix a memory leak in Range's find_errors.

Only occurred in invalid instances, such as 3x1:1b when you put a
black in the middle square.

8 years agoDon't overallocate colour memory in Loopy.
Jonas Kölker [Mon, 21 Sep 2015 14:24:10 +0000 (16:24 +0200)]
Don't overallocate colour memory in Loopy.

8 years agoFix segfault in Range's game_text_format.
Jonas Kölker [Mon, 21 Sep 2015 13:55:53 +0000 (15:55 +0200)]
Fix segfault in Range's game_text_format.

Occurred on Nx1 puzzles, etc.

8 years agoFix typo in undo key handling.
Jonas Kölker [Mon, 21 Sep 2015 14:26:53 +0000 (16:26 +0200)]
Fix typo in undo key handling.

Now we can undo with both 'u' and 'U', symmetrically with redoing with
both 'r' and 'R'.

8 years agoInclude an example of Range's text_format in the comments.
Jonas Kölker [Mon, 21 Sep 2015 13:48:29 +0000 (15:48 +0200)]
Include an example of Range's text_format in the comments.

8 years agoFix a typo in the comments of Pearl.
Jonas Kölker [Mon, 21 Sep 2015 13:51:06 +0000 (15:51 +0200)]
Fix a typo in the comments of Pearl.

Each stone can have 2 lines radiating from its centre, not 3.

8 years agoAdd '-set colorspace RGB' to some icon convert commands.
Simon Tatham [Sat, 3 Oct 2015 12:15:59 +0000 (13:15 +0100)]
Add '-set colorspace RGB' to some icon convert commands.

Its absence was breaking the icon build on Ubuntu 14.04, because you
ask convert to map an image into a specific 16-colour palette, and it
does so and _then_ nonconsensually maps those colours in turn through
a colourspace transformation you didn't ask for, causing icon.pl to
fail an assertion when it finds an RGB value not in the palette.

8 years agoGTK 3 port: arrange configure.ac support for GTK 2/3 detection.
Simon Tatham [Sat, 3 Oct 2015 11:28:28 +0000 (12:28 +0100)]
GTK 3 port: arrange configure.ac support for GTK 2/3 detection.

GTK 3 is the default, falling back to GTK 2 if 3 isn't available; you
can also say --with-gtk=2 to force GTK 2.

8 years agoGTK 3 port: don't turn off drawing area double buffering.
Simon Tatham [Sat, 3 Oct 2015 11:28:26 +0000 (12:28 +0100)]
GTK 3 port: don't turn off drawing area double buffering.

I think I did this in GTK2 on the basis that our server-side cache
pixmap was double-buffering enough for us - any puzzle which erased a
big area with a background rectangle and then redrew over the top of
it would do so only on the off-screen pixmap, and the updates would
only be copied to the visible window after it was all done.

In GTK3, I don't think there's any need - this is all the usual way
things are done anyway, as far as I can see. So I've turned this call
back off, at least until I hear of a reason why I need it again.

8 years agoGTK 3 port: change API functions for widget sizing.
Simon Tatham [Sat, 3 Oct 2015 11:28:24 +0000 (12:28 +0100)]
GTK 3 port: change API functions for widget sizing.

set_usize is deprecated, and get_preferred_size is the GTK 3 thing we
should use in place of size_request.

8 years agoGTK 3 port: use GtkBox directly, not GtkHBox and GtkVBox.
Simon Tatham [Sat, 3 Oct 2015 11:28:21 +0000 (12:28 +0100)]
GTK 3 port: use GtkBox directly, not GtkHBox and GtkVBox.

I've done this by #defining the old names in terms of the new ones,
because the old ones are still more concise!

8 years agoGTK 3 port: be prepared not to use GtkStock.
Simon Tatham [Sat, 3 Oct 2015 11:28:19 +0000 (12:28 +0100)]
GTK 3 port: be prepared not to use GtkStock.

GTK 3 has deprecated it in favour of just making you specify fixed
strings as button labels, which seems like a step backwards to me but
there we go.

8 years agoGTK 3 port: use GdkRGBA for the window background colour.
Simon Tatham [Sat, 3 Oct 2015 11:28:17 +0000 (12:28 +0100)]
GTK 3 port: use GdkRGBA for the window background colour.

Suits our internal API better, anyway, with RGB components being
floats ranging from 0 to 1.

8 years agoGTK 3 port: stop getting default bg colour from the window style.
Simon Tatham [Sat, 3 Oct 2015 11:28:15 +0000 (12:28 +0100)]
GTK 3 port: stop getting default bg colour from the window style.

GTK3 window styles don't reliably provide one, so we have to fall back
to just making one up.

8 years agoGTK 3 port: condition out the complicated window resize code.
Simon Tatham [Sat, 3 Oct 2015 11:28:13 +0000 (12:28 +0100)]
GTK 3 port: condition out the complicated window resize code.

In GTK 2, we had a big pile of horrible code to deal with the fact
that it's very hard to open a window in such a way as to make it easy
to resize smaller as well as bigger.

Essentially, we'd open the window with the drawing area's minimum size
request set to the desired _initial_ window size; then we'd wait until
GTK had finished creating other window components (menu bar, status
line) and the window's size allocation had settled down, and finally
reduce the size request to the real minimum size so that now the
window was resizable in both directions. This also involved some
deliberate checking of the Ubuntu Unity GTK extension which steals the
menu bar and put it elsewhere (see commit 8f8333a35), to avoid us
waiting forever for a menu bar that wasn't going to show up.

But in GTK3, this has all become actually sensible! All we now have to
do is to set the window's geometry hints to indicate the drawing area
itself as the base widget (probably a good plan anyway), and then we
can set the initial size using gtk_window_set_default_geometry() and
resize it later using gtk_window_resize_to_geometry(). So now we can
completely condition out all of the previous horrors, and consider
them to be legacy GTK2 compatibility code only. Phew.

8 years agoGTK 3 port: provide a 'draw' handler.
Simon Tatham [Sat, 3 Oct 2015 11:28:11 +0000 (12:28 +0100)]
GTK 3 port: provide a 'draw' handler.

This is what GTK 3 uses in place of 'expose_event'. Also I've arranged
here for my internal USE_CAIRO_WITHOUT_PIXMAP setting to be enabled in
GTK3, as well as in GTK2 with deprecated functions disabled.

8 years agoGTK 3 port: use GtkGrid as an alternative to GtkTable.
Simon Tatham [Sat, 3 Oct 2015 11:28:09 +0000 (12:28 +0100)]
GTK 3 port: use GtkGrid as an alternative to GtkTable.

This also involves setting some "hexpand" properties on the widgets
contained in the GtkGrid, to achieve effects which GtkTable did by
setting flags in gtk_table_attach.

8 years agoGTK 3 prep: use g_timeout_add, not gtk_timeout_add.
Simon Tatham [Sat, 3 Oct 2015 11:28:06 +0000 (12:28 +0100)]
GTK 3 prep: use g_timeout_add, not gtk_timeout_add.

8 years agoGTK 3 prep: use GTK instead of GDK window-icon functions.
Simon Tatham [Sat, 3 Oct 2015 11:28:04 +0000 (12:28 +0100)]
GTK 3 prep: use GTK instead of GDK window-icon functions.

We now build cleanly with -DGDK_DISABLE_DEPRECATED.

8 years agoGTK 3 prep: make the server-side backing pixmap optional.
Simon Tatham [Sat, 3 Oct 2015 11:28:02 +0000 (12:28 +0100)]
GTK 3 prep: make the server-side backing pixmap optional.

When GDK_DISABLE_DEPRECATED is defined, we now don't have fe->pixmap;
instead we just maintain our client-side window contents in fe->image,
and draw from there directly to the window in the expose handler.

8 years agoGTK 3 prep: use gtk_radio_menu_item_get_group().
Simon Tatham [Sat, 3 Oct 2015 11:28:00 +0000 (12:28 +0100)]
GTK 3 prep: use gtk_radio_menu_item_get_group().

Replaces the previous deprecated spelling. We now build cleanly with
-DGTK_DISABLE_DEPRECATED.

8 years agoGTK 3 prep: use GtkComboBox for drop-down lists.
Simon Tatham [Sat, 3 Oct 2015 11:27:58 +0000 (12:27 +0100)]
GTK 3 prep: use GtkComboBox for drop-down lists.

The previous GtkOptionMenu was long since deprecated.

8 years agoGTK 3 prep: use the glib names for base object types.
Simon Tatham [Sat, 3 Oct 2015 11:27:56 +0000 (12:27 +0100)]
GTK 3 prep: use the glib names for base object types.

8 years agoGTK 3 prep: use GTK_KEY_* constants.
Simon Tatham [Sat, 3 Oct 2015 11:27:54 +0000 (12:27 +0100)]
GTK 3 prep: use GTK_KEY_* constants.

8 years agoGTK 3 prep: use accessors instead of direct field access.
Simon Tatham [Sat, 3 Oct 2015 11:27:51 +0000 (12:27 +0100)]
GTK 3 prep: use accessors instead of direct field access.

We now build cleanly with -DGSEAL_ENABLE.

8 years agoFix packing direction of config boxes.
Simon Tatham [Sat, 3 Oct 2015 11:27:49 +0000 (12:27 +0100)]
Fix packing direction of config boxes.

We were packing the GtkTable into the dialog's content area using
gtk_box_pack_end, which had the slightly silly effect that resizing
the config box vertically would keep all the controls aligned to the
_bottom_ rather than the top.

8 years agoDon't refresh backing store on a no-op configure event.
Simon Tatham [Sat, 3 Oct 2015 11:27:47 +0000 (12:27 +0100)]
Don't refresh backing store on a no-op configure event.

Sometimes, we can get a "configure_area" event telling us that the
drawing area has changed size to the same size it already was. This
can happen when we change puzzle presets in a way that doesn't change
the size, and also sometimes seems to happen as a side effect of
changing the text in the status line.

In that situation, it's a waste of effort - and can cause visible
on-screen flicker - to throw away the window's backing image and
pixmap and regenerate them from scratch. So now we detect a non-resize
and avoid doing all that.

The only thing we retain unconditionally in configure_area is the
midend_force_redraw, because that's the place where a puzzle redraw is
forced when changing presets or loading a new game.

8 years agoEnforce more than one dot in Galaxies puzzles.
Chris Boyle [Sat, 26 Sep 2015 17:54:15 +0000 (18:54 +0100)]
Enforce more than one dot in Galaxies puzzles.

At minimum size (3x3) Galaxies can generate a pre-solved single dot
game.

You have to add and remove a line to get the victory flash which is a
bit weird, so just prevent this.

8 years agoFix OS X build failure due to a deprecated method.
Simon Tatham [Fri, 18 Sep 2015 11:20:32 +0000 (12:20 +0100)]
Fix OS X build failure due to a deprecated method.

Apple upgraded me to Xcode 7 yesterday, and now [NSString cString]
gives a deprecation warning, which -Werror turns into a full-on build
failure. Explicitly specify an encoding.

(I mention in a comment that there's an alternative piece of API that
I possibly ought to be using instead, but until I make a concrete
decision about where my backwards compatibility threshold is, I'll
leave it as it is for the moment.)

8 years agoImplement osx_draw_thick_line
Bo Lindbergh [Wed, 2 Sep 2015 19:58:55 +0000 (21:58 +0200)]
Implement osx_draw_thick_line

8 years agoTypo in the OS X Info plist
Bo Lindbergh [Tue, 25 Aug 2015 13:45:07 +0000 (15:45 +0200)]
Typo in the OS X Info plist

8 years agoemcc frontend: stop indiscriminately squashing mouseups.
Simon Tatham [Fri, 14 Aug 2015 18:42:42 +0000 (19:42 +0100)]
emcc frontend: stop indiscriminately squashing mouseups.

The mouseup listener was calling event.preventDefault(), as part of
the mechanism for making mouse clicks and drags on the puzzle's resize
handle have resizing effects _instead_ of the normal browser
behaviour. However, calling event.preventDefault() on _every_ mouseup,
rather than just the ones associated with the resize handle, was
overkill, and I've recently noticed that it's breaking attempts to
select from the game type dropdown by clicking the mouse. So now I'm
only calling preventDefault() on the mouseups that I have reason to
think are actually relevant to what I'm trying to do.

(I don't know why I've only just noticed this. I suppose a change of
behaviour between Firefox versions is the most likely cause.)

8 years agoReplace a TCHAR with a WCHAR.
Simon Tatham [Sat, 1 Aug 2015 10:14:30 +0000 (11:14 +0100)]
Replace a TCHAR with a WCHAR.

MultiByteToWideChar expects a WCHAR[256] output buffer if you pass it
an output length of 256. TCHAR[256] is entirely the wrong size, though
for some reason Visual Studio seems not to have thrown a compile error
pointing that out.

Thanks to Jason Hood for spotting this.

8 years agoSolo, Undead: support 'm' to fill in all pencils.
Simon Tatham [Mon, 13 Jul 2015 18:06:53 +0000 (19:06 +0100)]
Solo, Undead: support 'm' to fill in all pencils.

Keen, Towers and Unequal (and Group) already have this feature in
common: pressing m while no square is selected, causes a full set of
pencil marks to be filled in for every square without a real number/
letter/whatever in it. Solo and Undead share the basic UI principles
(left-click to select a square then type a thing to go in it, vs
right-click to select a square then type things to pencil-mark in it),
but did not have that same feature. Now they do.

8 years agoFix redrawing of Undead 'done' clues after a resize.
Simon Tatham [Sun, 5 Jul 2015 20:57:38 +0000 (21:57 +0100)]
Fix redrawing of Undead 'done' clues after a resize.

The is_hint_stale() function has the side effect of copying a path
hint's new colour-relevant information into the game_drawstate, where
draw_path_hint will then use it. But it returns TRUE early in some
situations, notably !ds->started, which can happen after the actual
game start if the window is resized and a fresh drawstate is created.

This patch, thanks to Chris Boyle, fixes it by eliminating the early
returns from is_hint_stale - the return value is unchanged, but now
the side effects happen reliably.

8 years agoMagnets: you can now mark clues as done
Kevin Lyles [Mon, 8 Jun 2015 20:47:09 +0000 (15:47 -0500)]
Magnets: you can now mark clues as done

8 years agoRemoved an extra layer of complexity for count colors
Kevin Lyles [Mon, 8 Jun 2015 21:42:31 +0000 (16:42 -0500)]
Removed an extra layer of complexity for count colors

8 years agoFactored out some of the color logic for the clues
Kevin Lyles [Mon, 8 Jun 2015 21:20:58 +0000 (16:20 -0500)]
Factored out some of the color logic for the clues

8 years agoRemoved DS_FULL (it wasn't used)
Kevin Lyles [Mon, 8 Jun 2015 20:48:03 +0000 (15:48 -0500)]
Removed DS_FULL (it wasn't used)

8 years agoUpdated name/size of clues_done in Towers
Kevin Lyles [Tue, 26 May 2015 00:46:24 +0000 (19:46 -0500)]
Updated name/size of clues_done in Towers

8 years agoUndead: you can now mark clues as done
Kevin Lyles [Tue, 26 May 2015 00:46:24 +0000 (19:46 -0500)]
Undead: you can now mark clues as done

8 years agoReworked draw_path_hint
Kevin Lyles [Tue, 26 May 2015 00:46:24 +0000 (19:46 -0500)]
Reworked draw_path_hint

8 years agoFactored out a portion of game_redraw
Kevin Lyles [Tue, 26 May 2015 00:46:24 +0000 (19:46 -0500)]
Factored out a portion of game_redraw

8 years agoTowers: you can now mark clues done
Kevin Lyles [Wed, 13 May 2015 04:23:52 +0000 (23:23 -0500)]
Towers: you can now mark clues done

8 years agoSplit out the text color portion of draw_tile
Kevin Lyles [Sat, 16 May 2015 18:51:34 +0000 (13:51 -0500)]
Split out the text color portion of draw_tile

8 years agoCleaned up execute_move a little
Kevin Lyles [Sat, 16 May 2015 18:51:34 +0000 (13:51 -0500)]
Cleaned up execute_move a little

9 years agoAdd the 'make test' target to Makefile.am too.
Simon Tatham [Mon, 18 May 2015 15:41:06 +0000 (16:41 +0100)]
Add the 'make test' target to Makefile.am too.

Now I don't have to annoyingly switch over to the GTK makefile.

9 years agoAdd sorting-order buttons to the benchmark output.
Simon Tatham [Mon, 18 May 2015 15:39:12 +0000 (16:39 +0100)]
Add sorting-order buttons to the benchmark output.

Since I'm committed to HTML5ish Javascript already, that shouldn't be
too much of an inconvenience.

9 years agoMove the benchmarking logic out into a script.
Simon Tatham [Mon, 18 May 2015 15:17:49 +0000 (16:17 +0100)]
Move the benchmarking logic out into a script.

It's a pain having it in a rule in Makefile.gtk, which isn't even the
recommended makefile these days - it can't be re-run conveniently, and
there's no way to parametrise it. Now it can be run no matter which
makefile you're using, and it lets you narrow down to a subset of
games (though not presets). Other options could easily be added.

9 years agoHandle replacing an existing arrow
Kevin Lyles [Sun, 10 May 2015 00:16:24 +0000 (19:16 -0500)]
Handle replacing an existing arrow

9 years agoFix the extra arrow hanging around while moving the opposite existing arrow
Kevin Lyles [Sun, 10 May 2015 00:11:02 +0000 (19:11 -0500)]
Fix the extra arrow hanging around while moving the opposite existing arrow

9 years agoMark some arguments constant
Kevin Lyles [Sun, 10 May 2015 02:05:18 +0000 (21:05 -0500)]
Mark some arguments constant

9 years agoFix the issue with adding only one arrow when the other end was already white
Kevin Lyles [Sat, 9 May 2015 23:51:00 +0000 (18:51 -0500)]
Fix the issue with adding only one arrow when the other end was already white

9 years agoAdd/remove the opposite arrow when you let go
Kevin Lyles [Sun, 3 May 2015 15:46:07 +0000 (10:46 -0500)]
Add/remove the opposite arrow when you let go

9 years agoDraw the opposite arrow only while dragging
Kevin Lyles [Sun, 3 May 2015 15:46:07 +0000 (10:46 -0500)]
Draw the opposite arrow only while dragging

9 years agoMoved all function declarations to the top of the file
Kevin Lyles [Sat, 9 May 2015 23:51:00 +0000 (18:51 -0500)]
Moved all function declarations to the top of the file

9 years agoUse the game_state and space typedefs
Kevin Lyles [Sun, 10 May 2015 02:36:44 +0000 (21:36 -0500)]
Use the game_state and space typedefs

9 years agoAlways use ret instead of state in execute_move
Kevin Lyles [Sun, 3 May 2015 17:40:14 +0000 (12:40 -0500)]
Always use ret instead of state in execute_move

9 years agoFixed a typo in a comment
Kevin Lyles [Sun, 3 May 2015 17:40:14 +0000 (12:40 -0500)]
Fixed a typo in a comment

9 years agoSpecial-case right-dragging of a numbered cell off the grid.
Simon Tatham [Sat, 9 May 2015 14:35:10 +0000 (15:35 +0100)]
Special-case right-dragging of a numbered cell off the grid.

Chris Boyle reports that if you right-drag a numbered cell off the
grid, _all_ numbered cells (except the immutable initial clues) get
reset to blank, because this is treated as an attempt to erase a whole
chain of linked cells (of the form a,a+1,...,a_k) and the cells with
definite numbers are all treated as 'chain 0'.

In that situation, I now substitute the same behaviour you'd get by
left-dragging the numbered cell off the board, i.e. erase _just_ that
cell and not the whole of the rest of the puzzle.

(The previous unintended behaviour was a UI action you surely never
want - and Chris also reports that due to the Android front end's way
of representing right-drags, it's especially easy to hit by mistake.)

9 years agoSort out abs/fabs confusion.
Simon Tatham [Fri, 10 Apr 2015 06:55:16 +0000 (07:55 +0100)]
Sort out abs/fabs confusion.

My Mac has just upgraded itself to include a version of clang which
warns if you use abs() on a floating-point value, or fabs() on an
integer. Fixed the two occurrences that came up in this build (and
which were actual build failures, because of -Werror), one in each
direction.

I think both were benign. The potentially dangerous one was using abs
in place of fabs in grid_find_incentre(), because that could actually
lose precision, but I think that function had plenty of precision to
spare (grid point separation being of the order of tens of pixels) so
nothing should have gone seriously wrong with the old code.

9 years agoAdd Tracks to the automake makefile's "install" target.
Simon Tatham [Wed, 25 Mar 2015 18:23:39 +0000 (18:23 +0000)]
Add Tracks to the automake makefile's "install" target.

Each game's .R file should append the binary to $(GAMES) in both the
'am' and 'gtk' makefiles, but presumably due to copy-and-paste from an
out-of-date version, tracks.R only did 'gtk'.

Also clarified CHECKLST.txt in the hope that I won't miss that again.

9 years agoFix a compile warning on ARM.
Simon Tatham [Tue, 24 Mar 2015 19:20:03 +0000 (19:20 +0000)]
Fix a compile warning on ARM.

Aapo Rantalainen points out that comparing 'char c' against zero gives
rise to gcc's "comparison is always false" warning, which escalates to
an error under -Werror.

This is one of those situations where the warning is doing more harm
than good, but here's a rephrasing which casts to unsigned so that
both negative numbers and positive out-of-range ones can be caught by
the same comparison.

9 years agoUpdate README after the switch to autoconf.
Simon Tatham [Sun, 15 Mar 2015 08:50:53 +0000 (08:50 +0000)]
Update README after the switch to autoconf.

A user just pointed out that it still (and now falsely) claims that
mkfiles.pl directly generates a usable Unix Makefile.

9 years agoFix a build failure on x32 (time_t printfs).
Adam Borowski [Mon, 9 Mar 2015 06:58:10 +0000 (07:58 +0100)]
Fix a build failure on x32 (time_t printfs).

As that architecture has 64-bit time_t but only 32-bit longs, printf format
causes a warning.  Enter -Werror...

9 years agoTurn <image> tag into <img>.
Simon Tatham [Sun, 8 Feb 2015 22:52:20 +0000 (22:52 +0000)]
Turn <image> tag into <img>.

Not sure how I managed to write the former by mistake, but I didn't
notice because browsers didn't immediately complain. Still, James
Harvey points out, it ought to be turned into the actually
standards-compliant spelling of the tag. Ahem.

9 years agoNew puzzle from James Harvey: 'Tracks'.
Simon Tatham [Sun, 8 Feb 2015 16:23:32 +0000 (16:23 +0000)]
New puzzle from James Harvey: 'Tracks'.

9 years agoRemove a lingering bashism in makedist.sh.
Simon Tatham [Sat, 17 Jan 2015 08:49:28 +0000 (08:49 +0000)]
Remove a lingering bashism in makedist.sh.

A load of source files in the icons subdirectory were being left out
of the distribution tarball because I tried to include them using a
combined wildcard and bash brace expansion - but makedist cites
/bin/sh, so can't get away with bashisms. Expanded the braces.

9 years agoImprove the Flood solver.
Simon Tatham [Thu, 15 Jan 2015 20:21:05 +0000 (20:21 +0000)]
Improve the Flood solver.

Previously it simply chose every move based on the static evaluation
function 'minimise the pair (longest shortest-path to any square,
number of squares at that distance)'. Now it looks three moves ahead
recursively, and I've also adjusted the evaluation function to tie-
break based on the number of squares brought to distance zero (i.e.
actually in control).

The result isn't an unconditional improvement on the old solver; in a
test run based on 'flood --generate 1000 12x12c6m0#12345' I found that
57 out of 1000 grids tested now had longer solutions. However, about
three quarters had shorter ones, and solutions are more than a move
shorter on average.

9 years agoRemove some lingering HTML markup.
Simon Tatham [Tue, 13 Jan 2015 20:59:54 +0000 (20:59 +0000)]
Remove some lingering HTML markup.

It was getting conscientiously escaped by the new webpage.pl :-) but
in any case it's better to have the puzzle descriptions be plain text
usable in any context.

9 years agoAnd one more whitespace fix.
Simon Tatham [Tue, 13 Jan 2015 20:46:00 +0000 (20:46 +0000)]
And one more whitespace fix.

It's a pain having to commit each of these separately in order to test
the script, but there we go. Should be working now.

9 years agoCouple of fixes to the new web-page mechanism.
Simon Tatham [Tue, 13 Jan 2015 20:30:40 +0000 (20:30 +0000)]
Couple of fixes to the new web-page mechanism.

I missed some spaces in the autogenerated <span>s, and I generated the
web page components including unfinished puzzles by mistake.

9 years agoScript to autogenerate pieces of the web page.
Simon Tatham [Tue, 13 Jan 2015 20:04:18 +0000 (20:04 +0000)]
Script to autogenerate pieces of the web page.

This should simplify the process of adding a new puzzle, by automating
the part where I have to manually edit index.html separately from the
main build step.