chess
Version:
An algebraic notation driven chess engine that can validate board position and produce a list of viable moves (notated).
18 lines (13 loc) • 413 B
JavaScript
import chess from 'chess';
// create a game client
const gameClient = chess.create({ PGN : true });
let move, status;
// look at the status and valid moves
status = gameClient.getStatus();
// make a move
move = gameClient.move('a4');
// look at the status again after the move to see
// the opposing side's available moves
status = gameClient.getStatus();
// output
console.log(JSON.stringify(status, 0, 2));