Some fixes + draft Avalanche
[vchess.git] / client / src / variants / Pawns.js
1 import { ChessRules } from "@/base_rules";
2
3 export class PawnsRules extends ChessRules {
4
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
18 scanKings() {}
19
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 }
42
43 postPlay() {}
44 postUndo() {}
45
46 static get SEARCH_DEPTH() {
47 return 4;
48 }
49
50 };