Releases: echecsjs/position
Releases · echecsjs/position
v4.0.0
Changed
Positionconstructor accepts a single optionalPositionDataobject instead
of(board?, options?). Enablesnew Position(parse(fen))for direct
round-trip with@echecs/fen.PositionOptionstype renamed toPositionData— addsboardfield
alongside the existing 5 option fields.DeriveOptionsextendsOmit<PositionData, 'board'>instead of
PositionOptions.
Removed
PositionOptionstype export — replaced byPositionData.
v3.1.0
Added
Movetype —{ from: Square; promotion?: PromotionPieceType; to: Square }.PromotionPieceTypetype —Exclude<PieceType, 'king' | 'pawn'>.
v3.0.5
Changed
- added
pieceandsquarekeywords
v3.0.4
Fixed
- Corrected constructor parameter type to
ReadonlyMapin README.
v3.0.3
Fixed
derive()constructor fast path — skips board allocation entirely via
internalArray.isArraybranch. ~2x faster than 3.0.2.
Removed
SquareColortype export — unused across all@echecspackages.
v3.0.2
Fixed
derive()no longer allocates a throwaway board array — constructor detects
the internal fast path viaArray.isArray, skipping the 128-element fill
entirely. ~2x faster than 3.0.1, ~24x faster than 3.0.0.
v3.0.1
Fixed
Positionconstructor board allocation — replacedArray.fromwith
new Array(128).fill(0), ~12x fasterderive()calls.
Changed
- Removed "Zero runtime dependencies" claim from README — package depends on
@echecs/zobristsince 3.0.0. - Removed
fenandno-dependenciesnpm keywords.
Removed
BACKLOG.md— all items completed.
v3.0.0
Added
Position.prototype.reach(square, piece)method — from a square, return all
squares the given piece can reach on the current board. Filters same-color
pieces. Includes pawn pushes (single and double), captures, and en passant.Position.prototype.at(square)method — returns the piece on a square, or
undefinedif empty. Replacespiece().- Lazy
isCheckcache — computed once per position. @echecs/zobristdependency — Polyglot standard Zobrist hash keys.
Changed
- Position internals rewritten to use bitmask 0x88 array as single source of
truth.Map<Square, Piece>no longer stored internally. castlingRights,enPassantSquare,fullmoveNumber,halfmoveClock, and
turnare now public readonly fields instead of getters.new Position()now creates an empty board. PassSTARTING_POSITIONfor the
standard chess starting position:new Position(STARTING_POSITION).STARTING_POSITIONis now aReadonlyMap<Square, Piece>(the starting board
map) instead of aPositioninstance.- Constructor accepts
ReadonlyMap<Square, Piece>instead of
Map<Square, Piece>. isCheckreimplemented using reverse-lookup approach (from king, look outward
for attackers) with the color trick — reusesreachinternally.isValidreimplemented using the same approach.- Zobrist hash now uses Polyglot standard keys for interoperability with opening
books and other engines. - Flattened internal module structure — removed
internal/directory.
Removed
Position.prototype.attackers()method.Position.prototype.isAttacked()method.Position.prototype.piece()method — replaced byat().
v2.0.1
Fixed
- Docs CI workflow using renamed script.
- Lockfile out of sync with dependency versions.
v1.0.3
Fixed
- Added
@preventExpandJSDoc tag toSquaretype alias so downstream TypeDoc
(0.28+) renders it as a reference instead of expanding the 64-member union.