Fix CastleChess
authorBenjamin Auder <benjamin.auder@somewhere>
Tue, 8 Sep 2020 15:19:26 +0000 (17:19 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Tue, 8 Sep 2020 15:19:26 +0000 (17:19 +0200)
client/src/variants/Castle.js

index af3710c..e6b0470 100644 (file)
@@ -4,9 +4,11 @@ export class CastleRules extends ChessRules {
   getCurrentScore() {
     const baseScore = super.getCurrentScore();
     if (baseScore != '*') return baseScore;
-    if (this.getPiece(0,2) == V.KING && this.getPiece(0,3) == V.ROOK)
-      return "0-1";
-    if (this.castleFlags['b'][0] >= 8) return "1-0";
+    if (this.castleFlags['b'][0] >= 8) {
+      if (this.getPiece(0,2) == V.KING && this.getPiece(0,3) == V.ROOK)
+        return "0-1";
+      return "1-0";
+    }
     return '*';
   }
 };