🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.electronics.design
Article #1261

Re: Puzzles

#1261
From: Waldek Hebisch
Date: Sun, 15 Nov 2026 04:08
201 lines
9290 bytes
Don Y <blockedofcourse@foo.invalid> wrote:
> On 11/12/2026 8:15 AM, Waldek Hebisch wrote:
>> Don Y <blockedofcourse@foo.invalid> wrote:
> 
>>> Which got me thinking about how you would dynamically create such a puzzle,
>>> given that it would have to be solvable (algorithmically, not just by chance).
>> 
>> AFAIK all Sudoku puzzles are algorithmically solvable, that is you
>> can check if there is a unique solution (and find a solution when
>> it exists).
> 
> That doesn't make for an *engaging* problem.
> 
> At one end of the spectrum, I can put three numbers on the grid and
> leave the rest to the "player".  A multitude of possible solutions
> so their efforts are largely just time consuming with very low level
> of reasoning.
> 
> At the other end, I can populate the grid *slectively* such that only
> one solution is possible.
> 
> Yet, if arriving at that solution involves "taking a guess" at
> any stage (because you can't deterministically rule out particular
> candidates), then it is far less fulfilling as you can "guess"
> wrong and then have to backtrack to that point to "make the other
> choice".
> 
> Here is just such a puzzle:
> 
> --7-1-2-5
> --6----7-
> 9----7--1
> -3----8--
> --27---1-
> 8-135-7-6
> ----9613-
> ---------
> 2---3---8
> 
> You can unambiguously deduce every step in the completion of the grid
> up to this point (spoiler alert):
> 
> --7-1-2-5
> --6----7-
> 9----7--1
> 73----8--
> --27---1-
> 8-135-7-6
> ---296137
> xx3-7----
> 279-3---8
> 
> [I *think* this is the most resolved the puzzle can become but haven't
> spent more than a few minutes examining its current state]

One can easiliy deduce more:

--7-1-2-5
--6----7-
9----73-1
73----8--
--27---1-
8-135-7-6
---296137
--3-7----
279-3---8

and several steps beyond that.  As one point I did a binary
guess, I guessed correctly and after that I got a solution.

Actually, at later step I made a mistake, so I tried the
other possiblity which led me to contradiction.  Consequently
I suspected that this may be a "bad" sudoku, without
solution.  But I created a solver and it found solution.
Comparing I fund place where I made an error and restarting
from this place I got solution.

Solver tells me that it need 2 binary decisions, which is
more than my "by hand way".  I am not sure why solver
needed more decisions, it could be because the solver
uses generic method, while I used technique specific
to sudoku which possibly could eliminated one decision
point.  In fact, I do not know if guessing was needed,
it is possible that I overlooked some reasoning that
would allow progress without guessing.

> I know, for example, that one of the two X's will be either 1 or 6 and the
> other X would be the unchosen value.  But, I can't reliably say WHICH is
> which.  One "choice" will be incorrect.  (and, there is no guarantee that
> the refinement of valid choices that occurs AFTER such a choice won't
> present another "choice situation").
> 
> But, hereafter, you have to "make a guess" as to which of the remaining
> "legal" moves are worth pursuing.  If you are careful in your selection
> of WHERE to make your guess, you can often reduce this to one of two
> choices (only one of which will result in a solution).  if you
> guess wrong, then you have to backtrack your guesses from this point
> and "take the other option" (assuming you only had two options
> available).
> 
> [There are other "choice opportunities" on the board so another may be
> more profitable in narrowing the potential subsequent choices]
> 
> This is disheartening as it relies on luck instead of deductive reasoning.
> 
> Sudoku differs from e.g., Solitaire in that one can *reason* the
> choice to make at each step -- up to this point.  With solitaire,
> there is no easy way to look ahead to determine if your current
> CHOICE is correct.
> 
>> So you may simply generate random sudoku and reject
>> ones that do not have unique solution.  Slightly harder may
>> deciding how hard given sudoku is for people (you do not want them
>> too easy, but also you do not want ones that only computer
>> can solve).
> 
> Exactly.  What *criteria* does an algorithm use to create a puzzle
> of a given complexity?  How do you even MEASURE the compleity?
> Is it simply a matter of the number of prefilled squares that are
> presented to the player?  Or, do the *choices* of those squares
> significantly impact the difficulty level?

