Skip to content

Commit

Permalink
fix: updates readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nmanumr committed Jul 29, 2021
1 parent 5b97598 commit 03b2634
Showing 1 changed file with 23 additions and 56 deletions.
79 changes: 23 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,62 +10,29 @@ Utilities to generate, render and hack with any sort of mazes.
npm i mazes101 --save
```

## Usage

### For commonjs modules (nodejs)

```js
let maze = require('mazes101');

// 1. create an empty board
let {newBoard} = maze.Boards.rectangular;
let board = newBoard({height: 20, width: 20});

// 2. generate maze in that board
let {getRows, getNeighbours, removeInterWall} = maze.Boards.rectangular;
let {generate} = maze.Generators.kruskal;
board = generate(board, {getRows, getNextRowNeighbours, removeInterWall});

// 3. render the board
let {render} = maze.Renderers.rectangularSvg;
const svgString = render(board);
```

### For ecmascript modules

```js
// 1. create an empty board
import {newBoard} from 'mazes101/boards/rectangular';
let board = newBoard({height: 20, width: 20});

// 2. generate maze in that board
import {getRows, getNeighbours, removeInterWall} from 'mazes101/boards/rectangular';
import {generate} from 'mazes101/generators/eller';
board = generate(board, {getRows, getNeighbours, removeInterWall});

// 3. render the board
import {render} from 'mazes101/renderers/rectangularSvg';
const svgString = render(board);
```

Code in completely purgeable so only the bits that your are using will be bundled. For example, the following code
bundles to only 3KBs.
## Status

The project is still under development and therefore contributions are welcomed here is the Status of the project:

- [ ] Boards
* [x] Rectangular Board
* [x] Weave Board
* [x] Circular Board
* [ ] Triangular Board
* [ ] Hexagonal Board
- [x] Generators
* [x] Aldous Broder
* [x] Backtrack
* [x] Eller
* [x] Kruskal
* [x] Prim
* [x] Sidewinder
* [x] Wilson
- [x] Renderers
* [x] SVG
* [x] Canvas

## Contributions
If you feel something is missing or something can be done better
feel free to open an issue or direct create a PR for that. Following
this a basic overview of progress on this project. We can also pickup
anything that is not implemented yet.

## For development
If you feel something is missing or something can be done better feel free to open an issue or direct create a PR for that. Following this a basic overview of progress on this project. We can also pickup anything that is not implemented yet.

```sh
# to build mazes101 in watch mode
npm run watch

# to serve documentation
pipenv run mkdocs serve

# to build documentation
pipenv run mkdocs build
```
I'm also thinking to port the code base to other languages, current Python & Dart are in my wishlist so any contributions to porting are also welcomed.

0 comments on commit 03b2634

Please sign in to comment.