1b02dcfcd469e71f3a0e401c10c7e759e4c3bcc3
1 import { ChessRules
} from "@/base_rules";
3 export class QueenpawnsRules
extends ChessRules
{
9 static get PawnSpecs() {
13 // The promotion piece doesn't matter, the game is won
14 { promotions: [V
.QUEEN
] }
18 static get HasFlags() {
24 static GenRandInitFen() {
25 return "3q4/8/8/8/8/8/PPPPPPPP/8 w 0 -";
37 // If all pieces of some color vanished, the opponent wins:
38 for (let c
of ['w', 'b']) {
39 if (this.board
.every(b
=> b
.every(cell
=> !cell
|| cell
[0] != c
)))
40 return (c
== 'w' ? "0-1" : "1-0");
42 // Did a white pawn promote? Can the queen (in turn) take it?
43 const qIdx
= this.board
[0].findIndex(cell
=> cell
== "wq");
46 (this.turn
== 'w' || !super.isAttackedByQueen([0, qIdx
], 'b'))
50 if (!this.atLeastOneMove()) return "1/2";
57 static get SEARCH_DEPTH() {