SimpleBoard
Generic Game Board
Installation
Via npm on Node:
npm install simpleboard
Usage
Reference in your program:
var simpleboard = ;
Create a board:
var board = simpleboard;
Put a content in a cell
board;
The content is a game-dependent value/object.
Get the content of a cell
board;
If the cell is empty, the returned content is null
.
Remove the content from a cell
board;
Get an array with the board positions
var positions = board;
Each position is an object with properties x
, y
and content
.
Find a position that satifies a predicate
var position = board;
Find all the positions that satify a predicate
var position = board;
Clone a board
var clone = board;
This method is useful when you must explore a tree in a game: you can clone the current position before a new move.
Development
git clone git://github.com/ajlopez/SimpleBoard.git
cd SimpleBoard
npm install
npm test
Samples
TBD
To do
- Samples
Versions
- 0.0.1: Published
Used In
Contribution
Feel free to file issues and submit pull requests � contributions are welcome.
If you submit a pull request, please be sure to add or update corresponding
test cases, and ensure that npm test
continues to pass.