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