I would say that difficulty depends on complexity of algorithm
needed to solve it.  Basicaly anybody can to simple
propagation, if it leads to solution, then the sudoku is
easy.  If more complex propagation rules are needed, then
it is harder.  People seem to be quite reluctant to
systematically check alternatives, but if number of
alternatives is small, than IMO the sudoku is stil
reasonable.  Of course, people that know only simple
propagation may be forced to check alternatives in
cases where better propagation rules would lead to
unique possibility.

Number of prefilled squares determines number of squares
to fill, so in a sense amount of work, but otherwise
I do not think that corelation with difficulty is
very strong.

> Or, is it easier to just PREcompute the set of potential puzzles
> using symbolic representations of the numbers, select one at
> random, apply rotation/flip transforms to further "randomize"
> it and then bind digits to the symbols??  If the number of such
> "templates" is small, then simply storing them might be more
> efficient than generating them.

I am not sure how much effort is needed for generation.  Solver
solves your one in less than 2ms.  Similarly, starting from
empty square (of course in such case there are multiple
solution, but solver produces just one of them).  So, one
can make several solution attempts, changing candidate
sudoku for better properties and still have subsecond
generation time.

>>> Which got me thinking of the tougher problem:  creating a *crossword* from
>>> scratch!  Without just relying on an exhaustive attempt to paste words from
>>> a (constrained) glossary onto a grid.
>> 
>> AFAIK modern version of exhaustive search are much more efficient
>> than naive versions.  I do not think that reasonably sized crossword
>> abd glossary would be a problem for them.
> 
> You don't do an exhaustive search as you have the same "clues" that a
> crossword solver would have.
> 
> E.g., weed out all words that are shorter or longer than the shortest
> unsolved clue (repeat throughout the solving stage).

I am not sure what you want to say here.  Of course you need
some lingustic knowledge in form of word list and for each
word you need possible questions/clues.  You may wish some
form of semantic markup if you aim at specific theme.

But otherwise this is problem of putting words on a grid
satisfying some constraints.  Eliminating possibilities
that "obviously" do not lead to solution is standard part
of modern exhaustive search.  Modern methods are quite
good at doing it in generic way (that is using only
information from problem formulation).  But if you need
to optimize more you can try tweaking algorithm to
your specific problem.

> For any given clue, use the existing "filled squares" to condition the
> words that you examine ("seven letters, first letter must be an L, 5th
> letter must be a P, etc.").  You can index the choices so you don't
> have to sequentially examine a lost of potentially thousands of
> words looking for candidates (current conditions always get tighter,
> until you have to backup, so the lists always get shorter)
> 
> And, if you are creating a puzzle, then you try "candidate N from "list
> of candidates X /for this clue/ before advancing to pick a candidate for
> the next clue.  If you complete the last clue, you are done.  Otherwise,
> anytime you exhaust a list of candidates for a particular clue, you
> "backup" to the previous clue, invalidate its current choice and advance
> to the next choice available to it, repeating as necessary.
> 
> [Of course, duality ensures this can be recursive or iterative solution
> based on your preference and how much housekeeping you want to do]

-- 
                              Waldek Hebisch
Technical Details
Message-ID: <11dbb79$1j1jt$1@paganini.bofh.team>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
References: <11ctgil$1ll56$1@dont-email.me> <11d4l69$nmdf$1@paganini.bofh.team> <11d5h3q$clc0$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
From: antispam@fricas.org (Waldek Hebisch)
Newsgroups: sci.electronics.design
Subject: Re: Puzzles
Date: Sun, 15 Nov 2026 04:08:11 -0000 (UTC)
Organization: bofh.team Usenet service
Message-ID: <11dbb79$1j1jt$1@paganini.bofh.team>
References: <11ctgil$1ll56$1@dont-email.me> <11d4l69$nmdf$1@paganini.bofh.team> <11d5h3q$clc0$1@dont-email.me>
Injection-Date: Sun, 15 Nov 2026 04:08:11 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="1672829"; mail-complaints-to="usenet@bofh.team"; posting-host="d028f9ad2fa2c51f22dbfed0d81d7daf"; posting-account="69e66f1681224ab92235b464ce7a90b6"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
X-Postfilter: Postfilter-NG 2026.10.2