simon-git: puzzles (master): Simon Tatham

Commits to Tartarus CVS repository. tartarus-commits at lists.tartarus.org
Sat Dec 12 11:18:47 GMT 2015


TL;DR:
  a845e64 Pattern: make part of the game_state shared.
  d1219ca Pattern: fix solver's handling of empty rows.
  f061101 Pattern: add a system of immutable pre-filled grid squares.
  786f5b1 New utility 'patternpicture', to build a Pattern from an xbm.

Repository:     git://git.tartarus.org/simon/puzzles.git
On the web:     http://tartarus.org/~simon-git/gitweb/?p=puzzles.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2015-12-12 11:18:47

commit a845e6476d3f565454d487fda2af65f0062e063f
web diff http://tartarus.org/~simon-git/gitweb/?p=puzzles.git;a=commitdiff;h=a845e6476d3f565454d487fda2af65f0062e063f;hp=0fa7baed1043089c390d80763ace267a681b69d3
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Dec 10 19:51:54 2015 +0000

    Pattern: make part of the game_state shared.
    
    The game_state now includes a pointer to a game_state_common
    containing all the row and column clues, which is reference-counted
    and therefore doesn't have to be physically copied in every dup_game.

 pattern.c |  224 +++++++++++++++++++++++++++++++------------------------------
 1 file changed, 115 insertions(+), 109 deletions(-)

commit d1219cac3c2e0adf58a477e442a8656bcb55ed0f
web diff http://tartarus.org/~simon-git/gitweb/?p=puzzles.git;a=commitdiff;h=d1219cac3c2e0adf58a477e442a8656bcb55ed0f;hp=a845e6476d3f565454d487fda2af65f0062e063f
Author: Simon Tatham <anakin at pobox.com>
Date:   Fri Dec 11 18:54:56 2015 +0000

    Pattern: fix solver's handling of empty rows.
    
    The algorithm for deducing how many squares in a row could be filled
    in just from the initial clue set was focusing solely on _black_
    squares, and forgot that if a row has a totally empty clue square then
    everything in it can be filled in as white!
    
    Now the solver can cope with puzzles such as 3x3:/1///1/ , where it
    would previously have spuriously considered that it had no idea where
    to start.

 pattern.c |   53 ++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 36 insertions(+), 17 deletions(-)

commit f061101210352b9783085ba37e1c58f1fac89862
web diff http://tartarus.org/~simon-git/gitweb/?p=puzzles.git;a=commitdiff;h=f061101210352b9783085ba37e1c58f1fac89862;hp=d1219cac3c2e0adf58a477e442a8656bcb55ed0f
Author: Simon Tatham <anakin at pobox.com>
Date:   Fri Dec 11 18:09:41 2015 +0000

    Pattern: add a system of immutable pre-filled grid squares.
    
    The game previously only supported numeric clues round the edge; but
    if for some reason you really want a puzzle with a specific solution
    bitmap and that bitmap doesn't happen to be uniquely soluble from only
    its row and column counts, then this gives you a fallback approach of
    pre-filling a few grid squares to resolve the ambiguities.
    
    (This also applies if the puzzle is uniquely soluble *in principle*
    but not by Pattern's limited solver - for example, Pattern has never
    been able to solve 4x4:2/1/2/1/1.1/2/1/1 and still can't, but now it
    can solve 4x4:2/1/2/1/1.1/2/1/1,Ap which has the hard part done for
    it.)
    
    Immutable squares are protected from modification during play, and
    used as initial information by the solver.

 pattern.c |   77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 72 insertions(+), 5 deletions(-)

commit 786f5b18e439a292ca364e18230496dbf261f5c2
web diff http://tartarus.org/~simon-git/gitweb/?p=puzzles.git;a=commitdiff;h=786f5b18e439a292ca364e18230496dbf261f5c2;hp=f061101210352b9783085ba37e1c58f1fac89862
Author: Simon Tatham <anakin at pobox.com>
Date:   Fri Dec 11 19:53:58 2015 +0000

    New utility 'patternpicture', to build a Pattern from an xbm.
    
    This utility works basically the same as galaxiespicture: you feed it
    a .xbm bitmap on standard input, and it constructs a game ID which
    solves to exactly that image. It will pre-fill some squares if that's
    necessary to resolve ambiguity, or leave the grid completely blank if
    it can.

 pattern.R |    3 +
 pattern.c |  256 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 252 insertions(+), 7 deletions(-)



More information about the tartarus-commits mailing list