207 Commits

Author SHA1 Message Date
c8cc4a5f38 Add user preference for Bridges' "G" key (show_hints)
I missed this in my previous addition of preferences for UI controls
(4227ac1fd5dc25c247e7526526079b85e1890766) because it wasn't documented.
Now it is documented and it has a preference.

I've phrased it as showing possible bridge locations, which doesn't
really make clear that "possible" relates only to the locations of
islands and not to anything already placed.  Improvements welcome!
2023-06-26 23:22:54 +01:00
4227ac1fd5 Add preferences for existing UI style controls
Some puzzles have keys that make changes to the display style in ways
that would probably have been user preferences if they had existed.
I've added a user preference for each of these.  The keys still work,
and unlike the preferences can be changed without saving any state.

The affected settings are:
 * Labelling colours with numbers in Guess ("L" key)
 * Labelling regions with numbers in Map ("L" key)
 * Whether monsters are shown as letters or pictures in Undead ("A" key)
2023-05-30 19:57:15 +02:00
43db4aa38e Support user preferences in the Emscripten frontend.
Here, user preferences are stored in localStorage, so that they can
persist when you come back to the same puzzle page later.

localStorage is global across a whole web server, which means we need
to take care to put our uses of it in a namespace reasonably unlikely
to collide with unrelated web pages on the same server. Ben suggested
that a good way to do this would be to store things in localStorage
under keys derived from location.pathname. In this case I've appended
a fragment id "#preferences" to that, so that space alongside it
remains for storing other things we might want in future (such as
serialised saved-game files used as quick-save slots).

When loading preferences, I've chosen to pass the whole serialised
preferences buffer from Javascript to C as a single C string argument
to a callback, rather than reusing the existing system for C to read
the save file a chunk at a time. Partly that's because preferences
data is bounded in size whereas saved games can keep growing; also
it's because the way I'm storing preferences data means it will be a
UTF-8 string, and I didn't fancy trying to figure out byte offsets in
the data on the JS side.

I think at this point I should stop keeping a list in the docs of
which frontends support preferences. Most of the in-tree ones do now,
and that means the remaining interesting frontends are ones I don't
have a full list of. At this moment I guess no out-of-tree frontends
support preferences (unless someone is _very_ quick off the mark), but
as and when that changes, I won't necessarily know, and don't want to
have to keep updating the docs when I find out.
2023-04-24 10:17:33 +01:00
bf453043db Support user preferences in the Mac frontend.
The low-level load and save routines are basically copy-pasted from
gtk.c, with only minor changes to deal with the different locally
appropriate config file location and the lack of savefile_write_ctx.
2023-04-24 08:49:43 +01:00
1fa28340e8 Support user preferences on Windows.
This is done using basically the same methods as on Unix, and just
translating the system calls in save_prefs to a different API.
2023-04-23 14:54:29 +01:00
5c0def1850 Document the new Net preference.
Naturally, I only remembered to do this after 'git push'.
2023-04-23 14:16:17 +01:00
e2add4185c GTK: add a command-line --delete-prefs option.
If you want to remove your saved preferences for a puzzle for any
reason (perhaps because of one of those unsympathetic managers, or
perhaps because it's become corrupted in some way), you can of course
manually go and find the config file and delete it. But if you're not
sure where it is, it's helpful to have a method of telling the puzzle
itself to delete the config file.

Perhaps it would be useful to expose this in the GUI as well, though
I'm not quite sure where is the best place to put it.

(_Perhaps_ it would also be useful to have a more thorough option that
deleted _all_ puzzles' configurations - although that would involve
telling every separate puzzle binary in this collection what all the
other ones' names are, which would be an entirely new build headache.)
2023-04-23 13:26:36 +01:00
6c66e2b2de Support preferences in the GTK frontend.
Finally, some user-visible behaviour changes as a payoff for all that
preparation work! In this commit, the GTK puzzles get a 'Preferences'
option in the menu, which presents a dialog box to configure the
preference settings.

On closing that dialog box, the puzzle preferences are enacted
immediately, and also saved to a configuration file where the next run
of the same puzzle will reload them.

The default file location is ~/.config/sgt-puzzles/<puzzlename>.conf,
although you can override the .config dir via $XDG_CONFIG_HOME or
override the Puzzles-specific subdir with $SGT_PUZZLES_DIR.

This is the first commit that actually exposes all the new preferences
work to the user, and therefore, I've also added documentation of all
the current preference options.
2023-04-23 13:26:36 +01:00
232cbaf5a8 Note in the documentation that Pattern clues are in order
Requested in Debian bug #642207 and seems perfectly reasonable.
2023-02-15 23:17:40 +00:00
c139aba078 Allow more general cross-shaped boards in Pegs
I found a plausible looking Web page claiming that various different
sizes of cross are soluble, and some of them are quite widespread.  I've
enabled the ones that are symmetric enough that the existing game
generator can lay them out.
2023-02-12 01:24:58 +00:00
ec84b45ba4 Mention how old the 15-puzzle is
For most puzzles, the manual tries to at least mention its origin.
Wikipedia suggests that the precise inventor of the 15-puzzle is a bit
uncertain, but US patent number 207124 definitely describes it in
1878, so "dates from the 1870s" seems pretty solid.
2023-02-11 19:35:32 +00:00
37df1f2bbc Document numeric input in Undead
I was able to guess what the keys were, but I think it's polite to
write it down for people with numeric-only keyboards.
2023-02-01 00:40:07 +00:00
806ae71ca4 Add myself to copyright holders and update copyright years
The KaiOS port is big enough that I think I'm worth mentioning, and it
was released in 2023.
2023-01-21 18:36:13 +00:00
171e7a76ed Correct credits information 2023-01-08 13:53:28 +00:00
09f2052fbf guess: Much more efficient keyboard interface
Now rather than mucking around with the cursor keys, you can just type a
four-digit number and press Enter.  Of course, if you still want to muck
around with the cursor keys they work the same as before.

Since Backspace was already assigned to clear the peg under the cursor,
I haven't co-opted it for the obvious action of clearing the peg to the
left of the cursor and moving the cursor left.  The left arrow key is a
reasonable alternative anyway.

For consistency, 'L' now labels the pegs with numbers rather than
letters, and is documented.
2022-12-07 00:43:45 +00:00
a8df0189ff guess: Correct documentation to not say Space places a peg
It sets a hold now, as is mentioned in the next sentence.
2022-12-07 00:38:17 +00:00
7e19d6f4b1 Document new new undo/redo keys 2022-11-16 09:27:40 +00:00
4feb5fdf0c Update Nikoli links and remove Flash warnings
Most of the old URLs don't work any more.  As far as I can see, the
new pages have no Flash, and even if they did very few browsers will
still support it.
2022-10-22 01:43:51 +01:00
640f9235c7 Pearl: document game options.
A user spotted that this docs section was missing all its useful
content.
2021-10-30 10:56:15 +01:00
2409a9913e Update copyright years.
They'd got quite out of date, oops.
2021-04-25 22:00:12 +01:00
c6a48bfc1c Docs: fix Mosaic copy-and-paste error. 2021-04-25 11:17:13 +01:00
0377184510 New puzzle: 'Mosaic'.
This is similar in concept to Minesweeper, in that each clue tells you
the number of things (in this case, just 'black squares') in the
surrounding 3x3 grid section.

But unlike Minesweeper, there's no separation between squares that can
contain clues, and squares that can contain the things you're looking
for - a clue square may or may not itself be coloured black, and if
so, its clue counts itself.

So there's also no hidden information: the clues can all be shown up
front, and the difficulty arises from the game generator choosing
which squares to provide clues for at all.

Contributed by a new author, Didi Kohen. Currently only has one
difficulty level, but harder ones would be possible to add later.
2021-04-25 09:59:15 +01:00
b443a84efe Add printing support for GTK.
Printing is only available in GTK versions >= 2.10. We can only embed
the page setup dialog on GTK >= 2.18, so on a GTK version less than
that, we must use a separate page setup dialog.

In GTK, printing is usually done one page at a time, so also modify
printing.c to allow printing of a single page at a time.

Create a separate drawing API for drawing to the screen and for
printing. Create a vtable for functions which need to be different
depending on whether they were called from the printing or drawing
API.

When a function is called from the printing API, it is passed a
separate instance of the frontend than if it were called from the
drawing API. In that instance of the frontend, an appropriate vtable
is available depending on whether it was called from the printing or
drawing API.

The low-level functions used for printing are enabled even if printing
is not enabled. This is in case we ever need to use them for something
other than printing with GTK. For example, using Cairo as a printing
backend when printing from the command line. Enabling the low-level
functions even when GTK printing is not available also allows them to
be compiled under as many build settings as possible, and thus lowers
the chance of undetected breakage.

Move the definition of ROOT2 from ps.c to puzzles.h so other files can
use it (gtk.c needs it for hatching).

Also add myself to the copyright list.

[Committer's note: by 'printing', this log message refers to the GTK
GUI printing system, which handles selecting a printer, printing to a
file, previewing and so on. The existing facility to generate
printable puzzles in Postscript form by running the GTK binaries in
command-line mode with the --print option is unaffected. -SGT]
2019-12-30 08:10:34 +00:00
0d77dfc415 Update the copyright holders list in puzzles.but.
Asher Gordon points out that when Michael Quevillon was added to the
LICENCE file in commit 8af0c2961, he didn't also make it in to the
copy of the same list in puzzles.but.
2019-12-28 09:07:17 +00:00
12cb1adc88 Galaxies: clarify wording of completion condition.
A user mailed me today having found it less than clear from the docs
that Galaxies will only accept a solution if the set of filled-in grid
edges consists of _exactly_ the ones that separate two distinct
regions, rather than consisting of _at least_ those and perhaps others
which neither break rotational symmetry or disconnect any region.
2018-04-17 18:30:48 +01:00
7bdfda8409 Switch to using Halibut's new direct .CHM generation.
This allows me to remove HTML Help Workshop completely from my build
dependencies, and good riddance!
2017-05-13 20:20:23 +01:00
cce13ed712 Switch chiark URLs to https. 2017-05-07 16:25:56 +01:00
5123b1bf68 Clarify the Black Box rules slightly.
Chris Boyle points out that two of the rules are implicitly intended
to be read as only applying if a previous rule hadn't already decided
what would happen, and suggested that since not all readers infer that
priority order, it would be better to explicitly make them mutually
exclusive so that there can be no confusion about which one applies.
2016-10-30 20:43:11 +00:00
7195ed8882 Update documentation links.
Where possible (mostly with the Nikoli links), they've been updated to their
modern locations.  At least one link had to become a Wayback Machine link;
I didn't bother making the floodit.appspot.com link a Wayback one because
there's no content there without the backing of Google App Engine.  There
are other implementations online nowadays, of course, but I didn't want to
change the meaning of the text if at all possible.  In addition, I added
Flash warnings for the Nikoli pages that now use Flash for instructions.
2016-02-14 08:47:23 +00:00
1d9d6cbf12 Rename the docs section for Rectangles.
The web page currently assumes it's called 'rect' rather than
'rectangles', because the web-page building script uses the first
field of each line of gamedesc.txt, same as the Unix binary name.
Rather than add another confusingly-almost-identical field to that
file, it's easier to just rename this one docs section to make the
assumption of equality hold.
2016-01-07 19:35:32 +00:00
fa64ed3e87 Fix a typo in the Black Box docs examples.
A letter offset by one from a ball on the edge should be an R, not an
H. Thanks to Kevin Buzzard for pointing out the error.
2016-01-07 19:35:32 +00:00
3234912f92 Tents: mark squares as non-tents with {Shift,Control}-cursor keys. 2015-10-21 22:34:12 +01:00
3448fe1b47 Use \q{} in place of literal quote marks in puzzles.but.
While checking over the Palisade docs for this sort of error, I
happened to notice that a few were already in the existing games'
documentation.
2015-10-18 17:53:28 +01:00
6860c65bb3 Add a new puzzle: Palisade. 2015-10-18 17:53:28 +01:00
f7eb186184 Expand keyboard input options in Bridges, for faster entry.
- Lay bridges (crosess) with Control-arrow (Shift-arrow)
- Jump (non-orthogonally) to nearby islands with number keys, a..f
- Mark islands as done with a single tap on the space bar
2015-10-18 11:03:16 +01:00
fcf573c672 Update Sixteen keyboard system for faster entry.
Pressing Ctrl-arrow or Shift-arrow on a tile now moves the row or
column under the tile. With Ctrl, the cursor moves as well so you can
keep making moves that affect the same tile; with Shift, the cursor
stays put so you can keep making moves that affect the same location.
2015-10-18 10:59:50 +01:00
ef5c017a5f Add hinting feature to Guess.
Pressing H now suggests the lexicographically first row consistent
with all previous feedback.

The previous function of the H key to toggle a hold marker on the
current peg is now performed by Space / CURSOR_SELECT2, which is more
in line with other puzzles anyway.
2015-10-14 21:21:27 +01:00
12fabc4add Add hinting feature to Fifteen (press 'h' for a hint).
This is really an incremental solver. It alternates between solving
rows and solving columns. Each row and column is solved one piece at
a time. Except for some temporary trickery with the last two pieces
in a row or column, once a piece is solved it is never moved again.

(On non-square grids it first solves some rows or some columns until
the unsolved part is a square, then starts alternating.)
2015-10-14 20:29:32 +01:00
21b8323b2f Dominosa: Highlight a number when pressed on the keyboard. 2015-10-03 18:16:01 +01:00
47bc27b0c2 Add 'Inshi No Heya' (multiplication only) variant to Keen. 2015-10-03 17:12:20 +01:00
b9dfef7a12 Recompute solutions in Inertia if the user strays from the path. 2015-10-03 17:12:20 +01:00
79fe68dc57 Towers: allow marking of clues as done with the keyboard 2015-10-03 17:12:20 +01:00
6179e8df56 Allow marking of clues as exhausted in Unequal. 2015-10-03 17:12:20 +01:00
ea8da331e3 Cancel dragging in Pearl by pressing Escape or Backspace. 2015-10-03 16:59:10 +01:00
bf8ff09a84 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.
2015-10-03 16:59:04 +01:00
11a394f69b Add more keyboard controls to Slant. 2015-10-03 16:59:04 +01:00
e59f820383 Rectangles: cancel keyboard drag with Escape. 2015-10-03 16:59:04 +01:00
c469bd285c Filling: enable keyboard-driven cursor dragging mode. 2015-10-03 16:59:04 +01:00
d5f7c4f871 Range: add pencil marks to squares by Shift-cursor keys. 2015-10-03 16:58:50 +01:00
7478275c8b Pattern: color multiple squares with Ctrl- or Shift-cursor keys. 2015-10-03 16:58:24 +01:00