Giter Site home page Giter Site logo

maze_gen.rs's Introduction

Maze Generator

This is a simple maze generator written in Rust. It uses the recursive backtracker algorithm to generate mazes.

Example with solution marked by "x"

┌   ┬---┬---┬---┬---┬---┬---┬---┬---┬---┬---┬---┬---┬---┬---┬---┐
│ x   x   x │                     x   x │     x   x │           │
├---┼---┼   ┼---┼---┼---┼---┼---┼   ┼   ┼---┼   ┼   ┼   ┼   ┼---┤
│       │ x   x   x   x   x   x   x │ x   x │ x │ x │   │       │
├   ┼---┼---┼---┼---┼---┼---┼---┼---┼---┼   ┼   ┼   ┼---┼---┼   ┤
│ x   x   x   x │ x   x │ x   x   x     │ x │ x │ x │ x   x   x │
├   ┼---┼---┼   ┼   ┼   ┼   ┼---┼   ┼---┼   ┼   ┼   ┼   ┼---┼   ┤
│ x │       │ x   x │ x │ x │   │ x │ x   x │ x │ x   x │   │ x │
├   ┼   ┼   ┼---┼---┼   ┼   ┼   ┼   ┼   ┼---┼   ┼---┼---┼   ┼   ┤
│ x │   │           │ x │ x   x │ x   x │ x   x │           │ x │
├   ┼   ┼   ┼---┼---┼   ┼---┼   ┼---┼---┼   ┼---┼   ┼---┼---┼   ┤
│ x │   │           │ x   x   x │     x   x │       │ x   x   x │
├   ┼---┼---┼---┼   ┼---┼---┼---┼   ┼   ┼---┼   ┼---┼   ┼---┼---┤
│ x   x   x   x   x   x │           │ x │   │       │ x   x   x │
├---┼---┼---┼---┼---┼   ┼---┼---┼   ┼   ┼   ┼   ┼   ┼---┼---┼   ┤
│           │ x   x   x │ x   x │   │ x │   │   │           │ x │
├   ┼   ┼---┼   ┼---┼---┼   ┼   ┼---┼   ┼   ┼   ┼---┼   ┼---┼   ┤
│   │         x   x   x   x │ x   x   x │           │         x │
└---┴---┴---┴---┴---┴---┴---┴---┴---┴---┴---┴---┴---┴---┴---┴   ┘

CLI Installation

To install the CLI, first clone this repository:

git clone [email protected]:wilswer/maze_gen.rs.git

and move into the directory maze_gen.rs then install the CLI with cargo:

cargo install --path .

CLI Usage

To get a list of all available options, run the CLI with the --help flag:

maze_gen --help

To generate a maze, run the CLI with the desired width and height:

maze_gen -x 20 -y 20

To generate a maze with a solution, run the CLI with the --solution flag:

maze_gen -x 20 -y 20 --solution

To generate a maze with a solution and save it to a file (do not include extension), run the CLI with the --solution and --output flags:

maze_gen -x 20 -y 20 --solution --output maze

This will generate a text file maze.txt and an SVG file maze.svg in the current directory.

Example SVG output without solution:

Example SVG output

Example SVG output with solution marked in red:

Example SVG output

maze_gen.rs's People

Contributors

wilswer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.