simon-git: puzzles (main): Ben Harris

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Sun Aug 6 20:02:13 BST 2023


TL;DR:
  ff86036 Same Game: level-triggered keyboard cursor hiding
  6d4b20c Pearl: re-use a single grid structure when generating

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-06 20:02:13

commit ff860360c3eb6b146674384a15d10fde788bd545
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=ff860360c3eb6b146674384a15d10fde788bd545;hp=0dd01866627e82ea21ed0e85021abdb070e0159c
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Tue Aug 1 23:07:08 2023 +0100

    Same Game: level-triggered keyboard cursor hiding
    
    Same Game doesn't want to show the keyboard cursor when the game is in a
    state where no move is possible.  Previously, it did this by having
    game_changed_state() hide the cursor on entry to such a state.  That
    meant that reaching a dead end and undoing out of it hid the cursor,
    which was confusing.
    
    Now the cursor is hidden in game_redraw() if the game is in a dead-end
    state without changing the displaysel flag in the game_ui.  That way, if
    you undo out of a dead end, the cursor becomes visible again if it was
    visible before.
    
    This does mean that you can move the cursor in a dead-end state without
    being able to see where it's going.  I think that's tolerable, but maybe
    the cursor keys should be disabled in that state as well.

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

commit 6d4b20c413811a9f88e5be97128b7dd6445bff08
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=6d4b20c413811a9f88e5be97128b7dd6445bff08;hp=ff860360c3eb6b146674384a15d10fde788bd545
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sun Aug 6 13:30:38 2023 +0100

    Pearl: re-use a single grid structure when generating
    
    Pearl generally has to generate quite a lot of candidate loops before
    it can find one that makes a viable puzzle.  Before this change it
    generated a new grid structure for each of those candidate loops.  The
    result was that grid_new() accounted for over 5% of the
    puzzle-generation time.
    
    Pulling grid_new() out of the loop-generation loop makes "pearl
    --generate 100 8x8dt#0" about 6% faster on my laptop, while producing
    precisely the same output.  Most of this change is just renaming the
    "grid" variable in new_clues() so it doesn't collide with the typedef
    of the same name.

 pearl.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)



More information about the tartarus-commits mailing list