@lubert/chess.ts
TypeScript icon, indicating that this package has built-in type declarations

0.16.1 • Public • Published

chess.ts

Build Status npm

chess.ts is a chess library and rewrite of chess.js in Typescript that is used for chess move generation/validation, piece placement/movement, and check/checkmate/stalemate detection - basically everything but the AI.

chess.ts has been extensively tested in node.js and most modern browsers.

Installation

To install the stable version:

# NPM
npm install @lubert/chess.ts

# Yarn
yarn add @lubert/chess.ts

Documentation

Example Code

The code below plays a random game of chess:

import { Chess } from '@lubert/chess.ts'
const chess = new Chess()

while (!chess.game_over()) {
  const moves = chess.moves()
  const move = moves[Math.floor(Math.random() * moves.length)]
  chess.move(move)
}
console.log(chess.pgn())

User Interface

By design, chess.ts is headless and does not include user interface. Many developers have had success integrating chess.ts with the chessboard.js library. See chessboard.js - Random vs Random for an example.

BUGS

  • The en passant square and castling flags aren't adjusted when using the put/remove functions (workaround: use .load() instead)

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.16.110latest

Version History

VersionDownloads (Last 7 Days)Published
0.16.110
0.16.01
0.15.10
0.15.01
0.14.41
0.14.30
0.14.20
0.14.10
0.14.00
0.13.40
0.13.31
0.13.20
0.13.10
0.13.01
0.12.10
0.12.00
0.11.30
0.11.20
0.11.10
0.11.00

Package Sidebar

Install

npm i @lubert/chess.ts

Weekly Downloads

1

Version

0.16.1

License

BSD-2-Clause

Unpacked Size

419 kB

Total Files

115

Last publish

Collaborators

  • lubert