Giter VIP home page Giter VIP logo

maze-generator's Introduction

Maze Generator

About

I wanted to re-create the (now-defunct) noops challenge maze generator API so that I could continue to use the maze solvers I had created.

Usage

mazebot - a maze generator API

Usage:
  mazebot [flags]
  mazebot [command]

Available Commands:
  api         Starts the mazebot API
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  print       Generates a maze and prints it out

Flags:
  -h, --help   help for mazebot

Use "mazebot [command] --help" for more information about a command.

API

TODO:

  • Handle solution submissions
  • Support "race" mode
Starts the mazebot API

Usage:
  mazebot api [flags]

Flags:
  -h, --help       help for api
      --host ip    Specifies the host addresses to respond to (default 127.0.0.1)
      --port int   Changes the server port (default 8080)

Matching the noops API, clients can send GET requests to /mazebot/random?minSize=12&maxSize=12. And example response looks like:

{
    "endingPosition": [4,4],
    "map": [
        ["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","B","X"," "," "," "," "," ","X"],
        ["X"," "," "," "," "," "," ","X"," ","X"," ","X"],
        ["X","X"," ","X"," ","X"," "," ","X","X"," ","X"],
        ["X"," "," "," ","X"," ","X"," "," "," ","X","X"],
        ["X","X"," ","X"," "," ","X","A","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"]
    ],
    "name": "12x12",
    "path": "/mazebot/random",
    "startingPosition": [8,7]
}

Print

In order to help visualize the results of the maze generation, you can simply print out a generated maze to the CLI. For easier visual validation of the generated paths, the X wall character is replaced with a character. Ideally, a monospaced font would be utilized in order to show accurate proportions.

Generates a maze and prints it out

Usage:
  mazebot print size [flags]

Flags:
  -h, --help   help for print

Example usage:

> mazebot print 24

Generating a 24x24 maze
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓ ▓ ▓A▓  ▓  ▓  ▓▓▓    ▓
▓       ▓  ▓ ▓ ▓ ▓ ▓ ▓ ▓
▓ ▓▓ ▓ ▓  ▓         ▓  ▓
▓▓  ▓  ▓ ▓ ▓▓ ▓ ▓ ▓▓▓▓ ▓
▓▓▓  ▓         ▓ ▓  ▓  ▓
▓▓  ▓▓ ▓ ▓▓ ▓ ▓   ▓ ▓ ▓▓
▓  ▓    ▓ ▓  ▓ ▓▓      ▓
▓ ▓ ▓ ▓▓   ▓▓   ▓ ▓▓▓▓ ▓
▓ ▓      ▓▓ ▓ ▓▓      ▓▓
▓  ▓ ▓ ▓▓   ▓ ▓▓ ▓▓ ▓  ▓
▓ ▓   ▓   ▓▓      ▓  ▓ ▓
▓  ▓ ▓ ▓ ▓ ▓ ▓▓ ▓  ▓  ▓▓
▓▓     ▓ ▓     ▓  ▓▓ ▓ ▓
▓▓ ▓ ▓     ▓▓ ▓▓ ▓     ▓
▓   ▓▓▓ ▓ ▓  ▓  ▓ ▓▓ ▓ ▓
▓▓ ▓ ▓  ▓   ▓ ▓ ▓ ▓ ▓ ▓▓
▓▓    ▓ ▓ ▓            ▓
▓  ▓ ▓▓ ▓ ▓ ▓▓▓▓▓▓▓ ▓▓ ▓
▓ ▓    ▓ ▓▓       ▓ ▓  ▓
▓ ▓ ▓▓     ▓ ▓ ▓ ▓ ▓ ▓ ▓
▓  ▓▓ ▓ B▓ ▓  ▓      ▓▓▓
▓▓    ▓ ▓   ▓  ▓ ▓ ▓   ▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
Took 343.666µs

maze-generator's People

Contributors

dhm116 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.