Several small improvements + integrate options + first working draft of Cwda
[vchess.git] / client / src / variants / Pawns.js
CommitLineData
964eda04
BA
1import { ChessRules } from "@/base_rules";
2
3export class PawnsRules extends ChessRules {
7e8a7ea1 4
4313762d
BA
5 static get Options() {
6 return null;
7 }
8
964eda04
BA
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
737a5daf
BA
22 scanKings() {}
23
964eda04
BA
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 }
737a5daf
BA
46
47 postPlay() {}
48 postUndo() {}
49
50 static get SEARCH_DEPTH() {
51 return 4;
52 }
7e8a7ea1 53
964eda04 54};