From aafc804f005917facbdc85b870d7b109fbac13e5 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Tue, 8 Sep 2020 17:19:26 +0200
Subject: [PATCH] Fix CastleChess

---
 client/src/variants/Castle.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/client/src/variants/Castle.js b/client/src/variants/Castle.js
index af3710c9..e6b0470d 100644
--- a/client/src/variants/Castle.js
+++ b/client/src/variants/Castle.js
@@ -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 '*';
   }
 };
-- 
2.44.0