New puzzle from James H: `Bridges', another Nikoli job.

[originally from svn r6409]
This commit is contained in:
Simon Tatham
2005-10-21 08:07:31 +00:00
parent 6ea453c95f
commit 4faecc7726
4 changed files with 2811 additions and 3 deletions

7
Recipe
View File

@ -27,10 +27,11 @@ MAP = map dsf
LOOPY = loopy tree234 dsf LOOPY = loopy tree234 dsf
LIGHTUP = lightup combi LIGHTUP = lightup combi
TENTS = tents maxflow TENTS = tents maxflow
BRIDGES = bridges dsf
ALL = list NET NETSLIDE cube fifteen sixteen rect pattern solo twiddle ALL = list NET NETSLIDE cube fifteen sixteen rect pattern solo twiddle
+ MINES samegame FLIP guess PEGS dominosa UNTANGLE blackbox SLANT + MINES samegame FLIP guess PEGS dominosa UNTANGLE blackbox SLANT
+ LIGHTUP MAP LOOPY inertia TENTS + LIGHTUP MAP LOOPY inertia TENTS BRIDGES
GTK = gtk printing ps GTK = gtk printing ps
@ -57,6 +58,7 @@ map : [X] GTK COMMON MAP
loopy : [X] GTK COMMON LOOPY loopy : [X] GTK COMMON LOOPY
inertia : [X] GTK COMMON inertia inertia : [X] GTK COMMON inertia
tents : [X] GTK COMMON TENTS tents : [X] GTK COMMON TENTS
bridges : [X] GTK COMMON BRIDGES
# Auxiliary command-line programs. # Auxiliary command-line programs.
STANDALONE = nullfe random misc malloc STANDALONE = nullfe random misc malloc
@ -102,6 +104,7 @@ map : [G] WINDOWS COMMON MAP
loopy : [G] WINDOWS COMMON LOOPY loopy : [G] WINDOWS COMMON LOOPY
inertia : [G] WINDOWS COMMON inertia inertia : [G] WINDOWS COMMON inertia
tents : [G] WINDOWS COMMON TENTS tents : [G] WINDOWS COMMON TENTS
bridges : [G] WINDOWS COMMON BRIDGES
# Mac OS X unified application containing all the puzzles. # Mac OS X unified application containing all the puzzles.
Puzzles : [MX] osx osx.icns osx-info.plist COMMON ALL Puzzles : [MX] osx osx.icns osx-info.plist COMMON ALL
@ -194,7 +197,7 @@ install:
for i in cube net netslide fifteen sixteen twiddle \ for i in cube net netslide fifteen sixteen twiddle \
pattern rect solo mines samegame flip guess \ pattern rect solo mines samegame flip guess \
pegs dominosa untangle blackbox slant lightup \ pegs dominosa untangle blackbox slant lightup \
map loopy inertia tents; do \ map loopy inertia tents bridges; do \
$(INSTALL_PROGRAM) -m 755 $$i $(DESTDIR)$(gamesdir)/$$i \ $(INSTALL_PROGRAM) -m 755 $$i $(DESTDIR)$(gamesdir)/$$i \
|| exit 1; \ || exit 1; \
done done

2674
bridges.c Normal file

File diff suppressed because it is too large Load Diff

2
list.c
View File

@ -18,6 +18,7 @@ echo -e '};\n\nconst int gamecount = lenof(gamelist);'
*/ */
extern const game blackbox; extern const game blackbox;
extern const game bridges;
extern const game cube; extern const game cube;
extern const game dominosa; extern const game dominosa;
extern const game fifteen; extern const game fifteen;
@ -43,6 +44,7 @@ extern const game untangle;
const game *gamelist[] = { const game *gamelist[] = {
&blackbox, &blackbox,
&bridges,
&cube, &cube,
&dominosa, &dominosa,
&fifteen, &fifteen,

View File

@ -1859,6 +1859,135 @@ puzzles require more complex deductions, but at present none of the
available difficulty levels requires guesswork or backtracking. available difficulty levels requires guesswork or backtracking.
\C{bridges} \i{Bridges}
\cfg{winhelp-topic}{games.bridges}
You have a set of islands distributed across the playing area. Each
island contains a number. Your aim is to connect the islands
together with bridges, in such a way that:
\b Bridges run horizontally or vertically.
\b The number of bridges terminating at any island is equal to the
number written in that island.
\b Two bridges may run in parallel between the same two islands, but
no more than two may do so.
\b No bridge crosses another bridge.
\b All the islands are connected together.
There are some configurable alternative modes, which involve
changing the parallel-bridge limit to something other than 2, and
introducing the additional constraint that no sequence of bridges
may form a loop from one island back to the same island. The rules
stated above are the default ones.
Credit for this puzzle goes to \i{Nikoli} \k{nikoli-bridges}.
Bridges was contributed to this collection by James Harvey.
\B{nikoli-bridges}
\W{http://www.nikoli.co.jp/puzzles/14/index-e.htm}\cw{http://www.nikoli.co.jp/puzzles/14/index-e.htm}
\H{bridges-controls} \i{Bridges controls}
\IM{Bridges controls} controls, for Bridges
To place a bridge between two islands, click the mouse down on one
island and drag it towards the other. You do not need to drag all
the way to the other island; you only need to move the mouse far
enough for the intended bridge direction to be unambiguous. (So you
can keep the mouse near the starting island and conveniently throw
bridges out from it in many directions.)
Doing this again when a bridge is already present will add another
parallel bridge. If there are already as many bridges between the
two islands as permitted by the current game rules (i.e. two by
default), the same dragging action will remove all of them.
If you want to remind yourself that two islands definitely \e{do
not} have a bridge between them, you can right-drag between them in
the same way to draw a \q{non-bridge} marker.
If you think you have finished with an island (i.e. you have placed
all its bridges and are confident that they are in the right
places), you can mark the island as finished by left-clicking on it.
This will highlight it and all the bridges connected to it, and you
will be prevented from accidentally modifying any of those bridges
in future. Left-clicking again on a highlighted island will unmark
it and restore your ability to modify it.
Violations of the puzzle rules will be marked in red:
\b An island with too many bridges will be highlighted in red.
\b An island with too few bridges will be highlighted in red if it
is definitely an error (as opposed to merely not being finished
yet): if adding enough bridges would involve having to cross another
bridge or remove a non-bridge marker, or if the island has been
highlighted as complete.
\b A group of islands and bridges may be highlighted in red if it is
a closed subset of the puzzle with no way to connect it to the rest
of the islands. For example, if you directly connect two 1s together
with a bridge and they are not the only two islands on the grid,
they will light up red to indicate that such a group cannot be
contained in any valid solution.
\b If you have selected the (non-default) option to disallow loops
in the solution, a group of bridges which forms a loop will be
highlighted.
(All the actions described in \k{common-actions} are also available.)
\H{bridges-parameters} \I{parameters, for Bridges}Bridges parameters
These parameters are available from the \q{Custom...} option on the
\q{Type} menu.
\dt \e{Width}, \e{Height}
\dd Size of grid in squares.
\dt \e{Difficulty}
\dd Difficulty level of puzzle.
\dt \e{Allow loops}
\dd This is set by default. If cleared, puzzles will be generated in
such a way that they are always soluble without creating a loop, and
solutions which do involve a loop will be disallowed.
\dt \e{Max. bridges per direction}
\dd Maximum number of bridges in any particular direction. The
default is 2, but you can change it to 1, 3 or 4. In general, fewer
is easier.
\dt \e{%age of island squares}
\dd Gives a rough percentage of islands the generator will try and
lay before finishing the puzzle. Certain layouts will not manage to
lay enough islands; this is an upper bound.
\dt \e{Expansion factor (%age)}
\dd The grid generator works by picking an existing island at random
(after first creating an initial island somewhere). It then decides
on a direction (at random), and then works out how far it could
extend before creating another island. This parameter determines how
likely it is to extend as far as it can, rather than choosing
somewhere closer.
High expansion factors usually mean easier puzzles with fewer
possible islands; low expansion factors can create lots of
tightly-packed islands.
\A{licence} \I{MIT licence}\ii{Licence} \A{licence} \I{MIT licence}\ii{Licence}
This software is \i{copyright} 2004-2005 Simon Tatham. This software is \i{copyright} 2004-2005 Simon Tatham.