Fix Eightpieces, add some simple variants, add a basic variants classification instea...
[vchess.git] / client / src / variants / Pawnmassacre.js
diff --git a/client/src/variants/Pawnmassacre.js b/client/src/variants/Pawnmassacre.js
new file mode 100644 (file)
index 0000000..563fd00
--- /dev/null
@@ -0,0 +1,18 @@
+import { ChessRules } from "@/base_rules";
+
+export class PawnmassacreRules extends ChessRules {
+  static get HasFlags() {
+    return false;
+  }
+
+  static GenRandInitFen(randomness) {
+    return (
+      ChessRules.GenRandIntFen(randomness)
+      // Remove castle flags
+      .slice(0, -6).concat("-")
+      .replace("PPPPPPPP", "pppppppp")
+      // Next replacement is OK because only acts on first occurrence
+      .replace("pppppppp", "PPPPPPPP")
+    );
+  }
+};