diff options
| author | Simon Tatham <anakin@pobox.com> | 2023-03-12 14:37:36 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2023-03-12 14:41:05 +0000 |
| commit | 51818780f835b459b9671df38eefef06fca3fd89 (patch) | |
| tree | e49eef39039ff75ce1434285254e031dfc38e41c /html/samegame.html | |
| parent | 20f95e3e223112331ea1b876db82aa8bb2b45e3a (diff) | |
| download | puzzles-51818780f835b459b9671df38eefef06fca3fd89.zip puzzles-51818780f835b459b9671df38eefef06fca3fd89.tar.gz puzzles-51818780f835b459b9671df38eefef06fca3fd89.tar.bz2 puzzles-51818780f835b459b9671df38eefef06fca3fd89.tar.xz | |
Galaxies: remove 'solver_recurse_depth' in live use.
It's horrible to have static mutable state in the live puzzle game.
What if some downstream wanted to run the system in multiple threads?
For purposes of limiting the recursion depth, we now pass an 'int depth'
argument to each call to solver_state_inner(). So in the normal build
of the actual puzzle, the static variable isn't needed at all. We only
include it in binaries that are going to want to use it for printing
indented diagnostics: the CLI solver program, and the live puzzle only
if DEBUGGING is defined. The rest of the time, it's absent.
A side effect of this change is that when the recursion code makes a
guess at a particular tile, the message about that is now indented to
the _outer_ level instead of the inner one, because the previous
'depth++' and 'depth--' statements wrapped the whole loop rather than
just the recursive call to the solver inside. This makes recursive
solving much easier to follow!
Diffstat (limited to 'html/samegame.html')
0 files changed, 0 insertions, 0 deletions