Improve Chakart rules (captures after banana/bomb redirection)
[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
17 static GenRandInitFen() {
18 return "8/pppppppp/8/8/8/8/PPPPPPPP/8 w 0 -";
19 }
20
21 filterValid(moves) {
22 return moves;
23 }
24
25 getCheckSquares() {
26 return [];
27 }
28
29 getCurrentScore() {
30 const oppCol = V.GetOppCol(this.turn);
31 if (this.board.some(b =>
32 b.some(cell => cell[0] == oppCol && cell[1] != V.PAWN))
33 ) {
34 return (oppCol == 'w' ? "1-0" : "0-1");
35 }
36 if (!this.atLeastOneMove()) return "1/2";
37 return "*";
38 }
39};