v1.0.0-beta.0
Pre-release
Pre-release
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
objectPiece
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)