1.1.3 • Published 8 years ago

jschessrulz v1.1.3

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

Build Status

jschessrulz

JavaScript chess rules library

###Requirements Node.js (https://nodejs.org/en/)

Note that jschessrulz is written with some es2015 features, so your project's build system has to be able to handle those.

###Installation npm install jschessrulz --save

###Usage

import or require jschessrulz in your js-file

To start a new chess game simply declare:

  var chess = new Chess()

To select or move a piece use coordinates (0-7 for both x and y):

selectPiece(x, y) {
	if (!this.chess.selected || this.chess.canSetSelected(x, y)) {
		this.chess.setSelected(x, y)
	} else if (this.chess.isMovable(x, y)) {
		this.chess.movePiece(this.chess.selected, new Position(x, y))
	}
}

To determine whether game is over call:

  chess.isGameOver()

See the following js-file for complete example on how to use this library:

http://github.com/Humakt83/learning-chess-front/blob/master/app/js/chesscomponent.js

Two projects that use this library:

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago

0.7.1

8 years ago

0.7.0

8 years ago

0.6.0

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago