Commit | Line | Data |
---|---|---|
375ecdd1 BA |
1 | class Chess960Rules extends ChessRules |
2 | { | |
3 | // Standard rules, in the shadow | |
4 | setOtherVariables(fen) | |
5 | { | |
6 | super.setOtherVariables(fen); | |
7 | const [sizeX,sizeY] = {V.size.x,V.size.y}; | |
8 | this.enlightened = { | |
9 | "w": doubleArray(sizeX,sizeY,false), | |
10 | "b": doubleArray(sizeX,sizeY,false) | |
11 | }; | |
12 | setup enlightened: squares reachable by each side (TODO: one side would be enough) | |
13 | } | |
14 | ||
15 | isEnlightened(x, y, color) | |
16 | { | |
17 | //TODO: artificlaly change turn | |
18 | } | |
19 | ||
20 | getAllPotentialMoves() | |
21 | { | |
22 | let moves = []; //TODO | |
23 | } | |
24 | ||
25 | atLeastOneMove() | |
26 | { | |
27 | if (this.kingPos[this.turn][0] < 0) | |
28 | return false; | |
29 | return true; //TODO: is it right? | |
30 | } | |
31 | ||
32 | underCheck(move) | |
33 | { | |
34 | return false; //there is no check | |
35 | } | |
36 | ||
37 | getCheckSquares(move) | |
38 | { | |
39 | const c = this.getOppCol(this.turn); //opponent | |
40 | const saveKingPos = this.kingPos[c]; //king might be taken | |
41 | this.play(move); | |
42 | // The only way to be "under check" is to have lost the king (thus game over) | |
43 | let res = this.kingPos[c][0] < 0 | |
44 | ? [JSON.parse(JSON.stringify(saveKingPos))] | |
45 | : []; | |
46 | this.undo(move); | |
47 | return res; | |
48 | } | |
49 | ||
50 | // NOTE: no (un)updateVariables() because no computer mode | |
51 | // --> but isEnlightened() should have its variable updated | |
52 | // --> in fact an array is enough (no need for a function) | |
53 | // recomputed after every play/undo (although there are no undo here for now) | |
54 | ||
55 | checkGameEnd() | |
56 | { | |
57 | // No valid move: our king disappeared | |
58 | return this.turn == "w" ? "0-1" : "1-0"; | |
59 | } | |
60 | ||
61 | static get THRESHOLD_MATE() | |
62 | { | |
63 | return 500; //checkmates evals may be slightly below 1000 | |
64 | } | |
65 | } | |
66 | ||
67 | const VariantRules = DarkRules; |