simon-git: puzzles (main): Ben Harris

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Wed Aug 9 19:46:23 BST 2023


TL;DR:
  7ada9a5 Guess: define constants for flags OR'ed into peg colours
  5ec86c0 move_cursor(): handle visible flag; return useful value
  8c768e7 Use move_cursor() for cursor movement in Guess
  785de41 Appropriately generate MOVE_NO_EFFECT from '\b' in Guess
  7e9228f Use move_cursor() for cursor movement in Same Game
  e6d25d7 Dominosa: use new move_cursor() features
  e30d11e Light Up: use new move_cursor() features
  503f1c4 Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Light Up

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-08-09 19:46:23

commit 7ada9a5742dd4766cc42909ac01bbb2505f74e47
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=7ada9a5742dd4766cc42909ac01bbb2505f74e47;hp=78af0c821aa01f9e4a127b5b5f197fd1c8a22686
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Aug 9 00:14:37 2023 +0100

    Guess: define constants for flags OR'ed into peg colours

 guess.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

commit 5ec86c03a8bc911bb3dbd77fb7c827eeca975594
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=5ec86c03a8bc911bb3dbd77fb7c827eeca975594;hp=7ada9a5742dd4766cc42909ac01bbb2505f74e47
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Aug 9 09:43:04 2023 +0100

    move_cursor(): handle visible flag; return useful value
    
    This adds an extra parameter to move_cursor() that's an optional pointer
    to a bool indicating whether the cursor is visible.  This allows for
    centralising the common idiom of having the keyboard cursor become
    visible when a cursor key is pressed.  Consistently with the vast
    majority of existing puzzles, the cursor moves even if it was invisible
    before, and becomes visible even if it can't move.
    
    The function now also returns one of the special constants that can be
    returned by interpret_move(), so that the caller can correctly return
    MOVE_UI_UPDATE or MOVE_NO_EFFECT without needing to carefully check for
    changes itself.
    
    Callers are updated only to the extent that they all pass NULL as the
    new argument.  Most of them could now be substantially simplified.

 blackbox.c         |  2 +-
 bridges.c          |  2 +-
 devel.but          | 13 +++++++++++--
 dominosa.c         |  2 +-
 fifteen.c          |  2 +-
 filling.c          |  2 +-
 galaxies.c         |  3 ++-
 keen.c             |  2 +-
 lightup.c          |  3 ++-
 magnets.c          |  3 ++-
 map.c              |  2 +-
 mines.c            |  3 ++-
 misc.c             | 14 +++++++++++---
 mosaic.c           |  2 +-
 palisade.c         |  4 ++--
 pattern.c          |  3 ++-
 pearl.c            |  4 ++--
 pegs.c             |  2 +-
 puzzles.h          |  3 ++-
 rect.c             |  3 ++-
 signpost.c         |  2 +-
 singles.c          |  2 +-
 sixteen.c          |  6 +++---
 slant.c            |  2 +-
 solo.c             |  2 +-
 tents.c            |  4 ++--
 towers.c           |  2 +-
 unequal.c          |  5 +++--
 unfinished/group.c |  2 +-
 unruly.c           |  2 +-
 30 files changed, 64 insertions(+), 39 deletions(-)

commit 8c768e7444707b1985788d610e8f14148bc36ab6
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=8c768e7444707b1985788d610e8f14148bc36ab6;hp=5ec86c03a8bc911bb3dbd77fb7c827eeca975594
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Aug 9 11:30:24 2023 +0100

    Use move_cursor() for cursor movement in Guess
    
    This makes interpret_move() properly return MOVE_NO_EFFECT when the
    cursor can't move, and simplifies the code as well.

 guess.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

commit 785de41a92dcd45a71c322bafa8af737bb1eb7aa
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=785de41a92dcd45a71c322bafa8af737bb1eb7aa;hp=8c768e7444707b1985788d610e8f14148bc36ab6
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Aug 9 11:42:51 2023 +0100

    Appropriately generate MOVE_NO_EFFECT from '\b' in Guess
    
    This is the case that I care about for KaiOS.

 guess.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

commit 7e9228f15472ed1d9a691ac9b41ae52436e10cdf
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=7e9228f15472ed1d9a691ac9b41ae52436e10cdf;hp=785de41a92dcd45a71c322bafa8af737bb1eb7aa
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Aug 9 14:32:31 2023 +0100

    Use move_cursor() for cursor movement in Same Game
    
    No significant behavioural change.

 samegame.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

commit e6d25d75baba5f3bb92ebbbc5dbba10434f4dc4f
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=e6d25d75baba5f3bb92ebbbc5dbba10434f4dc4f;hp=7e9228f15472ed1d9a691ac9b41ae52436e10cdf
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Aug 9 15:41:55 2023 +0100

    Dominosa: use new move_cursor() features

 dominosa.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

commit e30d11ecd169c2e963fada4cac28123b4f4f9a7e
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=e30d11ecd169c2e963fada4cac28123b4f4f9a7e;hp=e6d25d75baba5f3bb92ebbbc5dbba10434f4dc4f
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Aug 9 15:48:14 2023 +0100

    Light Up: use new move_cursor() features

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

commit 503f1c4ab81928c2792a2cf73bc97587460dac86
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=503f1c4ab81928c2792a2cf73bc97587460dac86;hp=e30d11ecd169c2e963fada4cac28123b4f4f9a7e
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Aug 9 15:58:34 2023 +0100

    Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Light Up
    
    Light Up is unusual in that clicking outside the grid hides the
    cursor, so the return value from clicks outside the grid is
    MOVE_NO_EFFECT or MOVE_UI_UPDATE rather than the more usual
    MOVE_UNUSED.

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



More information about the tartarus-commits mailing list