Fix non-augmenting self absorptions
authorBenjamin Auder <benjamin.auder@somewhere>
Sun, 17 Jan 2021 04:31:24 +0000 (05:31 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Sun, 17 Jan 2021 04:31:24 +0000 (05:31 +0100)
client/src/variants/Selfabsorption.js

index edfa09f..e7d3c07 100644 (file)
@@ -10,7 +10,9 @@ export class SelfabsorptionRules extends AbsorptionRules {
     return (
       p1 != p2 &&
       [V.QUEEN, V.ROOK, V.KNIGHT, V.BISHOP].includes(p1) &&
-      [V.QUEEN, V.ROOK, V.KNIGHT, V.BISHOP].includes(p2)
+      [V.QUEEN, V.ROOK, V.KNIGHT, V.BISHOP].includes(p2) &&
+      (p1 != V.QUEEN || p2 == V.KNIGHT) &&
+      (p2 != V.QUEEN || p1 == V.KNIGHT)
     );
   }