Change castle flags. Eightpieces still not OK, but almost
[vchess.git] / client / src / variants / Hidden.js
index c79267a..79c3dfb 100644 (file)
@@ -16,9 +16,9 @@ export const VariantRules = class HiddenRules extends ChessRules {
     return false;
   }
 
-  // Moves are revealed only when game ends
+  // Moves are revealed only when game ends, but are highlighted on board
   static get ShowMoves() {
-    return "none";
+    return "highlight";
   }
 
   static get HIDDEN_DECODE() {
@@ -74,7 +74,7 @@ export const VariantRules = class HiddenRules extends ChessRules {
   }
 
   // Scan board for kings positions (no castling)
-  scanKingsRooks(fen) {
+  scanKings(fen) {
     this.kingPos = { w: [-1, -1], b: [-1, -1] };
     const fenRows = V.ParseFen(fen).position.split("/");
     for (let i = 0; i < fenRows.length; i++) {
@@ -157,6 +157,7 @@ export const VariantRules = class HiddenRules extends ChessRules {
     return moves;
   }
 
+  // Ignore randomness here: placement is always random asymmetric
   static GenRandInitFen() {
     let pieces = { w: new Array(8), b: new Array(8) };
     // Shuffle pieces + pawns on two first ranks
@@ -224,8 +225,8 @@ export const VariantRules = class HiddenRules extends ChessRules {
     return [];
   }
 
-  updateVariables(move) {
-    super.updateVariables(move);
+  postPlay(move) {
+    super.postPlay(move);
     if (
       move.vanish.length >= 2 &&
       [V.KING,V.HIDDEN_CODE[V.KING]].includes(move.vanish[1].p)
@@ -235,8 +236,8 @@ export const VariantRules = class HiddenRules extends ChessRules {
     }
   }
 
-  unupdateVariables(move) {
-    super.unupdateVariables(move);
+  postUndo(move) {
+    super.postUndo(move);
     const c = move.vanish[0].c;
     const oppCol = V.GetOppCol(c);
     if (this.kingPos[oppCol][0] < 0)