Maze Generator creates random mazes using recursive backtracking algorithm with customizable size and difficulty.
npm install @apiverve/mazeshell
npm install @apiverve/maze
`
Using yarn:
`shell
yarn add @apiverve/maze
`
---
Configuration
Before using the Maze Generator API client, you have to setup your account and obtain your API Key.
You can get it by signing up at https://apiverve.com
---
Quick Start
Get started with the Quick Start Guide
The Maze Generator API documentation is found here: https://docs.apiverve.com/ref/maze.
You can find parameters, example responses, and status codes documented here.
$3
`javascript
const mazeAPI = require('@apiverve/maze');
const api = new mazeAPI({
api_key: '[YOUR_API_KEY]'
});
`
---
Usage
---
$3
Using the API is simple. All you have to do is make a request. The API will return a response with the data you requested.
`javascript
var query = {
width: 15,
height: 15,
difficulty: "medium"
};
api.execute(query, function (error, data) {
if (error) {
return console.error(error);
} else {
console.log(data);
}
});
`
---
$3
You can also use promises to make requests. The API returns a promise that you can use to handle the response.
`javascript
var query = {
width: 15,
height: 15,
difficulty: "medium"
};
api.execute(query)
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
`
---
$3
You can also use async/await to make requests. The API returns a promise that you can use to handle the response.
`javascript
async function makeRequest() {
var query = {
width: 15,
height: 15,
difficulty: "medium"
};
try {
const data = await api.execute(query);
console.log(data);
} catch (error) {
console.error(error);
}
}
`
---
Example Response
`json
{
"status": "ok",
"error": null,
"data": {
"width": 15,
"height": 15,
"difficulty": "medium",
"start": {
"x": 1,
"y": 1
},
"end": {
"x": 29,
"y": 29
},
"grid": [
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
],
[
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1
],
[
1,
0,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
0,
1,
0,
1,
0,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1
],
[
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
1,
0,
1
],
[
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
0,
1
],
[
1,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
1,
0,
1,
0,
0,
0,
1
],
[
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
0,
1,
0,
1,
1,
1,
0,
1,
0,
1,
1,
1
],
[
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
1
],
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
]
],
"html": "Maze Puzzle Maze
Find your way from green to red!
",
"image": {
"imageName": "ae2955eb-7151-48c1-a90b-3e67c08c0c6e_puzzle.png",
"format": ".png",
"downloadURL": "https://storage.googleapis.com/apiverve.appspot.com/maze/ae2955eb-7151-48c1-a90b-3e67c08c0c6e_puzzle.png?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1764735759&Signature=ZSnW950f7ONQc6GAFmiCm7cQhPSS7f9CcxkckS1JoXhSp3vLSgN6eis0p1RTW9riNpGXI%2BlC3gjW%2FrrJcP1e9%2BV9z0ZFwpjVlzCNs%2BoXeMK2QbVCcd%2FIorvsiZRCzLknp1SKMJOcyqUChGVRsQN97q80BGvmKxsvMvWTXbzCvJF634sw8UvSrVBcrDY4FKLL75K%2BvOcIV8n9DExDdVKYXc%2B1NUxywL5uhmZPFe7vG6DcFIUwOsEJbgNi7Huw%2Fa%2BlC51sUT3wW9DoNPb9T04tB7pZ9gZaI9reLCvZUa%2BbWjHWeZYu3E4fz55lS9PaYILuOX5cjNa3ywDbxtCClSb8DA%3D%3D",
"expires": 1764735759356
},
"solutionImage": {
"imageName": "cc26ac88-ae60-4ea1-9b2d-bf81500b9a43_solution.png",
"format": ".png",
"downloadURL": "https://storage.googleapis.com/apiverve.appspot.com/maze/cc26ac88-ae60-4ea1-9b2d-bf81500b9a43_solution.png?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1764735759&Signature=XZmIPV5aYT%2BmCywJ%2BB14G%2B4Yj0YbyBFCjNkZNUELx6srU6Aik8VOXAlHB8WABV4n%2FDA7e%2FxdRZ63RhQxURrw6%2F3YF1nC3SEdB8OrSGT%2F8Ih3D%2F%2FeNOOmT7YO8n5xjSbdbRIgZVqzBZ6sel8V5%2BqqepDkGt7HAX3kQckWgPHNoYKqoc0ydcPBLsQI%2B5vjNuT7%2F08I8QBk2625%2B7IanYaaFvKlAkjD9WlUGn3eit%2FqQbGxGGp8YLSntgYyci7HUAJxuPtnMqMWzK10XgggDFqBNdA6G40qL7BkMx6sc7igtrI3LsjiwIueigNwNmPTn4VZ%2Bb%2FP1OszqFZMKrYIvjn1nw%3D%3D",
"expires": 1764735759882
}
}
}
``