| Crates.io | puzzle_engine |
| lib.rs | puzzle_engine |
| version | 0.4.8 |
| created_at | 2025-04-02 21:36:45.572546+00 |
| updated_at | 2025-05-04 21:37:00.794624+00 |
| description | An engine for puzzles. |
| homepage | https://github.com/Andrewsimsd/puzzle_engine |
| repository | https://github.com/Andrewsimsd/puzzle_engine |
| max_upload_size | |
| id | 1617255 |
| size | 120,190 |
A modular Rust engine for building and solving puzzles.
puzzle_engine is a general-purpose puzzle library written in Rust. It's designed with extensibility and clarity in mind — ideal for games, educational tools, or AI challenges.
This crate currently includes support for the following:
✅ Procedural maze generation using randomized DFS
✅ Minimal API to move through and solve mazes
✅ Fully connected mazes — no isolated areas
✅ Built-in test coverage and examples
✅ Easy to extend with other puzzles in the future
✅ Simple ciphers
✅ Playable chess board with all rules included (except for stalemate and draw due to repeated moves)
✅ Text-based visualization of chess games
use puzzle_engine::grid_maze::{Maze, Direction};
fn main() {
let mut maze = Maze::new(5, 5);
println!("Starting at: {:?}", maze.player);
if maze.try_move(Direction::East) {
println!("Moved to: {:?}", maze.player);
}
if maze.is_at_end() {
println!("Maze solved!");
}
}
use puzzle_engine::network_maze::Maze;
fn main() {
let mut maze = Maze::new(10).unwrap();
let path = maze.find_path();
let path = path.unwrap();
for next_node in path.iter().skip(1){
maze.traverse(next_node.clone()).unwrap();
}
if maze.is_at_end() {
println!("Maze solved!");
}
}
use puzzle_engine::cipher::vigenere_cipher::Vigenere;
use puzzle_engine::cipher::prelude::*;
fn main() {
let v = Vigenere::new("KEY");
let plain = "Attack at dawn!";
let encrypted = v.encrypt(plain);
let decrypted = v.decrypt(&encrypted);
println!("plain: {}, encrypted: {}", plain, encrypted);
}
use puzzle_engine::chess::*;
fn main() {
let mut board = Board::new();
board.display(); // Print the initial board
let from = Position::new('e', 2).unwrap();
let to = Position::new('e', 4).unwrap();
// Attempt a pawn move: e2 -> e4
if board.try_move(from, to).is_ok() {
println!("Move successful!");
} else {
println!("Move failed!");
}
board.display(); // See the updated board
}
Planned puzzle modules:
Contributions are welcome! Feel free to open issues or PRs for new puzzle types, algorithm improvements, tests, or docs.
Licensed under either of:
See LICENSE for details.
Built with 🧩 and 💛 by Andrew Sims