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