simon-git: puzzles (main): Ben Harris
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Wed Feb 1 20:36:45 GMT 2023
TL;DR:
1736445 Mines: forbid moves that flag or unflag an exposed square
2a9be2b Mines: Don't check if the player has won if they've already lost
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-01 20:36:45
commit 17364455186ae61e015d0f0de3f09423f78d0727
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=17364455186ae61e015d0f0de3f09423f78d0727;hp=37df1f2bbc689d224369d963dd8007d68fcd7c6a
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Wed Feb 1 17:07:12 2023 +0000
Mines: forbid moves that flag or unflag an exposed square
interpret_move() couldn't generate them, but execute_move() also needs
to forbid them to defend against corrupt save files. I don't think this
actually caused any crashes, but it did cause unexpected "1" squares not
adjacent to mines.
mines.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
commit 2a9be2b89df3e6a07a1d90a06f8ac00a92d789e5
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=2a9be2b89df3e6a07a1d90a06f8ac00a92d789e5;hp=17364455186ae61e015d0f0de3f09423f78d0727
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Wed Feb 1 20:12:29 2023 +0000
Mines: Don't check if the player has won if they've already lost
It can't happen in normal play, but if a save file had a "C" (clear
around) move that set off a mine, Mines could end up hitting an
assertion failure, "ncovered >= nmines". This was because it would
check if the player had won by counting covered squares and mines, and
of course an uncovered mine is no longer a covered square but is still a
mine.
Since winning after you're dead isn't possible (at least in Mines), we
now skip the check entirely if the player has already died.
This save file demonstrates the problem:
SAVEFILE:41:Simon Tatham's Portable Puzzle Collection
GAME :5:Mines
PARAMS :1:7
CPARAMS :1:7
DESC :22:r31,u,0000C000d0000020
NSTATES :1:2
STATEPOS:1:1
MOVE :4:C6,2
mines.c | 2 ++
1 file changed, 2 insertions(+)
More information about the tartarus-commits
mailing list