Fix king tracking in Fusion variant
[vchess.git] / client / src / variants / Pawns.js
CommitLineData
964eda04
BA
1import { ChessRules } from "@/base_rules";
2
3export class PawnsRules extends ChessRules {
7e8a7ea1 4
964eda04
BA
5 static get PawnSpecs() {
6 return Object.assign(
7 {},
8 ChessRules.PawnSpecs,
9 // The promotion piece doesn't matter, the game is won
10 { promotions: [V.QUEEN] }
11 );
12 }
13
14 static get HasFlags() {
15 return false;
16 }
17
737a5daf
BA
18 scanKings() {}
19
964eda04
BA
20 static GenRandInitFen() {
21 return "8/pppppppp/8/8/8/8/PPPPPPPP/8 w 0 -";
22 }
23
24 filterValid(moves) {
25 return moves;
26 }
27
28 getCheckSquares() {
29 return [];
30 }
31
32 getCurrentScore() {
33 const oppCol = V.GetOppCol(this.turn);
34 if (this.board.some(b =>
35 b.some(cell => cell[0] == oppCol && cell[1] != V.PAWN))
36 ) {
37 return (oppCol == 'w' ? "1-0" : "0-1");
38 }
39 if (!this.atLeastOneMove()) return "1/2";
40 return "*";
41 }
737a5daf
BA
42
43 postPlay() {}
44 postUndo() {}
45
46 static get SEARCH_DEPTH() {
47 return 4;
48 }
7e8a7ea1 49
964eda04 50};