Add a few variants
authorBenjamin Auder <benjamin.auder@somewhere>
Mon, 2 May 2022 12:38:36 +0000 (14:38 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Mon, 2 May 2022 12:38:36 +0000 (14:38 +0200)
14 files changed:
variants.js
variants/Madrasi/rules.html
variants/Progressive/class.js [new file with mode: 0644]
variants/Progressive/rules.html [new file with mode: 0644]
variants/Progressive/style.css [new file with mode: 0644]
variants/Recycle/class.js [new file with mode: 0644]
variants/Recycle/rules.html [new file with mode: 0644]
variants/Recycle/style.css [new file with mode: 0644]
variants/Rifle/class.js [new file with mode: 0644]
variants/Rifle/rules.html [new file with mode: 0644]
variants/Rifle/style.css [new file with mode: 0644]
variants/Teleport/class.js [new file with mode: 0644]
variants/Teleport/rules.html [new file with mode: 0644]
variants/Teleport/style.css [new file with mode: 0644]

index 9111e07..8cb1902 100644 (file)
@@ -7,7 +7,7 @@ const variants = [
 //  { name: 'Allmate', desc: 'Mate any piece' },
 //  { name: 'Ambiguous', desc: "Play opponent's pieces" },
 //  { name: 'Antiking1', desc: 'Keep antiking in check', disp: 'Anti-King' },
-//  { name: 'Antimatter', desc: 'Dangerous collisions', disp: 'Antimatter' },
+//  { name: 'Antimatter', desc: 'Dangerous collisions' },
 //  { name: 'Apocalypse', desc: 'The end of the world' },
 //  { name: 'Arena', desc: 'Middle battle' },
 //  { name: 'Atarigo', desc: 'First capture wins', disp: 'Atari-Go' },
@@ -49,7 +49,7 @@ const variants = [
 //  { name: 'Doublearmy', desc: '64 pieces on the board', disp: 'Double Army' },
   { name: 'Doublemove', desc: 'Double moves' },
 //  { name: 'Dynamo', desc: 'Push and pull' },
-//  { name: 'Eightpieces', desc: 'Each piece is unique', disp: '8-Pieces' },
+//  { name: 'Eightpieces', desc: 'Each piece is unique', disp: '8 Pieces' },
 //  { name: 'Emergo', desc: 'Stacking Checkers variant' },
 //  { name: 'Empire', desc: 'Empire versus Kingdom' },
 //  { name: 'Enpassant', desc: 'Capture en passant', disp: 'En-passant' },
@@ -135,7 +135,7 @@ const variants = [
 //  { name: 'Sittuyin', desc: 'Burmese Chess' },
 //  { name: 'Spartan', desc: 'Spartan versus Persians' },
 //  { name: 'Squatter', desc: 'Squat last rank' },
-//  { name: 'Stealthbomb', desc: 'Beware the bomb', disp: 'Stealth Bomb' },
+//  { name: 'Stealthbomb', desc: 'Beware the bomb' },
 //  { name: 'Suicide', desc: 'Lose all pieces' },
 //  { name: 'Suction', desc: 'Attract opposite king' },
 //  { name: 'Swap', desc: 'Dangerous captures' },
@@ -154,7 +154,7 @@ const variants = [
 //  { name: 'Wormhole', desc: 'Squares disappear' },
 //  { name: 'Xiangqi', desc: 'Chinese Chess' },
 //  { name: 'Yote', desc: 'African Draughts' },
-  { name: "Zen", disp: "Zen Chess", desc: "Reverse captures" }
+  { name: "Zen", desc: "Reverse captures" }
 ];
 
 // Next line for usage on server (Node.js)
index 22b6681..10bfd87 100644 (file)
@@ -1 +1,3 @@
 <p>Pieces of same nature attacking each other are immobilized.</p>
+
+<p class="author">Abdul J. Karwathar (1979).</p>
diff --git a/variants/Progressive/class.js b/variants/Progressive/class.js
new file mode 100644 (file)
index 0000000..c209821
--- /dev/null
@@ -0,0 +1,40 @@
+import ChessRules from "/base_rules.js";
+
+export default class ProgressiveRules extends ChessRules {
+
+  static get Options() {
+    return {
+      select: C.Options.select,
+      check: [
+        {
+          label: "Logical",
+          defaut: false,
+          variable: "logical"
+        }
+      ].concat(C.Options.check),
+      styles: C.Options.styles.filter(s => s != "progressive")
+    };
+  }
+
+  constructor(o) {
+    o.options["progressive"] = true;
+    super(o);
+  }
+
+  get hasCastle() {
+    return !this.options["logical"];
+  }
+
+  pieces(color, x, y) {
+    let res = super.pieces(color, x, y);
+    if (this.options["logical"]) {
+      const pawnShift = (color == "w" ? -1 : 1);
+      res["p"].moves[0] = {
+        steps: [[pawnShift, 0]],
+        range: 1 //always
+      };
+    }
+    return res;
+  }
+
+};
diff --git a/variants/Progressive/rules.html b/variants/Progressive/rules.html
new file mode 100644 (file)
index 0000000..ee9e9b0
--- /dev/null
@@ -0,0 +1 @@
+<p>White play one move, then Black play two in a row, then White play 3, and so on.</p>
diff --git a/variants/Progressive/style.css b/variants/Progressive/style.css
new file mode 100644 (file)
index 0000000..a3550bc
--- /dev/null
@@ -0,0 +1 @@
+@import url("/base_pieces.css");
diff --git a/variants/Recycle/class.js b/variants/Recycle/class.js
new file mode 100644 (file)
index 0000000..82458a9
--- /dev/null
@@ -0,0 +1,29 @@
+import ChessRules from "/base_rules.js";
+
+export default class RecycleRules extends ChessRules {
+
+  static get Options() {
+    return {
+      select: C.Options.select,
+      check: [
+        {
+          label: "Capture king",
+          defaut: false,
+          variable: "taking"
+        },
+        {
+          label: "Falling pawn",
+          defaut: true,
+          variable: "pawnfall"
+        }
+      ],
+      styles: C.Options.styles.filter(s => s != "recycle")
+    };
+  }
+
+  constructor(o) {
+    o.options["recycle"] = true;
+    super(o);
+  }
+
+};
diff --git a/variants/Recycle/rules.html b/variants/Recycle/rules.html
new file mode 100644 (file)
index 0000000..b9b8008
--- /dev/null
@@ -0,0 +1,6 @@
+<p>
+  Instead of playing a move, any piece (king excepted)
+  can be self-captured and dropped later in the game.
+</p>
+
+<p class="author">Robert Huber (2000).</p>
diff --git a/variants/Recycle/style.css b/variants/Recycle/style.css
new file mode 100644 (file)
index 0000000..a3550bc
--- /dev/null
@@ -0,0 +1 @@
+@import url("/base_pieces.css");
diff --git a/variants/Rifle/class.js b/variants/Rifle/class.js
new file mode 100644 (file)
index 0000000..01b4d00
--- /dev/null
@@ -0,0 +1,18 @@
+import ChessRules from "/base_rules.js";
+
+export default class RifleRules extends ChessRules {
+
+  static get Options() {
+    return {
+      select: C.Options.select,
+      check: C.Options.check,
+      styles: C.Options.styles.filter(s => s != "rifle")
+    };
+  }
+
+  constructor(o) {
+    o.options["rifle"] = true;
+    super(o);
+  }
+
+};
diff --git a/variants/Rifle/rules.html b/variants/Rifle/rules.html
new file mode 100644 (file)
index 0000000..495bdf3
--- /dev/null
@@ -0,0 +1,3 @@
+<p>Pieces capture (as usual) without moving.</p>
+
+<p class="author">William Buehler Seabrook (1921).</p>
diff --git a/variants/Rifle/style.css b/variants/Rifle/style.css
new file mode 100644 (file)
index 0000000..a3550bc
--- /dev/null
@@ -0,0 +1 @@
+@import url("/base_pieces.css");
diff --git a/variants/Teleport/class.js b/variants/Teleport/class.js
new file mode 100644 (file)
index 0000000..5e52252
--- /dev/null
@@ -0,0 +1,19 @@
+import ChessRules from "/base_rules.js";
+
+export default class TeleportRules extends ChessRules {
+
+  static get Options() {
+    return {
+      select: C.Options.select,
+      // TODO? option "teleport king"?
+      check: C.Options.check,
+      styles: C.Options.styles.filter(s => s != "teleport")
+    };
+  }
+
+  constructor(o) {
+    o.options["teleport"] = true;
+    super(o);
+  }
+
+};
diff --git a/variants/Teleport/rules.html b/variants/Teleport/rules.html
new file mode 100644 (file)
index 0000000..16965e0
--- /dev/null
@@ -0,0 +1,6 @@
+<p>
+  Instead of playing a move, any piece (king excepted)
+  can be self-captured and teleported elsewhere.
+</p>
+
+<p class="author">Philippe Rouzaud (2006).</p>
diff --git a/variants/Teleport/style.css b/variants/Teleport/style.css
new file mode 100644 (file)
index 0000000..a3550bc
--- /dev/null
@@ -0,0 +1 @@
+@import url("/base_pieces.css");