27fc90fec79bba910f69b1bd2dc9887c18bfbc26
1 import { ChessRules
} from "@/base_rules";
3 export class PawnskingRules
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() {
22 static GenRandInitFen() {
23 return "4k3/pppppppp/8/8/8/8/PPPPPPPP/4K3 w 0 -";
35 const color
= this.turn
;
36 if (this.kingPos
[color
][0] < 0) return (color
== "w" ? "0-1" : "1-0");
37 const oppCol
= V
.GetOppCol(color
);
38 const lastRank
= (oppCol
== 'w' ? 0 : 7);
39 if (this.board
[lastRank
].some(cell
=> cell
[0] == oppCol
))
40 // The opposing edge is reached!
41 return (oppCol
== "w" ? "1-0" : "0-1");
42 if (this.atLeastOneMove()) return "*";
48 if (move.vanish
.length
== 2 && move.vanish
[1].p
== V
.KING
)
49 this.kingPos
[this.turn
] = [-1, -1];
54 if (move.vanish
.length
== 2 && move.vanish
[1].p
== V
.KING
)
55 this.kingPos
[move.vanish
[1].c
] = [move.vanish
[1].x
, move.vanish
[1].y
];
58 static get SEARCH_DEPTH() {