simon-git: puzzles (main): Ben Harris
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Sat Feb 11 22:17:34 GMT 2023
TL;DR:
ec84b45 Mention how old the 15-puzzle is
c0b2f0f Check state is valid at the end of a move in Pearl
896a73b Cleanly reject more ill-formed solve moves in Flood
Repository: https://git.tartarus.org/simon/puzzles.git
On the web: https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer: Ben Harris <bjh21 at bjh21.me.uk>
Date: 2023-02-11 22:17:34
commit ec84b45ba4a48bd4b50c98fdeffa13f836842be7
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=ec84b45ba4a48bd4b50c98fdeffa13f836842be7;hp=ad2fb760fc881d1ceb1ac1151bf60b85deb16c71
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Feb 11 19:35:32 2023 +0000
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.
puzzles.but | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
commit c0b2f0fc98e87392dcb4dd8faf3076786fc49367
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=c0b2f0fc98e87392dcb4dd8faf3076786fc49367;hp=ec84b45ba4a48bd4b50c98fdeffa13f836842be7
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Feb 11 21:22:49 2023 +0000
Check state is valid at the end of a move in Pearl
A Pearl move string contains a sequence of sub-moves, each of which
can affect the state of the connection between the centre of a square
and one of its edges. interpret_move() generates these in pairs so
that the two halves of a connection between the centres of adjacent
squares stay in the same state.
If, however, a save file contains mismatched half-moves,
execute_move() should ideally return NULL rather than causing an
assertion failure. This has to be checked at the end of the whole
move string, so I've arranged for check_completion() to return a
boolean indicating whether the current state (and hence the move
preceding it) is valid. It now returns 'false' when a connection
stops at a square boundary or when it goes off the board. These
conditions used to be assertion failures, and now they just cause the
move to be rejected.
This supersedes the check for off-board connections added in 15f4fa8,
since now check_completion() can check for off-board links for the
whole board at once.
This save file trivially demonstrates the problem, causing
"dsf_update_completion: Assertion `state->lines[bc] & F(dir)' failed"
without this fix:
SAVEFILE:41:Simon Tatham's Portable Puzzle Collection
GAME :5:Pearl
PARAMS :5:6x6t0
CPARAMS :5:6x6t0
DESC :17:BbBfWceBbWaBWWgWB
NSTATES :1:2
STATEPOS:1:2
MOVE :6:R1,0,0
pearl.c | 37 ++++++++++++++++++-------------------
1 file changed, 18 insertions(+), 19 deletions(-)
commit 896a73bd7ff8cbde44e97d89cef57346478f0072
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=896a73bd7ff8cbde44e97d89cef57346478f0072;hp=c0b2f0fc98e87392dcb4dd8faf3076786fc49367
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Feb 11 22:00:49 2023 +0000
Cleanly reject more ill-formed solve moves in Flood
The fix in e4112b3 was incomplete: there was another assertion that could be failed by a save file with an ill-formed solve move. That now gets rejected properly. Here's an example save file to demonstrate the problem:
SAVEFILE:41:Simon Tatham's Portable Puzzle Collection
GAME :5:Flood
PARAMS :7:6x6c6m0
CPARAMS :7:6x6c6m0
DESC :39:000000000000000000000000000000000000,00
NSTATES :1:2
STATEPOS:1:2
MOVE :1:S
flood.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
More information about the tartarus-commits
mailing list