Repository navigation
Tantrix: moves and guided rearrangement (off by default, mixed results) - #67
Merged
Merged
Conversation
…y default) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0175jMLxrP7wZ3vfj6UfeDZx
barrybecker4
marked this pull request as ready for review
October 24, 2026 13:51
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.
Tantrix and the new bb4-optimization hooks: tried, mixed result, so off by default
Draft, for you to decide. Depends on bb4-optimization #34 (merged). Independent of the Red PR (#66).
What it adds
TantrixPathsupports moves. A Tantrix neighbor is a whole rearranged path (a pivot reversal or swap of sub paths), not a swap, so a move (PathMove) just carries the path it leads to.applyMove(proposeMove(r))is the same path asgetRandomNeighbor(r)(tested).GuidedPivot: pick a tile whose secondary colors don't match its neighbors, and rearrange the path only at that tile and the ones beside it, choosing among the alternatives the same way a random neighbor does. Offered throughTantrixPath.proposeGuidedMoveandGeneticSearchSolver.proposeGuidedMove.GeneticSearchSolver.GUIDED_MOVE_PROBABILITYfeeds the tuned simulated annealing'sguidedMoveProbability. It is 0.0, so behavior is unchanged.Measurements (this machine, 20 s cap, runs that found a solution)
Simulated annealing (the tuned one), 40 runs each:
Genetic search, 10 runs on 9 tiles: 7, 6, 5 solved with probability 0, 0.5, 1.0 (no gain). Global simulated annealing solved 10/10 at every setting.
So annealing becomes more reliable but each solved run takes 2 to 9 times longer, because a guided neighbor builds and scores several rearrangements. Genetic search does not benefit. That is not the clear win Red got, so I left it off. The exact solvers (
SHAPE_THEN_ASSIGNand friends) solve these in 20 to 35 ms anyway.Choices for you
Testing
Manual build:
GuidedPivotSuite(9 tests) passes; the only failures are the same two Tantrix suites as before (PathPivotPermuterSuite,SubPathMutatorBaseload). I could not run Gradle here.Generated by Claude Code