simon-git: puzzles (main): Ben Harris

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Thu Feb 2 23:13:58 GMT 2023


TL;DR:
  ed682bd Tighten validation of Tents game descriptions
  294a3ac Dominosa: require the two halves of a domino to be adjacent
  15f4fa8 Forbid lines off the grid in Pearl

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-02 23:13:58

commit ed682bd5c608156d12ebaa2d84c4ce2e2877c10a
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=ed682bd5c608156d12ebaa2d84c4ce2e2877c10a;hp=ed0e4c304bed990948541fc0cf87309d75653806
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Thu Feb 2 21:58:10 2023 +0000

    Tighten validation of Tents game descriptions
    
    Specifically, TENT and NONTENT markers ('!' and '-') cannot appear as
    the first or last character of a description, because that would
    attempt to place them on squares outside the grid.  This was caught by
    assertions in new_game(), as can be demonstrated by feeding these
    descriptions to older versions of Tents: "4:-p,0,0,0,0,0,0,0,0"
    ("new_game: Assertion `i >= 0 && i <= w*h' failed.") and
    4:p-,0,0,0,0,0,0,0,0 ("new_game: Assertion `*desc == ','' failed.").

 tents.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

commit 294a3ac6e703c2820ceb7b28a1a5492b61e9a531
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=294a3ac6e703c2820ceb7b28a1a5492b61e9a531;hp=ed682bd5c608156d12ebaa2d84c4ce2e2877c10a
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Thu Feb 2 22:26:24 2023 +0000

    Dominosa: require the two halves of a domino to be adjacent
    
    Also that a line indicating no domino be between adjacent squares.
    Without this, execute_move would allow you to place dominos and edges
    between any pair ot squares, and then generate assertion failures
    ("execute_move: Assertion `d2 - w >= 0' failed." and "execute_move:
    Assertion `d1 - w >= 0' failed.") when a domino was placed over an
    invalid edge.  This example save file demonstrates the problem:
    
    SAVEFILE:41:Simon Tatham's Portable Puzzle Collection
    GAME    :8:Dominosa
    PARAMS  :1:6
    CPARAMS :1:6
    DESC    :56:55521461210004364611033535444421636022603153156422620503
    NSTATES :1:3
    STATEPOS:1:3
    MOVE    :4:E0,2
    MOVE    :4:D0,2

 dominosa.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

commit 15f4fa851a5781cf77984a6046405ffa758e7b33
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=15f4fa851a5781cf77984a6046405ffa758e7b33;hp=294a3ac6e703c2820ceb7b28a1a5492b61e9a531
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Thu Feb 2 23:09:19 2023 +0000

    Forbid lines off the grid in Pearl
    
    While they couldn't be generated in normal play, execute_move() would
    permit lines and marks across the edge of the grid that would then
    generate assertion failures ("dsf_update_completion: Assertion
    `INGRID(state, bx, by)' failed.").
    
    I've added a check to execute_move() that after updating a square, the
    square doesn't have any lines or marks that leave the grid.
    
    This save file demonstrated the problem:
    
    SAVEFILE:41:Simon Tatham's Portable Puzzle Collection
    VERSZON :1:1
    GAME    :5:Pearl
    PARAMS  :5:5x6dt
    CPARAMS :5:5x6dt
    DESC    :6:eeeeee
    NSTATES :1:2
    STATEPOS:1:1
    MOVE    :6:F1,4,2

 pearl.c | 10 ++++++++++
 1 file changed, 10 insertions(+)



More information about the tartarus-commits mailing list