Fix HiddenRules
[vchess.git] / client / src / base_rules.js
index 7949d7f..da9fab7 100644 (file)
@@ -46,12 +46,19 @@ export const ChessRules = class ChessRules {
   static get CanAnalyze() {
     return true;
   }
+  // Patch: issues with javascript OOP, objects can't access static fields.
+  get canAnalyze() {
+    return V.CanAnalyze;
+  }
 
   // Some variants show incomplete information,
   // and thus show only a partial moves list or no list at all.
   static get ShowMoves() {
     return "all";
   }
+  get showMoves() {
+    return V.ShowMoves;
+  }
 
   // Turn "wb" into "B" (for FEN)
   static board2fen(b) {
@@ -357,9 +364,9 @@ export const ChessRules = class ChessRules {
       for (let indexInRow = 0; indexInRow < rows[i].length; indexInRow++) {
         const character = rows[i][indexInRow];
         const num = parseInt(character);
+        // If num is a number, just shift j:
         if (!isNaN(num)) j += num;
-        //just shift j
-        //something at position i,j
+        // Else: something at position i,j
         else board[i][j++] = V.fen2board(character);
       }
     }
@@ -1254,7 +1261,7 @@ export const ChessRules = class ChessRules {
   // TODO: un-ambiguous notation (switch on piece type, check directions...)
   getNotation(move) {
     if (move.appear.length == 2 && move.appear[0].p == V.KING)
-      //castle
+      // Castle
       return move.end.y < move.start.y ? "0-0-0" : "0-0";
 
     // Translate final square