Crates.io | astar-mumu |
lib.rs | astar-mumu |
version | 0.1.0 |
created_at | 2025-08-15 16:09:05.413714+00 |
updated_at | 2025-08-15 16:09:05.413714+00 |
description | A* algorithm plugin for the Lava language |
homepage | https://lava.nu11.uk |
repository | https://gitlab.com/tofo/mumu-astar |
max_upload_size | |
id | 1797039 |
size | 83,874 |
A* algorithm plugin for the Lava (MuMu) language. Provides fast grid pathfinding and random maze generation for Rust-based Lava/MuMu interpreters.
astar:astar
: Standard grid-based A* (BFS) pathfinding, supports obstacles.astar:maze
: Generate random solvable mazes, returns obstacle arrays.astar:maze_png
: Generate mazes and export them as PNG images.astar:path_png
: Pathfind on a grid and render solution path as PNG.cargo build --release
sudo cp target/release/libmumuastar.so /usr/local/lib/
sudo ldconfig
extend("astar")
maze = astar:maze(1234, 16, 12)
result = astar:astar(maze)
// result.path contains the path, result.success is true if a path was found
maze = astar:maze(5678, 32, 20)
astar:maze_png(5678, 32, 20, 0, 0, 31, 19, "maze.png")
maze = astar:maze(1337, 16, 16)
graph = astar:astar(maze)
astar:path_png(graph, "solved.png")
astar:astar(graph)
: Finds a path from start
to end
on a grid. graph
must be a keyed array with fields:
dimension: [width, height]
start: [sx, sy]
end: [ex, ey]
obj: [[ox, oy], ...]
(obstacles)astar:maze(seed, width=20, height=20, sx=0, sy=0, ex=width-1, ey=height-1)
: Generates a solvable maze and returns a keyed array with dimension
, start
, end
, obj
.
astar:maze_png(seed, width, height, sx, sy, ex, ey, filename)
: Same as above, also saves the maze as a PNG.
astar:path_png(graph, filename)
: Saves a solution path as a PNG. Returns the input graph.
Dual MIT/Apache-2.0, see LICENSE.
Copyright (c) 2025 Tom Fotheringham and contributors