1daae907556a43360be5ea1ed575d184893771d1
1 import { ChessRules
} from "@/base_rules";
3 export class RookpawnsRules
extends ChessRules
{
5 static get PawnSpecs() {
9 // The promotion piece doesn't matter, the game is won
10 { promotions: [V
.QUEEN
] }
14 static get HasFlags() {
20 static GenRandInitFen() {
21 return "8/ppppp3/8/8/8/8/8/7R w 0 -";
33 // If all pieces of some color vanished, the opponent wins:
34 for (let c
of ['w', 'b']) {
35 if (this.board
.every(b
=> b
.every(cell
=> !cell
|| cell
[0] != c
)))
36 return (c
== 'w' ? "0-1" : "1-0");
38 // Did a black pawn promote? Can the rook take it?
39 const qIdx
= this.board
[7].findIndex(cell
=> cell
[1] == V
.QUEEN
);
42 (this.turn
== 'b' || !super.isAttackedByRook([7, qIdx
], 'w'))
46 if (!this.atLeastOneMove()) return "1/2";
53 static get SEARCH_DEPTH() {