M21: Thistlethwaite solver — four-phase group reduction with staged playback#22
Merged
Conversation
- StagedSolution is now generic over the stage kind (SolverStage protocol); BeginnerSolver returns StagedSolution<BeginnerStage> - TableBuilder: shared move-table/BFS builders extracted from SolverTables (multi-source starts, optional coverage check, parameterized move lists); Kociemba table bytes verified identical - ThistlethwaiteTables: four exact BFS distance tables (~5 MB, thistlethwaite-tables.bin); phase-3 goal seeded as a multi-source BFS over the half-turn coset instead of a hand-derived tetrad-twist condition; phase 4 covers exactly half its space by parity - ThistlethwaiteSolver: greedy descent per phase, each provably shortest; tests pin the known maxima 7/10/13/15 and sweep 200 seeded states with per-phase invariants and move-set checks - App: Thistlethwaite method row, lazy table build on first solve, staged chips reuse the beginner pipeline; settings snapshot now tolerates unknown solving-method values instead of resetting Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds Thistlethwaite as a fourth solving method: the classic 1981 four-phase group reduction G0 ⊃ G1 ⊃ G2 ⊃ G3 ⊃ solved. Each phase restricts the move set further and is solved provably shortest for its goal by greedy descent over an exact BFS distance table. Typical solutions run ~30–45 moves with four named stages in playback ("Orient edges", "Orient corners + slice", "Separate pieces", "Half-turn finish").
Design
Phase coordinates and tables (~5 MB total,
thistlethwaite-tables.bin):Shared refactors:
StagedSolutionis nowStagedSolution<StageKind: SolverStage>— Thistlethwaite and the upcoming CFOP solver reuse the beginner solver's staged-playback pipeline.BeginnerSolverTestsneeded zero changes.TableBuilderextracts the move-table/BFS builders fromSolverTables(multi-source starts, optional coverage assert, parameterized move lists). Pure refactor: regeneratedkociemba-tables.binverified byte-identical (sha256c54577ac…before and after).try?and silently resetting every setting.App integration: new method row (auto-populated), lazy table build on the first Thistlethwaite solve (~1 s release, cached in Application Support), stage chips and solve flow identical to the beginner method.
Verification
swift test -c release: 76 tests pass (6 new: 200-state sweep with per-phase invariants + per-phase move-set checks against an independently constructed square-group closure, table depth pins, cache round-trip, solved/illegal edge cases).🤖 Generated with Claude Code