Skip to content
Projets

À propos

Une bibliothèque d’échecs TypeScript pour générer et valider les coups, placer et déplacer les pièces, et détecter les échecs, les échecs et mats et les parties nulles.

Outils de développement

Comment ces chiffres sont mesurés

Progression mesurée des étoiles

in 24h
+2
in 7 days
+7
in 15 days
+16
in 1 month
+27

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

logo

chess.js

GitHub Workflow Status npm npm

chess.js is a TypeScript chess library used for chess move generation/validation, piece placement/movement, and check/checkmate/stalemate detection - basically everything but the AI.

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

Documentation

This README provides a quick example, full documentation can be found at https://jhlywa.github.io/chess.js.

Installation

Run the following command to install the most recent version of chess.js from NPM:

npm install chess.js

Example Code

The code below plays a random game of chess:

import { Chess } from 'chess.js'

const chess = new Chess()

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

Contributing

If you have any questions, suggestions, or find any bugs please open an issue. PRs are very welcome too, please read the Contributing Guide first to help make it a smooth process.

Explorer des projets similaires

Chargement…