Simple maze solver using ES6 + recursive method.
First, npm install
, then:
import { MazeGenerator, MazeSolver } from 'maze-es6-solver';
const mazeGenerator = new MazeGenerator(4,2);
const maze = mazeGenerator.run();
const solver = new MazeSolver(maze);
solver.draw();
console.log(' \n');
console.time('TIME');
solver.traverse(0,1);
console.timeEnd('TIME');
solver.draw();
See the example at input/example-1.js
:
- 'E' is the entry point.
- ' ' is path.
- '=' is wall.
- 'G' is the exit.
- There are few algorithms to solve mazes, this is from this article:
I want to use recursive methods in ES6, this repository is not to another purpose!