add extension set pruning to shadow play and word generation#15
Merged
Conversation
Compute left/right extension sets per strip via GADDAG traversal. Left extension: which tiles can extend leftward (from tiles to the right). Right extension: seek separator from the same node. AND extension sets with cross_set & rack_bits in shadow play to prune tiles that can't extend the main word. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
A non-empty extension set should allow blanks (bit 0), matching how cross sets work. Use bits | (bits != 0) pattern. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
One right-to-left pass per strip computes both left and right extension sets from each tile group's GADDAG node: children give left extension, seek(separator) then children give right extension. No behavioral change. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
AND left_extension_strip and right_extension_strip at every position in both shadow_play_left and shadow_play_right. This adds inline-direction pruning at positions between two tile groups where both extension sets are non-trivial. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Pre-AND left and right extension sets during computation, storing one combined extension_set per direction instead of separate left/right arrays (4 arrays -> 2). No behavioral change since both were already ANDed at each shadow play position. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
If no tile can extend in either direction at an anchor position, skip shadow play entirely. Avoids accumulator setup and rack tally cloning for provably dead anchors. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Extension sets are derived from the KWG, so they must be invalidated when switching to a different KWG. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Word generation needs left and right extension sets separately: play_right uses left_extension (tiles ahead to the right), play_left uses right_extension (tiles ahead to the left). Shadow play continues to AND both at each position. Upfront fill moved out of gen_extension_sets to a single memset per array before the strip loops. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
AND left_extension_strip in play_right and right_extension_strip in play_left before iterating KWG children. This prunes tiles that pass the cross set but cannot extend toward board tiles the traversal hasn't reached yet, avoiding unnecessary KWG arc iterations. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
3 tasks
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.
Summary
Test plan