Repository navigation
feat(hexmap): bit-parallel weighted Dial search and field of movement (L3) - #132
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng in Dial Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… bits Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.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.
Summary
Lot L3 of
origami_hexmap: weighted shortest path without a heap, and movement range with costs.Dial::search(grid, width, height, from, to, costs): cheapest path, entry cost 1 unless the tile is incosts[k](costk + 2, at most 3 classes). A tile in several classes takes the highest cost. Output asBfs::search(target included, start excluded, empty if unreachable orfrom == to).Dial::field_of_movement(grid, width, height, from, budget, costs) -> felt252(new public function): tiles reachable with total cost <= budget, start included (hexxsemantics).t + costonce and leaves the unvisited set at that moment. That means no stale entries, and the search stops when the target is scheduled. The ring is 4 felts, and unions are additions because the scheduled sets are disjoint.costsis empty. Single-limbu128path for boards <= 128 bits, sharing code through a privateSet<T>trait.Gas (17x14, CAVE far pair, 2 classes over 30 % of the floor)
Dial::searchCAVE farorigami_mapDijkstra, 18x14 unit costsAll variants from the brief are implemented and measured in
tests/bench_dial.cairo(bucket ring as locals / fixed array /Array, per-class masking vs partition, sparse layers, bit-test backtracking, corelib vs local bitwise triple,u128vsu256, Dijkstra with a heap). The full tables are in the L3 section ofGAS.md.Tests
field_of_movementis checked against the oracle for several budgets.tests/variants.cairo.dial.cairo: exact paths with printouts, the overlap rule, edges, dimensions, and panics (Dial: too many costs,Dial: position not walkable, asserter errors).Scope:
finders/dial.cairo,tests/bench_dial.cairo,GAS.md(L3 section).🤖 Generated with Claude Code