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