1 import { ChessRules
} from "@/base_rules";
3 export class BishopawnsRules
extends ChessRules
{
4 static get PawnSpecs() {
8 // The promotion piece doesn't matter, the game is won
9 { promotions: [V
.QUEEN
] }
13 static get HasFlags() {
19 static GenRandInitFen() {
20 return "8/ppp5/8/8/8/8/8/5B2 w 0 -";
32 // If all pieces of some color vanished, the opponent wins:
33 for (let c
of ['w', 'b']) {
34 if (this.board
.every(b
=> b
.every(cell
=> !cell
|| cell
[0] != c
)))
35 return (c
== 'w' ? "0-1" : "1-0");
37 // Did a black pawn promote? Can the bishop take it?
38 const qIdx
= this.board
[7].findIndex(cell
=> cell
[1] == V
.QUEEN
);
41 (this.turn
== 'b' || !super.isAttackedByBishop([7, qIdx
], 'w'))
45 if (!this.atLeastOneMove()) return "1/2";
52 static get SEARCH_DEPTH() {