Narabe documentation
Narabe 並べ — Board game rules engine: gomoku, Reversi, Go, checkers
Play forty-eight abstract board games through immutable moves, legal choices and replayable records.
Install
npm install @johnmorrisdotca/narabe
Start here
Entry points
| Import it | What it is | Size |
|---|---|---|
@johnmorrisdotca/React hook · 2 exports | useNarabe, a React hook over the engine: one game's state and the moves a board can make on it. | 27.1 kB |
@johnmorrisdotca/SVG boards · 2 exports | 10.7 kB | |
@johnmorrisdotca/Board element · 6 exports | 22.5 kB | |
@johnmorrisdotca/Register the board · 6 exports | 22.5 kB | |
@johnmorrisdotca/Go rules · 8 exports | 5.8 kB | |
@johnmorrisdotca/Rules and records · 228 exports | Narabe 並べ: one rules engine for forty-eight abstract board games. | 20.8 kB |
Guides
How-to
- Offer legal movesAsk the engine for legal moves, handle every stage of a turn, and never assume a click ends it.
- Play and score GoPlay Go with the base API, score by area, and use the lower-level Go functions.
- Save and replay a recordSave a record as settings and moves, replay it with its choices and clock, and spot a replay that stops early.
- Draw with SVG and ReactDraw the current position as SVG and keep game state in React.
- Embed a board positionEmbed a board as an element, an iframe or a module, and keep attributes and structured options apart.
Explanation
- State and data-driven rulesSee how one state value and data-driven variant specs hold 48 games, and how seats differ from colours.
- Game length and draw limitsUnderstand why board size does not bound a game, choose a draw limit, and bound simulations.