2.3.2 • Published 2 years ago

chess-legal-moves v2.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

♔ Chess legal moves

Contributor Covenant

Analyses a given chess game position in Fen notation to return legal moves and provides the next game position after a given move

API reference

This lib exposes a Game class, its constructor takes a string representing a snapshot of a chess game in FEN notation. You can then use legalMoves, kingState properties and addMove() method.

legalMoves property is an array containing all legal moves in UCI notation

kingState property gives you the state of the game (isCheck, isCheckmated, isDraw).

Installation

  • with npm
npm install chess-legal-moves
  • with yarn
yarn add chess-legal-moves

Usage

Import the Game class from the library and pass its constructor a FEN string. As an example the following FEN string represents a game starting position. Learn about FEN notation

import Game from 'chess-legal-moves';
const game = new Game('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1');
const possibleMoves = game.legalMoves;
const kingState = game.kingState;
2.3.0

2 years ago

2.3.2

2 years ago

2.3.1

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

2.2.0

2 years ago

2.0.7

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

0.0.34

2 years ago

0.0.35

2 years ago

0.0.20

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.23

2 years ago

0.0.24

2 years ago

0.0.25

2 years ago

0.0.19

2 years ago

0.0.30

2 years ago

0.0.31

2 years ago

0.0.32

2 years ago

0.0.33

2 years ago

0.0.27

2 years ago

0.0.28

2 years ago

0.0.29

2 years ago

0.0.11

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.15

3 years ago

0.0.9

3 years ago

0.0.16

3 years ago

0.0.8

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.1

3 years ago