simon-git: puzzles (main): Ben Harris

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Sun Jun 11 16:24:08 BST 2023


TL;DR:
  a9af3fd Rename UI_UPDATE as MOVE_UI_UPDATE
  a943f31 Add MOVE_NO_EFFECT and MOVE_UNUSED return values from interpret_move()
  87e98e6 Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Mines
  1547154 Expose the NO_EFFECT/UNUSED distinction through midend_process_key()
  19b3bfc Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Slant

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-06-11 16:24:08

commit a9af3fda1d784c42d486a019a0a4e947f762af70
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=a9af3fda1d784c42d486a019a0a4e947f762af70;hp=b08c13f5f47a8541961fc150142523b061d3d9c6
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sun Jun 4 18:42:58 2023 +0100

    Rename UI_UPDATE as MOVE_UI_UPDATE
    
    All the other constants named UI_* are special key names that can be
    passed to midend_process_key(), but UI_UPDATE is a special return value
    from the back-end interpret_move() function instead.  This renaming
    makes the distinction clear and provides a naming convention for future
    special return values from interpret_move().

 blackbox.c         | 10 +++++-----
 bridges.c          | 24 ++++++++++++------------
 devel.but          |  6 +++---
 dominosa.c         |  4 ++--
 filling.c          | 18 +++++++++---------
 flip.c             |  4 ++--
 flood.c            |  8 ++++----
 galaxies.c         | 16 ++++++++--------
 guess.c            | 24 ++++++++++++------------
 keen.c             | 10 +++++-----
 lightup.c          |  2 +-
 magnets.c          |  6 +++---
 map.c              | 20 ++++++++++----------
 midend.c           |  4 ++--
 mines.c            | 12 ++++++------
 misc.c             |  2 +-
 mosaic.c           |  4 ++--
 net.c              |  4 ++--
 netslide.c         |  4 ++--
 palisade.c         |  2 +-
 pattern.c          | 12 ++++++------
 pearl.c            | 24 ++++++++++++------------
 pegs.c             | 20 ++++++++++----------
 puzzles.h          |  2 +-
 range.c            |  4 ++--
 rect.c             |  8 ++++----
 samegame.c         |  2 +-
 signpost.c         | 24 ++++++++++++------------
 singles.c          |  2 +-
 sixteen.c          | 10 +++++-----
 slant.c            |  4 ++--
 solo.c             | 10 +++++-----
 tents.c            | 12 ++++++------
 towers.c           | 10 +++++-----
 tracks.c           | 20 ++++++++++----------
 twiddle.c          |  4 ++--
 undead.c           | 32 ++++++++++++++++----------------
 unequal.c          | 14 +++++++-------
 unfinished/group.c | 20 ++++++++++----------
 unfinished/slide.c |  6 +++---
 unruly.c           |  2 +-
 untangle.c         |  6 +++---
 42 files changed, 216 insertions(+), 216 deletions(-)

commit a943f3177f4adc591a282bdc62eef80675dc2a67
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=a943f3177f4adc591a282bdc62eef80675dc2a67;hp=a9af3fda1d784c42d486a019a0a4e947f762af70
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sun Jun 4 19:02:21 2023 +0100

    Add MOVE_NO_EFFECT and MOVE_UNUSED return values from interpret_move()
    
    These allow for distinguishing the case where a puzzle doesn't have a
    use for a key from the case where it just happens to have no effect in
    the current state of the puzzle.  These were both represented by NULL,
    but that now represents the case where a puzzle hasn't been updated to
    make the distinction yet.

 devel.but | 16 +++++++++++-----
 midend.c  |  4 +++-
 misc.c    |  2 ++
 puzzles.h | 18 +++++++++++++-----
 4 files changed, 29 insertions(+), 11 deletions(-)

commit 87e98e67158326a7dd94fd8fa255e3695898ecf3
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=87e98e67158326a7dd94fd8fa255e3695898ecf3;hp=a943f3177f4adc591a282bdc62eef80675dc2a67
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Jun 5 22:56:11 2023 +0100

    Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Mines

 mines.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

commit 1547154efbfcf0bd8f6fc4f91fe99c26371fe0ee
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=1547154efbfcf0bd8f6fc4f91fe99c26371fe0ee;hp=87e98e67158326a7dd94fd8fa255e3695898ecf3
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Jun 7 23:03:30 2023 +0100

    Expose the NO_EFFECT/UNUSED distinction through midend_process_key()
    
    This removed the "handled" pointer and instead extends the existing
    boolean return value (quit or don't quit) into an enumeration.  One of
    the values still quits the program, but now there are different values
    for keys that had an effect, had no effect, and are not used by the
    puzzle at all.  The mapping from interpret_move results to process_key
    results is roughly:
    
    move string    -> PKR_SOME_EFFECT
    MOVE_UI_UPDATE -> PKR_SOME_EFFECT
    MOVE_NO_EFFECT -> PKR_NO_EFFECT
    MOVE_UNUSED    -> PKR_UNUSED
    
    The mid-end can also generate results internally, and is the only place
    that PKR_QUIT can arise.
    
    For compatibility, PKR_QUIT is zero, so anything expecting a false
    return value to mean quit will be unsurprised.  The other values are
    ordered so that lower values indicate a greater amount of handling of
    the key.

 devel.but  | 38 +++++++++++++++++++++++++++-----------
 emcc.c     | 25 ++++++++++++++++---------
 gtk.c      | 14 +++++++-------
 midend.c   | 38 ++++++++++++++++++++------------------
 nestedvm.c | 10 +++++-----
 osx.m      |  4 ++--
 puzzles.h  |  3 ++-
 windows.c  | 36 ++++++++++++++++++------------------
 8 files changed, 97 insertions(+), 71 deletions(-)

commit 19b3bfc0d387424d6318027a1c3ff4b3ac532f19
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=19b3bfc0d387424d6318027a1c3ff4b3ac532f19;hp=1547154efbfcf0bd8f6fc4f91fe99c26371fe0ee
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sat Jun 10 23:02:07 2023 +0100

    Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Slant

 slant.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)



More information about the tartarus-commits mailing list