Simon Tatham 1dfc38c2ec Galaxies: new deduction by counting liberties of exclaves.
I've often noticed that Galaxies on 7x7 Unreasonable often generates
puzzles that _I_ don't feel as if I had to use recursion and
backtracking to solve, suggesting that there's an efficient mode of
reasoning available that the puzzle could be using and isn't.

One reason for this is that sometimes Galaxies gives up on trying to
generate an Unreasonable puzzle (if its MAXTRIES counter runs out) and
knowingly falls back to Normal. But that's not the only reason. The
other day I got the puzzle 7x7:gsjgzhfedwgzhd, which Galaxies's own
solver rates as Unreasonable, and I still think it should be Normal.

The full solution to that puzzle is this:

  +-+-+-+-+-+-+-+
  |y x|  o  | | |
  + +-+-+-+-+ +o+
  | |   | | o | |
  + + o + + +-+-+
  | |   | | | | |
  + +-+-+ +-+o+ +
  |   o   |o| |o|
  + +-+-+ +-+-+ +
  | |   | | o | |
  + + o + +-+-+-+
  | |   | |     |
  +-+-+-+ + +o+ +
  | o |x y|     |
  +-+-+-+-+-+-+-+

and Galaxies's Normal-mode solver gets stuck on it at the point where
it's managed to deduce that the tiles labelled 'x' can't possibly be
associated with any dot other than leftmost dot on the centre row, but
is then unable to figure out that the tiles labelled 'y' must also be
associated with that dot. But clearly they must, because they're boxed
in on all other sides (by the grid edge, and by tiles whose
associations are totally obvious), so if either 'x' tile is to find
_any_ path back to its home dot, it must go through the neighbouring
'y' tile.

So, this commit adds the missing deduction: we use a dsf to identify
'exclaves' (connected sets of tiles all associated to the same dot,
but which do not actually contain the dot), and for each exclave we
count its 'liberties' (unassociated tiles bordering the exclave, i.e.
which would extend the exclave if associated to the same dot). Any
exclave with only one liberty must extend into that tile, or else it
would be cut off completely from its home dot. In this case, each 'x'
tile is an exclave by itself, with 'y' its only liberty. (And once
that deduction is done, the pair {x,y} become a larger exclave, which
can be deduced in the same way to connect to the next tile.)

I think this is a deduction rule simple and obvious enough that it
should go in at Normal mode. I've been using it all along in my own
play, and was surprised to find the game wasn't already taking it into
account. In addition, in a quick cross-test of the two versions,
_most_ 7x7 Normal games generated by the modified Galaxies are still
rated as Normal by the old less powerful solver. So it doesn't extend
the difficulty of Normal mode by very much, if at all.

Another benefit is that this should make Normal puzzles more likely to
contain twisty regions of this type.

Also, of course, the usual effect of adding extra deductions at levels
below Unreasonable means that actually Unreasonable puzzles become
that much more tricky!

I have a couple of ideas for extending this technique to be more
powerful still (filled in as comments at the top of the file). For the
moment, I've just done the most obvious version. Perhaps the others
might need to go in at a higher difficulty level.
2023-03-12 11:20:43 +00:00
2021-04-25 09:59:15 +01:00
2018-11-13 21:48:24 +00:00
2023-02-23 23:16:18 +00:00
2023-01-31 23:25:05 +00:00
2023-01-31 23:25:05 +00:00
2023-01-15 20:59:22 +00:00
2023-01-15 16:24:27 +00:00
2023-01-15 16:24:27 +00:00
2023-03-10 18:46:06 +00:00
2023-01-31 23:25:05 +00:00
2018-11-13 21:48:24 +00:00
2023-02-18 23:14:12 +00:00
2023-02-18 23:14:12 +00:00
2023-02-26 22:47:23 +00:00
2023-02-15 14:07:59 +00:00
2023-02-13 21:23:58 +00:00
2018-11-13 21:48:24 +00:00
2017-09-20 18:03:44 +01:00
2021-05-21 09:10:53 +01:00
2021-03-29 19:02:23 +01:00
2023-01-31 23:25:05 +00:00
2023-02-18 23:14:12 +00:00
2023-01-31 23:25:05 +00:00
2018-11-13 21:48:24 +00:00
2023-01-31 23:25:05 +00:00
2023-02-18 23:14:12 +00:00
2017-05-07 16:25:56 +01:00
2023-03-10 18:46:06 +00:00

This is the README accompanying the source code to Simon Tatham's
puzzle collection. The collection's web site is at
<https://www.chiark.greenend.org.uk/~sgtatham/puzzles/>.

The puzzle collection is built using CMake <https://cmake.org/>. To
compile in the simplest way (on any of Linux, Windows or Mac), run
these commands in the source directory:

  cmake .
  cmake --build .

The manual is provided in Windows Help format for the Windows build;
in text format for anyone who needs it; and in HTML for the Mac OS X
application and for the web site. It is generated from a Halibut
source file (puzzles.but), which is the preferred form for
modification. To generate the manual in other formats, rebuild it,
or learn about Halibut, visit the Halibut website at
<https://www.chiark.greenend.org.uk/~sgtatham/halibut/>.
Description
No description provided
Readme 26 MiB
Languages
C 93.3%
JavaScript 1.4%
Objective-C 1.1%
CMake 1.1%
HTML 0.8%
Other 2.2%