Skip to content

feat(hexmap): HexMap facade, README and packaging (L8) - #134

Merged
bal7hazar merged 1 commit into
mainfrom
feat/hexmap-facade
Sep 27, 2026
Merged

bal7hazar merged 1 commit into
mainfrom
feat/hexmap-facade

Conversation

@bal7hazar

Copy link
Copy Markdown
Collaborator

Summary

Lot L8 of origami_hexmap: the public face of the package.

  • HexMap facade (map.cairo), mirroring origami_map::MapTrait name for name: new, new_empty, new_maze, new_cave, new_random_walk, open_with_corridor, open_with_maze, compute_distribution, search_path. Hex additions: new_hexagon, search_path_weighted (Dial), field_of_movement, distance_to (path distance), hex_distance (geometric), reachable, range, ring, keep_component, neighbor, is_walkable. The names follow the hexx vocabulary where it applies.
  • Zero facade overhead, measured facade vs direct call for every function in bench_map.cairo.
  • keep_component uses Bfs::reachable: −4.3 % (cave 17x14), −7.3 % (maze), −39 % (7x7) vs Caver::keep_component.
  • ring in one flood, open edge tiles included: −43 % (17x14), −42 % (7x7), −38 % (opened map) vs two range calls.
  • End-to-end benchmarks with budgets (new_cave + keep_component + open_with_corridor + compute_distribution(10) + search_path): 1.16M on 17x14 and 486k on 7x7. The same scenario on origami_map 18x14 costs 145.8M (cairo-test estimate).
  • Crate README: conventions with drawings, every function with an example, panics, gas tables, the cost-class encoding, u252 guidance and a migration note from origami_map::hex. The GAS.md L8 section is filled.
  • Root re-exports: HexMap, HexMapTrait, Direction, u252, U252Trait.
  • A dropped*: finders/astar.cairo, finders/heap.cairo and tests/bench_astar.cairo are deleted.
  • Packaging: publish = false is removed, and origami_hexmap is added to the CI package job and to the root README. scarb package -p origami_hexmap passes on a clean tree (36 files, 903.57 KiB, 130.33 KiB compressed). Nothing is published.

API change: the stubs' tiles_within_range and distance are renamed to range and hex_distance, as the brief asks.

Tests

  • snforge test -p origami_hexmap: 882 passed, 3 ignored.
  • scarb fmt --check -p origami_hexmap is clean.

🤖 Generated with Claude Code

- HexMap facade mirroring origami_map::MapTrait, plus new_hexagon,
  search_path_weighted, field_of_movement, distance_to, hex_distance,
  reachable, range, ring, keep_component, neighbor and is_walkable
  (hexx vocabulary). Zero facade overhead, measured in bench_map.
- keep_component uses Bfs::reachable (-4 % to -39 % vs Caver).
- ring in one flood: -38 % to -43 % vs two range calls.
- End-to-end scenario benchmarks (17x14 and 7x7) with budgets.
- Crate README: conventions, API, panics, gas, u252, migration note.
- Root re-exports of HexMap, Direction and u252.
- Drop the A* baseline (finders/astar, finders/heap, bench_astar).
- Publishable: remove publish = false, add origami_hexmap to the CI
  package job and the root README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bal7hazar
bal7hazar merged commit eb0f4b1 into main Sep 27, 2026
9 checks passed
@bal7hazar
bal7hazar deleted the feat/hexmap-facade branch September 27, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant