elephantops
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

elephantops

Test npm

Xiangqi rules and operations in TypeScript. This is a port of chessops to xiangqi.

Documentation

View TypeDoc

Features

  • Read and write FEN
  • Vocabulary
    • Square
    • SquareSet (implemented as bitboards)
    • Color
    • Role (piece type)
    • Piece (Role and Color)
    • Board (map of piece positions)
    • Setup (a not necessarily legal position)
    • Position (base class for legal positions, Xiangqi is a concrete implementation)
    • Move making
    • Legal move generation
    • Game end and outcome
    • Insufficient material
    • Setup validation
  • Attacks and rays
  • Read and write UCCI move notation
  • Read and write SAN
  • Read and write PGN
    • Parser supports asynchronous streaming
    • Game tree model
    • Transform game tree to augment nodes with arbitrary user data
    • Parse comments with evaluations, clocks and shapes
  • Compatibility: xiangqiground

Example

import { parseFen } from 'elephantops/fen';
import { Xiangqi } from 'elephantops/xiangqi';

const setup = parseFen(
  '1nbakabn1/r7r/1c7/p1p1C1p1p/4C2c1/9/P1P1P1P1P/9/9/RNBAKABNR b - - 4 4',
).unwrap();
const pos = Xiangqi.fromSetup(setup).unwrap();
console.assert(pos.isCheckmate());

License

elephantops is licensed under the GNU General Public License 3 or any later version at your choice. See LICENSE for details.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.19latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.19
0.1.00

Package Sidebar

Install

npm i elephantops

Weekly Downloads

9

Version

0.1.1

License

GPL-3.0-or-later

Unpacked Size

474 kB

Total Files

87

Last publish

Collaborators

  • lucaferranti