Xiangqi rules and operations in TypeScript
GPL-3.0 License
Xiangqi rules and operations in TypeScript. This is a port of chessops to xiangqi.
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)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());
elephantops is licensed under the GNU General Public License 3 or any later version at your choice. See LICENSE for details.