A TypeScript chess library for chess move generation/validation, piece placement/movement, and check/checkmate/draw detection
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 })
.put()
(@gavin-lb - 55181a90)skipValidation
option to .load
(@jhlywa - e2ff91c7)put()
(@Manukyanq #426)getCastlingRights
, setCastlingRights
) (@neofight78 - 7cb2d3438299d209d31ecf3d517a62815adefb5a)moveNumber
accessible (@neofight78 - #399)This is a major version update and there are many breaking changes. Please ead below for more info.
chess.js has been rewritten in TypeScript. Exported types are as follows:
Chess
objectPiece
Color
Square
PieceSymbol
Move
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()
constructorThe 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
.load
to throw an exception when loading invalid FEN (#ac977ed).move
to throw an exception on illegal move (#8523db8).loadPgn
to throw an exception when encountered error (#TODO).load
(#8523db8)isAttacked
to determine attackers of a specific square (#9b49454)validateFen
(#a137478)fen
field FEN position when calling .history
loadPgn()
to handle PGN without any moves (#d12f78f)pgn()
export when comment precedes black to move (#4fd6069)