chessops/pgn
: Allow and normalize en-dash and em-dash inResult
header, result marker, and castling notation.
- Set
"type": "module"
inpackage.json
.
- Change package layout to hybrid cjs/esm with subpath exports.
chessops/pgn
:- Add
Node.mainlineNodes()
. - Add
node.end()
. - Add
extend()
.
- Add
Position.fromSetup()
now only checks minimum validity requirements. RemoveFromSetupOpts
. In particular:- As before, bad
setup.castlingRights
(formerlysetup.unmovedRooks
) are silently dropped. But note changes to FEN parsing. - As before, a bad
setup.epSquare
is silently dropped. - As before, non-standard material is allowed.
Use
isStandardMaterial()
if strict validation is needed. - As before, the side to move cannot be giving check.
- Unlike before, some other positions involving impossibly many checkers
are no longer rejected. Use
isImpossibleCheck()
if strict validation is needed. This is more consistent with the other relaxed choices above, more consistent with Lichess's behavior, and aids tree-shaking.
- As before, bad
- The FEN parser and writer now preserve syntactically valid castling rights
even if there is no matching rook or king. Rename
unmovedRooks
tocastlingRights
. - Add
{Material,MaterialSide}.subtract()
. - Add
squareFromCoords()
tochessops/util
. - Fix impossible checker validation for
Atomic
. - Fix en passant in some impossible check situations.
Marked as deprecated on npm. Accidentally included semver-breaking changes.
- Implement insufficient material detection for
Horde
.
- Add
rookCastlesTo
tochessops/util
.
- Changes to
chessops/pgn
:- Support multiple PGN headers and move text all on the same line.
- Reject
%eval
with more than 2 decimals or more than 5 digits. - Reject
%clk
and%emt
with more than 3 decimals.
- Support eval PGN comment annotations.
- Fix PGN comment roundtrip by leaving additional spaces in the text.
- Fix parsing X-FEN with file notation for black castling rights. Bug discovered using new fuzz-testing suite.
- Improvements for
chessops/pgn
:- Add
defaultGame()
. - Add
isChildNode()
. - Add
parseComment()
andmakeComment()
. - Add
Box
for wrapping immutable context in transformations.
- Add
- Detect Antichess insufficient material with two knights.
- Add more aliases for PGN
Variant
headers. - Fix en passant in Antichess.
- Major performance optimizations (e.g. 40% speedup in read-pgn example).
- Refactor with tree-shaking in mind, for major code size improvements depending on the application. Do not find a method? It might now be a free-standing function.
- Chess variants directly extend
Position
instead ofChess
. - Remove
Board.horde()
andBoard.racingKings()
. - Rename
Castles.discardSize()
todiscardColor()
.
- Introduce
chessops/pgn
module. - Remove
chessops/hash
module. - Fix capturing promoted Crazyhouse pieces.
- Rename
Material.count()
andMaterialSide.count()
tosize()
. AddMaterial.count(role)
. - Add
Position.isStandardMaterial()
. - Remove
FenOpts.shredder
. - Track promoted pieces only in Crazyhouse. Remove
FenOpts.promoted
. - Let
parseSan()
require the original file for pawn captures (good:exd5
, bad:d5
if capturing). - Target ES2018.
- Check that en passant square and checkers are not in conflict.
- Accept castling flags in FEN in any order, duplicate flags, but no more than two distinct castling rights per side.
- Accept multiple spaces and underscores as FEN field seperators.
- Add
.js
ending to relative imports (required for ES modules). - Introduce
FromSetupOpts
withignoreImpossibleCheck
.
- Fix
ThreeCheck
not updating remaining checks.
- Fix
Atomic
position validation, where the remaining king is attacked, but the other king has exploded.
- Export
RacingKings
fromchessops/variant
. - Export
FenOpts
fromchessops/fen
.
- Renamed
lichessVariantRules()
tolichessRules()
, added the inverse functionlichessVariant()
.
- Now built as ES module (instead of CommonJS).
- Made
kingCastlesTo()
public.
- Moved
FILES
andRANKS
fromchessops/util
tochessops/types
, renamed toFILE_NAMES
andRANK_NAMES
, and added correspondingFileName
andRankName
string literal types. - Also reject positions where a checker is aligned with the en passant square
and the king as
IllegalSetup.ImpossibleCheck
.
- Added
IllegalSetup.ImpossibleCheck
and will now reject setups with too many checkers or aligned sliding checkers. These positions are impossible to reach and Stockfish does not work properly on them. - Added
equals()
to most classes,Board.equalsIgnorePromoted()
, andPosition.equalsIgnoreMoves()
.
- Fixed
parseSan()
to properly interpret moves likebxc6
as a pawn capture instead of a bishop move. Lowercase piece letters are no longer accepted, e.g.,nf3
must beNf3
. - Fixed
Position.isLegal()
was not accepting the king-moves-two-squares encoding for castling castling moves.
- Fixed insufficient material with same-color bishops on both sides.
- Fixed
parseSan
with regard to pawn captures, promotions and some disambiguated moves.
- Added
parseSan()
. - Added
chessgroundMove()
compatibility. - Added
FILES
andRANKS
constants. - Fix spelling of export:
transfrom()
->transform()
. - Added
{MaterialSide,Material}.{fromBoard,add}()
. - Clamp move counters in FEN export for guaranteed reparsability.
- Reject promotions not on backrank.
- Micro-optimizations.
- Updated
chessgroundDests()
for chessground 7.8 compatibility. - Added
chessgroundDests(pos, {chess960: true})
to generate only Chess960-style castling moves. - Renamed
scalachessId()
toscalachessCharPair()
.
- Removed
util.squareDist()
. - Further optimized initialization.
- Packaged source map.
- Performance optimizations, significantly faster initilization.
- Added
SquareSet.withoutFirst()
. - Bumped target to ES2016.
- Added
lichessVariantRules()
compatibility.
- Renamed
Uci
toMove
,UciMove
toNormalMove
,UciDrop
toDropMove
, andisMove()
toisNormal()
. - Renamed
uciCharPair()
toscalachessId()
. - All
ctx
parameters are now optional. - Added
index
module with re-exports.
- Fixed alternative queenside castling moves (king moved by two squares instead of onto rook). These moves were not correctly classified, normalized or played.
- Added
compat
module for chessground and scalachess interoperability. - Added
Position.castlingSide()
. - Added
Position.normalizeMove()
. - Overloaded
parseSquare()
for known validSquareName
.
- Fixed castling paths in
Castles.default()
andChess.default()
, leading to illegal king moves.
- Fixed Racing Kings move generation with king near goal.
- Pawn drops in Crazyhouse reset
pos.halfmoves
.
- Fixed SAN of en passant captures.
- Optimize SAN disambiguation by adding a fast path for unambiguous moves.
- Renamed
san.makeVariationSan()
tosan.makeSanVariation()
. - Fixed SAN disambiguation on b and c file.
- Fixed check from a1.
- Fixed insufficient material with same-color bishops.
- Fixed Crazyhouse validation and limit pocket size.
- Fixed
Position.fromSetup()
entangles position with setup. - Made
Position.rules()
a read-only propertyPosition.rules
. - Removed
SquareSet.subsets()
. - Removed
utils.strRepeat()
. - Micro optimizations and misc non-functional tweaks.
- First release.