ea522df516a9e11ea25789fc548e283d7b95a933
[vchess.git] / client / src / variants / Discoduel.js
1 import { ChessRules } from "@/base_rules";
2
3 export class DiscoduelRules extends ChessRules {
4 static get PawnSpecs() {
5 return Object.assign(
6 {},
7 ChessRules.PawnSpecs,
8 { promotions: [V.PAWN] }
9 );
10 }
11
12 static get HasFlags() {
13 return false;
14 }
15
16 scanKings() {}
17
18 static GenRandInitFen() {
19 return "1n4n1/8/8/8/8/8/PPPPPPPP/8 w 0 -";
20 }
21
22 getPotentialMovesFrom(sq) {
23 const moves = super.getPotentialMovesFrom(sq);
24 if (this.turn == 'b')
25 // Prevent pawn captures on last rank:
26 return moves.filter(m => m.vanish.length == 1 || m.vanish[1].x != 0);
27 return moves;
28 }
29
30 filterValid(moves) {
31 return moves;
32 }
33
34 getCheckSquares() {
35 return [];
36 }
37
38 getCurrentScore() {
39 // No real winning condition (promotions count...)
40 if (!this.atLeastOneMove()) return "1/2";
41 return "*";
42 }
43
44 postPlay() {}
45 postUndo() {}
46
47 static get SEARCH_DEPTH() {
48 return 4;
49 }
50 };