| Crates.io | cartesian_maze_puzzle |
| lib.rs | cartesian_maze_puzzle |
| version | 0.1.0 |
| created_at | 2025-04-01 23:42:02.50047+00 |
| updated_at | 2025-04-01 23:42:02.50047+00 |
| description | A cartesian maze puzzle for you to solve. |
| homepage | https://github.com/Andrewsimsd/rust-cartesian-maze-puzzle |
| repository | https://github.com/Andrewsimsd/rust-cartesian-maze-puzzle |
| max_upload_size | |
| id | 1615783 |
| size | 16,034 |
A minimal, efficient, and fun procedural maze generation library written in Rust ๐ฆ. Generate perfect mazes (no loops, no isolated sections), navigate them programmatically, and use them for puzzles, games, AI pathfinding, or teaching algorithms.
randAdd the following to your Cargo.toml:
[dependencies]
cartesian-maze-puzzle = "0.1"
use cartesian_maze_puzzle::{Maze, Direction};
fn main() {
let mut maze = Maze::new(5, 5);
println!("Starting at: {:?}", maze.player);
// Try moving east
if maze.try_move(Direction::East) {
println!("Moved to: {:?}", maze.player);
} else {
println!("Hit a wall!");
}
// Check if you've reached the end
if maze.is_at_end() {
println!("You solved the maze!");
}
}
Run unit tests with:
cargo test
Tests verify:
The full API is available on docs.rs.
Because the maze operates on a classic Cartesian coordinate grid where (0, 0) is the top-left corner. It's simple, intuitive, and easy to visualize or integrate into grid-based games.
src/
โโโ lib.rs # Maze logic
โโโ main.rs # (Optional) CLI or demo interface
tests/
โโโ integration.rs # Integration tests
Licensed under either of:
See LICENSE for more information.
Contributions welcome! Feel free to open issues or PRs for:
Thanks to the Rust community and all contributors to the rand crate!
Made with ๐งฉ by Andrew Sims