Fix getCurrentScore in Racingkings variant
authorBenjamin Auder <benjamin.auder@somewhere>
Thu, 12 Mar 2020 15:59:08 +0000 (16:59 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Thu, 12 Mar 2020 15:59:08 +0000 (16:59 +0100)
client/src/variants/Racingkings.js

index 21d5c85..f1161fc 100644 (file)
@@ -44,7 +44,8 @@ export const VariantRules = class RacingkingsRules extends ChessRules {
       // at next move, then it should be a draw:
       if (color == "w" && this.kingPos['b'][0] == 1) {
         // Search for a move
-        const oppKingMoves = this.getPotentialKingMoves(this.kingPos['b']);
+        const oppKingMoves = this.filterValid(
+          this.getPotentialKingMoves(this.kingPos['b']));
         if (oppKingMoves.some(m => m.end.x == 0)) return "*";
       }
       return color == "w" ? "1-0" : "0-1";