Almost debugged Eightpieces variant
[vchess.git] / client / src / base_rules.js
index 1c5eabc..41ebc14 100644 (file)
@@ -1034,13 +1034,13 @@ export const ChessRules = class ChessRules {
         move.start.x == firstRank && //our rook moves?
         this.INIT_COL_ROOK[c].includes(move.start.y)
       ) {
-        const flagIdx = move.start.y == this.INIT_COL_ROOK[c][0] ? 0 : 1;
+        const flagIdx = (move.start.y == this.INIT_COL_ROOK[c][0] ? 0 : 1);
         this.castleFlags[c][flagIdx] = false;
       } else if (
         move.end.x == oppFirstRank && //we took opponent rook?
         this.INIT_COL_ROOK[oppCol].includes(move.end.y)
       ) {
-        const flagIdx = move.end.y == this.INIT_COL_ROOK[oppCol][0] ? 0 : 1;
+        const flagIdx = (move.end.y == this.INIT_COL_ROOK[oppCol][0] ? 0 : 1);
         this.castleFlags[oppCol][flagIdx] = false;
       }
     }
@@ -1058,7 +1058,7 @@ export const ChessRules = class ChessRules {
   play(move) {
     // DEBUG:
 //    if (!this.states) this.states = [];
-//    const stateFen = this.getBaseFen() + this.getTurnFen() + this.getFlagsFen();
+//    const stateFen = this.getBaseFen() + this.getTurnFen();// + this.getFlagsFen();
 //    this.states.push(stateFen);
 
     if (V.HasFlags) move.flags = JSON.stringify(this.aggregateFlags()); //save flags (for undo)
@@ -1078,7 +1078,7 @@ export const ChessRules = class ChessRules {
     this.unupdateVariables(move);
 
     // DEBUG:
-//    const stateFen = this.getBaseFen() + this.getTurnFen() + this.getFlagsFen();
+//    const stateFen = this.getBaseFen() + this.getTurnFen();// + this.getFlagsFen();
 //    if (stateFen != this.states[this.states.length-1]) debugger;
 //    this.states.pop();
   }