Skip to content

Releases: echecsjs/position

v4.0.0

01 May 14:24
2fbc215

Choose a tag to compare

Changed

  • Position constructor accepts a single optional PositionData object instead
    of (board?, options?). Enables new Position(parse(fen)) for direct
    round-trip with @echecs/fen.
  • PositionOptions type renamed to PositionData — adds board field
    alongside the existing 5 option fields.
  • DeriveOptions extends Omit<PositionData, 'board'> instead of
    PositionOptions.

Removed

  • PositionOptions type export — replaced by PositionData.

v3.1.0

28 Apr 18:59
1321b35

Choose a tag to compare

Added

  • Move type — { from: Square; promotion?: PromotionPieceType; to: Square }.
  • PromotionPieceType type — Exclude<PieceType, 'king' | 'pawn'>.

v3.0.5

09 Apr 17:21
d63939b

Choose a tag to compare

Changed

  • added piece and square keywords

v3.0.4

09 Apr 17:00
241db42

Choose a tag to compare

Fixed

  • Corrected constructor parameter type to ReadonlyMap in README.

v3.0.3

08 Apr 21:42
72a1ccc

Choose a tag to compare

Fixed

  • derive() constructor fast path — skips board allocation entirely via
    internal Array.isArray branch. ~2x faster than 3.0.2.

Removed

  • SquareColor type export — unused across all @echecs packages.

v3.0.2

08 Apr 19:28
7185305

Choose a tag to compare

Fixed

  • derive() no longer allocates a throwaway board array — constructor detects
    the internal fast path via Array.isArray, skipping the 128-element fill
    entirely. ~2x faster than 3.0.1, ~24x faster than 3.0.0.

v3.0.1

08 Apr 19:08
a4a68de

Choose a tag to compare

Fixed

  • Position constructor board allocation — replaced Array.from with
    new Array(128).fill(0), ~12x faster derive() calls.

Changed

  • Removed "Zero runtime dependencies" claim from README — package depends on
    @echecs/zobrist since 3.0.0.
  • Removed fen and no-dependencies npm keywords.

Removed

  • BACKLOG.md — all items completed.

v3.0.0

07 Apr 21:55
a061205

Choose a tag to compare

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
    undefined if empty. Replaces piece().
  • Lazy isCheck cache — computed once per position.
  • @echecs/zobrist dependency — 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
    turn are now public readonly fields instead of getters.
  • new Position() now creates an empty board. Pass STARTING_POSITION for the
    standard chess starting position: new Position(STARTING_POSITION).
  • STARTING_POSITION is now a ReadonlyMap<Square, Piece> (the starting board
    map) instead of a Position instance.
  • Constructor accepts ReadonlyMap<Square, Piece> instead of
    Map<Square, Piece>.
  • isCheck reimplemented using reverse-lookup approach (from king, look outward
    for attackers) with the color trick — reuses reach internally.
  • isValid reimplemented 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 by at().

v2.0.1

05 Apr 14:31
bbc64b5

Choose a tag to compare

Fixed

  • Docs CI workflow using renamed script.
  • Lockfile out of sync with dependency versions.

v1.0.3

04 Apr 19:57
baa0018

Choose a tag to compare

Fixed

  • Added @preventExpand JSDoc tag to Square type alias so downstream TypeDoc
    (0.28+) renders it as a reference instead of expanding the 64-member union.