1 class Chess960Rules
extends ChessRules
3 // Standard rules, in the shadow
6 super.setOtherVariables(fen
);
7 const [sizeX
,sizeY
] = {V
.size
.x
,V
.size
.y
};
9 "w": doubleArray(sizeX
,sizeY
,false),
10 "b": doubleArray(sizeX
,sizeY
,false)
12 setup
enlightened: squares reachable by each
side (TODO: one side would be enough
)
15 isEnlightened(x
, y
, color
)
17 //TODO: artificlaly change turn
20 getAllPotentialMoves()
22 let moves
= []; //TODO
27 if (this.kingPos
[this.turn
][0] < 0)
29 return true; //TODO: is it right?
34 return false; //there is no check
39 const c
= this.getOppCol(this.turn
); //opponent
40 const saveKingPos
= this.kingPos
[c
]; //king might be taken
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
))]
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)
57 // No valid move: our king disappeared
58 return this.turn
== "w" ? "0-1" : "1-0";
61 static get THRESHOLD_MATE()
63 return 500; //checkmates evals may be slightly below 1000
67 const VariantRules
= DarkRules
;