ymir-js

0.9.2 • Public • Published

ymir-js

This toolkit is created to make it easier for you to develop games like chess, checkers, go, match 3 puzzle and more. It is still under development.

Create Board

const board = new Board({ x: 3, y: 3 });

Set Item

const item = new Item({ name: 'myFirstItem' });
board.setItem('0|0', item);

Get Item

board.getItem('0|0');
// => { name: 'myFirstItem', ... }

Move Item

board.moveItem('0|0', '1|1');

Remove Item

board.removeItem('1|1');

Switch Item

const firstItem = new Item({ name: 'myFirstItem' });
const secondItem = new Item({ name: 'mySecondItem' });

board.setItem('0|0', firstItem);
board.setItem('1|1', secondItem);

board.switchItem('0|0', '1|1');

board.getItem('0|0');
// => { name: 'mySecondItem', ... }

board.getItem('1|1');
// => { name: 'myFirstItem', ... }

Empty Control

board.isEmpty('2|2');
// => true

Exist Control

const board = new Board({ x: 3, y: 3 });

board.isExistCoord('5|5');
// => false

Get Matrix

board.getBoardMatrix();

/* => 
[
  [{ item }, { item }, { item }], 
  [{ item }, { item }, { item }], 
  [{ item }, { item }, { item }]
]
*/

Roadmap

Name Status Link
Turkish Checkers WIP Source
International Checkers WIP Source
Chess - -
Match 3 Puzzle - -
Go - -

Package Sidebar

Install

npm i ymir-js

Weekly Downloads

15

Version

0.9.2

License

ISC

Unpacked Size

122 kB

Total Files

46

Last publish

Collaborators

  • aykutkardas