Chess.js Versions Save

A TypeScript chess library for chess move generation/validation, piece placement/movement, and check/checkmate/draw detection

v1.0.0-beta.7

4 months ago

Breaking Changes

These two changes only impact users that retain PGN headers when calling .clear or .load.

  • clear(true) should now be written as clear({ preserveHeader: true })
  • load(myFen, true) should now be written as load(myFen, { preserveHeader: true })

Enhancements

  • Add check for invalid pawn placement in validateFen (@Manukyanq - #412)
  • Update castling rights and en passant square in .put() (@gavin-lb - 55181a90)
  • Add skipValidation option to .load (@jhlywa - e2ff91c7)

Bug Fixes

  • Fix README shield links (@JamJomJim - #416)
  • Fix three-fold repetition to only return true if the immediate position has been repeated 3 times (@gavin-lb - #144)
  • Update internal king cache when overwriting the king via put() (@Manukyanq #426)
  • Always clear Setup and FEN when calling .clear() (@jhlywa - be03fe0)

v1.0.0-beta.6

11 months ago

Enhancements

  • Add methods for getting/setting castling rights (getCastlingRights, setCastlingRights) (@neofight78 - 7cb2d3438299d209d31ecf3d517a62815adefb5a)
  • Ensure put/remove functions update ep square (@neofight78 - #398 )
  • Make moveNumber accessible (@neofight78 - #399)
  • Add support for both ESM and CommonJS environments (@jorgecasar - #406)

v1.0.0-beta.5

11 months ago

Enhancements

  • Add removeHeader method (@angarc - #388)
  • Fixed moves() when there are no kings (@neofight78 - #386)
  • Handle captures with missing ‘x’ (@neofight78 - #385)
  • Add methods for getting/setting castling rights (@neofight78 - #387)

Bug Fixes

  • Revert module type to CommonJS (@jhlywa)

v1.0.0-beta.4

1 year ago

Enhancements

  • Add before and after FEN to Move object (@jhlywa)

Bug Fixes

  • #378 Add optional piece argument to .moves() (@ChrisAntley1)

v1.0.0-beta.3

1 year ago

Bug Fixes

  • #374 Fix major esm inconsistency (@GabrielDelepine )

v1.0.0-beta.2

1 year ago

Bug Fixes

  • #371 Fix type of Move.from and Move.to fields (@MichaelTamm)

v1.0.0-beta.1

1 year ago

Bug Fixes

  • Remove postinstall script
  • Add "types": "dist/chess.d.ts" entry to package.json

v1.0.0-beta.0

1 year ago

Changes

This is a major version update and there are many breaking changes. Please ead below for more info.

Typescript

chess.js has been rewritten in TypeScript. Exported types are as follows:

  • Chess object
  • Piece
  • Color
  • Square
  • PieceSymbol
  • Move

Exceptions

The following functions no longer return null in the event of an error. They now throw exceptions. This change was made to provide the user with more informative error messages.

  • .load()
  • .loadPgn()
  • .move()
  • Chess() constructor

Function Names

The functions below have been renamed and are now camel-cased:

  • game_over -> isGameOver
  • in_check -> isCheck
  • in_checkmate -> isCheckmate
  • in_draw -> isDraw
  • is_stalemate -> isStalemate
  • in_threefold_repetition -> isThreefoldRepetition
  • insufficient_material -> isInsufficientMaterial
  • load_pgn -> loadPgn
  • set_comment -> setComment
  • get_comment -> getComment
  • get_comments -> getComments
  • delete_comment -> deleteComment
  • delete_comments -> deleteComments
  • validate_fen -> validateFen

Improvements

  • Change .load to throw an exception when loading invalid FEN (#ac977ed)
  • Change .move to throw an exception on illegal move (#8523db8)
  • Change .loadPgn to throw an exception when encountered error (#TODO)
  • Allow the user to omit castling rights, en passant square, and move numbers when calling .load (#8523db8)
  • Add isAttacked to determine attackers of a specific square (#9b49454)
  • Validate king presence in validateFen (#a137478)
  • Allow spaces between the bracket and tag in PGN header (#5f48a68)
  • Allow user to specify a promotion piece (when supplying a verbose move) even if the move is not a promotion (#8e71084)
  • Add a fen field FEN position when calling .history

Bug Fixes

  • Fix loadPgn() to handle PGN without any moves (#d12f78f)
  • Fix pgn() export when comment precedes black to move (#4fd6069)

v1.0.0-alpha.0

1 year ago

v0.13.4

1 year ago

Bug Fixes

  • [PGN] Fix bug that omitted comments preceding the initial move of a setup position when black is the first to move.