simon-git: puzzles (main): Ben Harris

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Mon Jan 2 18:30:23 GMT 2023


TL;DR:
  23c9e0a Pattern: Clip clues to their proper rectangles
  1ef9aa4 Pattern: Pack clues for each row more closely together
  44b5291 Adjust font size of Pattern clues based on the numbers
  d246077 Add a macro of an upper bound on the formatted length of an integer
  a2212e8 Use a dynamically-sized buffer for Pattern row clues
  2537961 Update devel.but commit ID

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-01-02 18:30:23

commit 23c9e0a8b2ca587b093cb8f63d73a6632be6cf98
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=23c9e0a8b2ca587b093cb8f63d73a6632be6cf98;hp=14c025d192579961d1ade51f2a322bd765aef0e5
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Thu Dec 29 00:07:55 2022 +0000

    Pattern: Clip clues to their proper rectangles
    
    Since the drawing API offers no guarantees about where text drawing
    might have effects, it's unsafe to erase text other than by wiping the
    clipping rectangle that was in effect when it was drawn.  In practice,
    this means that all variable (including colour) text should be drawn
    with a narrow clipping rectangle.
    
    It wasn't actually a practical problem that Pattern didn't clip its
    clues, but I'll like to make its fonts less tiny, which will make it
    more likely to need clipping in odd cases.
    
    This also factors out some repeated computations in draw_numbers().

 pattern.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

commit 1ef9aa4cc26b60d63f134d5f7a3ff9331f8a8b50
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=1ef9aa4cc26b60d63f134d5f7a3ff9331f8a8b50;hp=23c9e0a8b2ca587b093cb8f63d73a6632be6cf98
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Thu Dec 29 00:35:02 2022 +0000

    Pattern: Pack clues for each row more closely together
    
    Rather than centring each clue in an imaginary box, put equal amounts of
    space between them (using space characters) and then right-align the
    whole string.  This makes for more efficient use of space, and I think
    it also looks better when there are two-digit clues.
    
    This does introduce a rather grotty (if large) fixed-size buffer for row
    clues.  Probably the row clues should be pre-formatted into a string
    when the puzzle is set up.

 pattern.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

commit 44b5291b48e77810a096933d0b6f8dae5a17300c
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=44b5291b48e77810a096933d0b6f8dae5a17300c;hp=1ef9aa4cc26b60d63f134d5f7a3ff9331f8a8b50
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sun Jan 1 14:07:59 2023 +0000

    Adjust font size of Pattern clues based on the numbers
    
    If all the column clues are single digits, then the font can be larger
    without adjacent clues getting too close to each other.  I've also
    slightly increased the font size even with two-digit clues, from
    TILE_SIZE/2 to TILE_SIZE/1.8.

 pattern.c | 36 +++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)

commit d246077e78bb1aeafe8829927db23f281cd03c72
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=d246077e78bb1aeafe8829927db23f281cd03c72;hp=44b5291b48e77810a096933d0b6f8dae5a17300c
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Jan 2 16:48:20 2023 +0000

    Add a macro of an upper bound on the formatted length of an integer
    
    There are lots of places where Puzzles formats integers into
    fixed-length buffers using sprintf() with a "%d" format.  This isn't
    very safe, since C doesn't guarantee any particular maximum size for an
    "int".  However, the restrictions on representations of integers means
    we can infer an upper bound using sizeof(), CHAR_BIT, and an
    approximation to the binary log of 10.

 devel.but | 11 +++++++++++
 puzzles.h |  3 +++
 2 files changed, 14 insertions(+)

commit a2212e82aa2f4b9a4ee22783d6fed2761c213432
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=a2212e82aa2f4b9a4ee22783d6fed2761c213432;hp=d246077e78bb1aeafe8829927db23f281cd03c72
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Jan 2 17:44:04 2023 +0000

    Use a dynamically-sized buffer for Pattern row clues

 pattern.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

commit 2537961b6f84ce0268510f844f119bdb012ca282
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=2537961b6f84ce0268510f844f119bdb012ca282;hp=a2212e82aa2f4b9a4ee22783d6fed2761c213432
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Jan 2 18:28:39 2023 +0000

    Update devel.but commit ID

 devel.but | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



More information about the tartarus-commits mailing list