puzzle_engine 0.2.0

An engine for puzzles.
Documentation

๐Ÿง  puzzle_engine

Crates.io Documentation License

A modular Rust engine for building and solving puzzles โ€” starting with grid-based mazes and ready to grow ๐Ÿงฉ


โœจ Overview

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 grid mazes, a type of perfect maze generated using randomized DFS. More puzzle types (Sudoku, Nonograms, Word Puzzles, etc.) are coming soon!


๐Ÿš€ Features

โœ… Procedural maze generation using randomized DFS
โœ… Minimal API to move through and solve mazes
โœ… Fully connected (perfect) mazes โ€” no isolated areas
โœ… Lightweight and dependency-free (except rand)
โœ… Built-in test coverage and examples
โœ… Easy to extend with other puzzles in the future


๐Ÿงฉ Example: Grid Maze

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!");
    }
}

๐Ÿ“ฆ Installation

Add the following to your Cargo.toml:

[dependencies]
puzzle_engine = "0.1"

๐Ÿ“š Modules

๐Ÿงฑ grid_maze

A classic maze represented as a 2D grid. Each cell connects to neighbors via randomized depth-first search.

  • Maze::new(width, height) โ€” Create a maze
  • maze.try_move(Direction) โ€” Move the player if there's a path
  • maze.is_at_end() โ€” Check if the player has reached the goal

๐Ÿงช Tests

Run tests with:

cargo test

Includes checks for:

  • Valid movement and boundary logic
  • Maze completeness
  • Player reaching the end

๐Ÿ”ฎ Roadmap

Planned puzzle modules:

  • Grid Maze (DFS-based)
  • Sudoku (validator + solver)
  • Nonograms
  • Word search / Crossword generator
  • Sokoban-style logic puzzles
  • Puzzle trait abstraction for polymorphic puzzle engines

๐Ÿค Contributing

Contributions are welcome! Feel free to open issues or PRs for new puzzle types, algorithm improvements, tests, or docs.


๐Ÿ“„ License

Licensed under either of:

  • Apache License, Version 2.0
  • MIT License

See LICENSE for details.


๐Ÿ”— Links


Built with ๐Ÿงฉ and ๐Ÿ’› by Your Name