1 import { ChessRules
} from "@/base_rules";
3 export class PawnskingRules
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() {
18 static GenRandInitFen() {
19 return "4k3/pppppppp/8/8/8/8/PPPPPPPP/4K3 w 0 -";
31 const color
= this.turn
;
32 if (this.kingPos
[color
][0] < 0) return (color
== "w" ? "0-1" : "1-0");
33 const oppCol
= V
.GetOppCol(color
);
34 const lastRank
= (oppCol
== 'w' ? 0 : 7);
35 if (this.board
[lastRank
].some(cell
=> cell
[0] == oppCol
))
36 // The opposing edge is reached!
37 return (oppCol
== "w" ? "1-0" : "0-1");
38 if (this.atLeastOneMove()) return "*";
44 if (move.vanish
.length
== 2 && move.vanish
[1].p
== V
.KING
)
45 this.kingPos
[this.turn
] = [-1, -1];
50 if (move.vanish
.length
== 2 && move.vanish
[1].p
== V
.KING
)
51 this.kingPos
[move.vanish
[1].c
] = [move.vanish
[1].x
, move.vanish
[1].y
];
54 static get SEARCH_DEPTH() {