New puzzle: 'Flood'.

Based on a web game I saw a few years ago, and dashed off this weekend
after I thought of a way to write a good (though not quite optimal)
heuristic solver, here's a random little thing not quite in the same
line as the most usual kind of Puzzles fare: instead of making you
scratch your head to find any move to make at all, it's easy to find
solutions in principle, and the challenge comes from having to do so
within a move limit.
This commit is contained in:
Simon Tatham
2015-01-12 19:51:19 +00:00
parent b2f8f5fb57
commit 201b32983b
7 changed files with 1378 additions and 5 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@
/filling /filling
/fillingsolver /fillingsolver
/flip /flip
/flood
/galaxies /galaxies
/galaxiespicture /galaxiespicture
/galaxiessolver /galaxiessolver

19
flood.R Normal file
View File

@ -0,0 +1,19 @@
# -*- makefile -*-
flood : [X] GTK COMMON flood flood-icon|no-icon
flood : [G] WINDOWS COMMON flood flood.res|noicon.res
ALL += flood[COMBINED]
!begin am gtk
GAMES += flood
!end
!begin >list.c
A(flood) \
!end
!begin >gamedesc.txt
flood:flood.exe:Flood:Flood-filling puzzle
!end

1266
flood.c Normal file

File diff suppressed because it is too large Load Diff

8
html/flood.html Normal file
View File

@ -0,0 +1,8 @@
Flood
<p>
Try to get the whole grid to be the same colour within the given
number of moves, by repeatedly flood-filling the top left corner in
different colours.
<p>
Click in a square to flood-fill the top left corner with that square's
colour.

View File

@ -1,10 +1,10 @@
# Makefile for Puzzles icons. # Makefile for Puzzles icons.
PUZZLES = blackbox bridges cube dominosa fifteen filling flip galaxies \ PUZZLES = blackbox bridges cube dominosa fifteen filling flip flood \
guess inertia keen lightup loopy magnets map mines net \ galaxies guess inertia keen lightup loopy magnets map mines \
netslide pattern pearl pegs range rect samegame signpost \ net netslide pattern pearl pegs range rect samegame \
singles sixteen slant solo tents towers twiddle undead \ signpost singles sixteen slant solo tents towers twiddle \
unequal unruly untangle undead unequal unruly untangle
BASE = $(patsubst %,%-base.png,$(PUZZLES)) BASE = $(patsubst %,%-base.png,$(PUZZLES))
WEB = $(patsubst %,%-web.png,$(PUZZLES)) WEB = $(patsubst %,%-web.png,$(PUZZLES))

14
icons/flood.sav Normal file
View File

@ -0,0 +1,14 @@
SAVEFILE:41:Simon Tatham's Portable Puzzle Collection
VERSION :1:1
GAME :5:Flood
PARAMS :7:6x6c6m5
CPARAMS :7:6x6c6m5
SEED :15:967543368167853
DESC :39:032242034203340350204502505323231342,17
NSTATES :1:6
STATEPOS:1:6
MOVE :2:M3
MOVE :2:M2
MOVE :2:M0
MOVE :2:M5
MOVE :2:M3

View File

@ -3118,6 +3118,71 @@ both the width and height to be even numbers.)
\dd If enabled, no two rows are permitted to have exactly the same \dd If enabled, no two rows are permitted to have exactly the same
pattern, and likewise columns. (A row and a column can match, though.) pattern, and likewise columns. (A row and a column can match, though.)
\C{flood} \i{Flood}
\cfg{winhelp-topic}{games.flood}
You are given a grid of squares, coloured at random in multiple
colours. In each move, you can flood-fill the top left square in a
colour of your choice (i.e. every square reachable from the starting
square by an orthogonally connected path of squares all the same
colour will be filled in the new colour). As you do this, more and
more of the grid becomes connected to the starting square.
Your aim is to make the whole grid the same colour, in as few moves as
possible. The game will set a limit on the number of moves, based on
running its own internal solver. You win if you can make the whole
grid the same colour in that many moves or fewer.
I saw this game (with a fixed grid size, fixed number of colours, and
fixed move limit) at \W{http://floodit.appspot.com}\cw{floodit.appspot.com}.
\H{flood-controls} \I{controls, for Flood}Flood controls
To play Flood, click the mouse in a square. The top left corner and
everything connected to it will be flood-filled with the colour of the
square you clicked. Clicking a square the same colour as the top left
corner has no effect, and therefore does not count as a move.
You can also use the cursor keys to move a cursor (outline black
square) around the grid. Pressing the return key will fill the top
left corner in the colour of the square under the cursor.
(All the actions described in \k{common-actions} are also available.)
\H{flood-parameters} \I{parameters, for Flood}Flood parameters
These parameters are available from the \q{Custom...} option on the
\q{Type} menu.
\dt \e{Width}, \e{Height}
\dd Size of the grid, in squares.
\dt \e{Colours}
\dd Number of colours used to fill the grid. Must be at least 3 (with
two colours there would only be one legal move at any stage, hence no
choice to make at all), and at most 10.
\dt \e{Extra moves permitted}
\dd Controls the difficulty of the puzzle, by increasing the move
limit. In each new grid, Flood will run an internal solver to generate
its own solution, and then the value in this field will be added to
the length of Flood's solution to generate the game's move limit. So a
value of 0 requires you to be just as efficient as Flood's automated
solver, and a larger value makes it easier.
\lcont{
(Note that Flood's internal solver will not necessarily find the
shortest possible solution, though I believe it's pretty close. For a
real challenge, set this value to 0 and then try to solve a grid in
\e{strictly fewer} moves than the limit you're given!)
}
\A{licence} \I{MIT licence}\ii{Licence} \A{licence} \I{MIT licence}\ii{Licence}
This software is \i{copyright} 2004-2014 Simon Tatham. This software is \i{copyright} 2004-2014 Simon Tatham.