Draft Circular Chess
[vchess.git] / client / src / base_rules.js
index 85f63a2..4b9a139 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) {
@@ -267,12 +274,13 @@ export const ChessRules = class ChessRules {
       pieces[c][knight2Pos] = "n";
       pieces[c][rook2Pos] = "r";
     }
+    // Add turn + flags + enpassant
     return (
       pieces["b"].join("") +
       "/pppppppp/8/8/8/8/PPPPPPPP/" +
       pieces["w"].join("").toUpperCase() +
       " w 0 1111 -"
-    ); //add turn + flags + enpassant
+    );
   }
 
   // "Parse" FEN: just return untransformed string data
@@ -1254,7 +1262,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