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