elephantops
v0.1.1
Published
Xiangqi rules and operations
Downloads
9
Maintainers
Readme
elephantops
Xiangqi rules and operations in TypeScript. This is a port of chessops to xiangqi.
Documentation
Features
- Read and write FEN
- Vocabulary
SquareSquareSet(implemented as bitboards)ColorRole(piece type)Piece(RoleandColor)Board(map of piece positions)Setup(a not necessarily legal position)Position(base class for legal positions,Xiangqiis 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.
