release: prepare mooncakes package metadata for v0.1.0
A reusable grid pathfinding toolkit written in MoonBit.
# Check that everything compiles moon check # Run tests moon test # Run ASCII demo moon run cmd/demo
// Create a 10x10 grid let grid = Grid::new(10, 10) // Add some walls let grid = grid .set_wall(3, 3) .set_wall(3, 4) .set_wall(3, 5) // Run A* with Manhattan heuristic let opts : SearchOptions = { movement: Movement::FourWay, heuristic: manhattan, } let result = astar(grid, Point::new(0, 0), Point::new(9, 9), opts) match result.path { Some(path) => { println("Path length: " + (path.length() - 1).to_string()) println("Total cost: " + result.total_cost.to_string()) } None => println("No path found") }
=== MoonPath ASCII Demo === Grid: S . . # . # # . # . . . . . . . # # # . . . . . G --- BFS Result --- Path found (BFS): S * * # . # # * # . . . * * * . # # # * . . . . G Steps: 8 Cost: 8 --- A* Result --- Path found (A*): S * * # . # # * # . . . * * * . # # # * . . . . G Nodes visited: 15 Nodes expanded: 12
Point
(x, y)
Cell
Empty | Blocked | Weighted(Int)
Grid
Movement
FourWay
EightWay
Heuristic
(Point, Point) -> Double
SearchOptions
{ movement: Movement, heuristic: Heuristic }
SearchResult
{ path: Array[Point]?, total_cost: Double, ... }
bfs(grid, start, goal)
dijkstra(grid, start, goal)
astar(grid, start, goal, opts)
manhattan
euclidean
chebyshev
octile
zero
Grid::new(w, h)
grid.in_bounds(p)
grid.is_passable(p)
grid.cost(x, y)
grid.get_cell(x, y)
grid.set_wall(x, y)
grid.set_weighted(x, y, w)
four_way_neighbors(grid, p)
eight_way_neighbors(grid, p)
four_way_neighbors_with_cost(grid, p)
eight_way_neighbors_with_cost(grid, p)
MoonPath/ src/ types.mbt Point, Cell, Movement, SearchResult grid.mbt Grid data structure and methods neighbors.mbt Neighbor generation (4-way, 8-way) bfs.mbt BFS algorithm priority_queue.mbt Binary heap for Dijkstra/A* dijkstra.mbt Dijkstra's algorithm heuristics.mbt Manhattan, Euclidean, Chebyshev, Octile astar.mbt A* algorithm lib.mbt Package documentation *_test.mbt Unit tests cmd/demo/ main.mbt ASCII demo .github/workflows/ci.yml moon.mod.json README.md
moon prove
mooncakes.io
Apache-2.0
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802047560号
MoonPath
A reusable grid pathfinding toolkit written in MoonBit.
Features
Quick Start
Usage
Demo Output
API
Types
Point(x, y)CellEmpty | Blocked | Weighted(Int)GridMovementFourWayorEightWayneighbor modeHeuristic(Point, Point) -> DoubleSearchOptions{ movement: Movement, heuristic: Heuristic }SearchResult{ path: Array[Point]?, total_cost: Double, ... }Algorithms
bfs(grid, start, goal)dijkstra(grid, start, goal)astar(grid, start, goal, opts)Heuristics
manhattaneuclideanchebyshevoctilezeroGrid Methods
Grid::new(w, h)grid.in_bounds(p)grid.is_passable(p)grid.cost(x, y)grid.get_cell(x, y)grid.set_wall(x, y)grid.set_weighted(x, y, w)Neighbor Generation
four_way_neighbors(grid, p)eight_way_neighbors(grid, p)four_way_neighbors_with_cost(grid, p)eight_way_neighbors_with_cost(grid, p)Project Structure
Roadmap
v0.1.0 — Initial Release
PointandGriddata structuresv0.2.0 — Planned
v0.3.0 — Future
moon proveformal verificationmooncakes.iopackage publicationLicense
Apache-2.0