simon-git: puzzles (main): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Wed Sep 3 06:50:08 BST 2025
TL;DR:
d925c6d slantsolver: fix minor memory leaks.
4adeea1 slant: refactor fill_square().
eaded11 slant: make fill_square() fallible.
2376227 Filling: make Backspace clear the selected grid squares.
Repository: https://git.tartarus.org/simon/puzzles.git
On the web: https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer: Simon Tatham <anakin at pobox.com>
Date: 2025-09-03 06:50:08
commit d925c6da7a62acdd5c6b122af904b712a3310f37
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=d925c6da7a62acdd5c6b122af904b712a3310f37;hp=a7c7826bce5cbb9b9c337c11b9b7f8b278e76fba
Author: Simon Tatham <anakin at pobox.com>
Date: Thu Aug 21 18:20:30 2025 +0100
slantsolver: fix minor memory leaks.
Unimportant, since the program is about to exit anyway, but causes
Leak Sanitiser to complain at length and scroll the more useful output
off the top of the window.
slant.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
commit 4adeea1e92cd36d99bdd49bafe219793f6a3a2e8
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=4adeea1e92cd36d99bdd49bafe219793f6a3a2e8;hp=d925c6da7a62acdd5c6b122af904b712a3310f37
Author: Simon Tatham <anakin at pobox.com>
Date: Wed Sep 3 06:18:44 2025 +0100
slant: refactor fill_square().
No functional change. I've just separated the calculation of which
vertices of the square are which, from the code that does something
with them. Removes a tiny amount of code duplication, but the main
point is to put code in between that reuses the vertex indices.
slant.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
commit eaded1109b22dc0840c5a9e4370f27b386a49c45
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=eaded1109b22dc0840c5a9e4370f27b386a49c45;hp=4adeea1e92cd36d99bdd49bafe219793f6a3a2e8
Author: Simon Tatham <anakin at pobox.com>
Date: Wed Sep 3 06:32:45 2025 +0100
slant: make fill_square() fallible.
Donald Hobson reported that the game id 2x2:020c0a0, which has no
legal solution, would be 'solved' uncomplainingly, by returning a
solution containing a loop. This happened because the final edge of
the loop was filled in from the vertex clues, without checking to see
if it _also_ violated the loop constraint.
Now fill_square() checks whether that's happened, and returns a
boolean to indicate failure. Every call site checks that return value,
and declares the puzzle inconsistent if it failed. So this kind of
situation, where neither state of a square is valid but for completely
different reasons, should now be detected.
(See also commit f21d3e4c74b2338, which fixed a similar kind of bug in
Group: if the final grid square was filled in by a general latin.c
deduction, but introduced a violation of the Group-specific
constraints at the last moment, that violation wouldn't be detected
and the non-solution would be considered acceptable. In that case it
could happen during backtracking search, leading to a puzzle being
reported as ambiguous.)
While I'm here, I also double-check the case where fill_square is
called a second time on an already filled square. It still returns
success if the square is being filled with the same contents as
before, but now it returns failure if the caller is trying to
contradict the square's existing contents. I have no example in which
this happens, but it seemed like a worthwhile precaution while I was
there anyway.
slant.c | 45 ++++++++++++++++++++++++++++++++++-----------
1 file changed, 34 insertions(+), 11 deletions(-)
commit 2376227855422b01ed36a1c9fa83739fce96053d
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=2376227855422b01ed36a1c9fa83739fce96053d;hp=eaded1109b22dc0840c5a9e4370f27b386a49c45
Author: Simon Tatham <anakin at pobox.com>
Date: Wed Sep 3 06:43:02 2025 +0100
Filling: make Backspace clear the selected grid squares.
A user pointed out that it currently has the same behaviour as Esc: it
just _deselects_ the selected squares, without changing their
contents. That seems inconsistent with its use in most of the other
'click to select a square and then type something to put in it' user
interfaces in this collection, like Solo, Keen, Towers, ... in which
generally selecting a square and pressing Backspace clears whatever
the user had previously written in that square.
This behaviour was introduced in commit c469bd285cc4f48, ten years
ago, at the same time as introducing the general keyboard-only
control. It seems to have been semi-deliberate: the patch documented
the new behaviour, but didn't notice that it contradicted the existing
behaviour (also documented, in the previous paragraph) of Backspace
clearing a single cell you'd just clicked in.
filling.c | 4 +++-
puzzles.but | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
More information about the tartarus-commits
mailing list