Giter Club home page Giter Club logo

chess.ts's Introduction

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

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)

chess.ts's People

Contributors

2sb18 avatar algotrader avatar allonhadaya avatar azer avatar blakmatrix avatar davidmpaz avatar dependabot[bot] avatar erral avatar geary avatar imor avatar jhlywa avatar jtwires avatar jzacsh avatar linrock avatar lubert avatar marcjansen avatar matforsberg avatar maxwell-oroark avatar moroshko avatar ngocdaothanh avatar relequestual avatar sebv avatar siansell avatar simplydt avatar stiff avatar svangordon avatar techbos avatar toffer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.