refactor/maze-drop-settings #173

Merged
OragonEfreet merged 3 commits from refactor/maze-drop-settings into main 2026-07-31 11:32:55 +02:00
Owner
No description provided.
OragonEfreet added this to the 1.1 milestone 2026-07-31 11:29:18 +02:00
A walk that never retreads. It carves on to a neighbour it has not stood
on before until every way out leads back over its own ground, then scans
for a cell it has missed with one it has taken beside it, joins the two,
and walks on from there. Never retreading is what makes it so much
quicker than Aldous-Broder, which spends most of its steps crossing
ground it already covered, and it is also what costs it the even hand:
the mazes it draws are not all equally likely, and run to long winding
corridors with few dead ends.

It names no direction and only asks for neighbours, so it works on any
family, and it scans by cell index rather than by row. The book describes
the hunt row by row, but nothing in the algorithm depends on the grid
having rows.

The hunt is stepped like anything else, one probed cell at a time, so
every step stays bounded and a program watching with marks sees the scan
sweep the grid rather than the walk simply reappearing elsewhere. A floor
under the scan keeps the cost from drifting: a cell is never unreached
again, so a run of reached cells from the floor upwards is settled for
good and the next hunt starts past it.

The head is left off a one-cell maze, which is finished before any step
runs and so never gets a step to take the head off again. Wilson already
guards that case; Aldous-Broder does not, and is untouched here.

Five test cases, checked by mutation: breaking the hunt so it joins an
unreached neighbour, leaving the head set on the finishing step, and
letting the walk cross covered ground are all caught. Dropping the guard
on the scan floor is not, and neither is the guard against a runaway scan
on a grid that comes in pieces -- the first is an optimisation whose
absence 1200 generations failed to punish, the second is unreachable
while every family is connected.

The example shows it as a fifth maze, and carries a change of grid size
made alongside it.
refactor(maze): drop the settings concept from generation algorithms
All checks were successful
C++ Compatibility / C++ Compatibility Check (pull_request) Successful in 7s
Documentation / build-docs (pull_request) Successful in 9s
QA / cert (pull_request) Successful in 30s
Build and Test / linux-linux-gcc / shared (pull_request) Successful in 17s
Build and Test / linux-linux-gcc / static (pull_request) Successful in 17s
Build and Test / linux-windows-mingw / shared (pull_request) Successful in 28s
Build and Test / linux-windows-mingw / static (pull_request) Successful in 27s
ff372ae1ac
The only two algorithms that took settings were the two that name
directions, and every pair they accept produces the same maze seen from
another corner: the four binary tree pairs are the four corners, the
eight sidewinder pairs the eight symmetries of a square. That is a
transform of a finished grid, not a property of the algorithm that carved
it, so the settings bought nothing that rotating the result would not.

Gone are both settings structs, the settings field of the algorithm
description, and the settings field of the build context. The two
algorithm getters now take no arguments at all, like the three that never
took any.

Fixing the directions pays off twice over in the sidewinder. Running east
and closing north means its sweep visits cells in the grid's own
numbering, so the index-to-cell mapping it carried is the identity and
the whole helper disappears; and a fixed pair is perpendicular by
construction, so the check that used to refuse a bad one goes too. The
binary tree loses its own validity check for the same reason.

Four test cases existed only to exercise settings and are gone. Two more
leant on the sidewinder's rejection of a same-axis pair as a convenient
setup that refuses; since no built-in refuses anything at creation any
more, they now use an algorithm written for the purpose, which tests the
builder's handling of a refusal rather than another algorithm's
validation. The case describing the binary tree's corridors survives,
renamed: that behaviour is no longer a default, it is the behaviour.

The changelog entries are corrected rather than given a removal note, all
of this being unreleased.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
OragonEfreet deleted branch refactor/maze-drop-settings 2026-07-31 11:32:56 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
OragonEfreet/banjo!173
No description provided.