From: Benjamin Auder Date: Mon, 2 May 2022 12:38:36 +0000 (+0200) Subject: Add a few variants X-Git-Url: https://git.auder.net/?p=xogo.git;a=commitdiff_plain;h=a7d092011535bc7da231c2c254ec5c936b62cd71 Add a few variants --- diff --git a/variants.js b/variants.js index 9111e07..8cb1902 100644 --- a/variants.js +++ b/variants.js @@ -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) diff --git a/variants/Madrasi/rules.html b/variants/Madrasi/rules.html index 22b6681..10bfd87 100644 --- a/variants/Madrasi/rules.html +++ b/variants/Madrasi/rules.html @@ -1 +1,3 @@

Pieces of same nature attacking each other are immobilized.

+ +

Abdul J. Karwathar (1979).

diff --git a/variants/Progressive/class.js b/variants/Progressive/class.js new file mode 100644 index 0000000..c209821 --- /dev/null +++ b/variants/Progressive/class.js @@ -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 index 0000000..ee9e9b0 --- /dev/null +++ b/variants/Progressive/rules.html @@ -0,0 +1 @@ +

White play one move, then Black play two in a row, then White play 3, and so on.

diff --git a/variants/Progressive/style.css b/variants/Progressive/style.css new file mode 100644 index 0000000..a3550bc --- /dev/null +++ b/variants/Progressive/style.css @@ -0,0 +1 @@ +@import url("/base_pieces.css"); diff --git a/variants/Recycle/class.js b/variants/Recycle/class.js new file mode 100644 index 0000000..82458a9 --- /dev/null +++ b/variants/Recycle/class.js @@ -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 index 0000000..b9b8008 --- /dev/null +++ b/variants/Recycle/rules.html @@ -0,0 +1,6 @@ +

+ Instead of playing a move, any piece (king excepted) + can be self-captured and dropped later in the game. +

+ +

Robert Huber (2000).

diff --git a/variants/Recycle/style.css b/variants/Recycle/style.css new file mode 100644 index 0000000..a3550bc --- /dev/null +++ b/variants/Recycle/style.css @@ -0,0 +1 @@ +@import url("/base_pieces.css"); diff --git a/variants/Rifle/class.js b/variants/Rifle/class.js new file mode 100644 index 0000000..01b4d00 --- /dev/null +++ b/variants/Rifle/class.js @@ -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 index 0000000..495bdf3 --- /dev/null +++ b/variants/Rifle/rules.html @@ -0,0 +1,3 @@ +

Pieces capture (as usual) without moving.

+ +

William Buehler Seabrook (1921).

diff --git a/variants/Rifle/style.css b/variants/Rifle/style.css new file mode 100644 index 0000000..a3550bc --- /dev/null +++ b/variants/Rifle/style.css @@ -0,0 +1 @@ +@import url("/base_pieces.css"); diff --git a/variants/Teleport/class.js b/variants/Teleport/class.js new file mode 100644 index 0000000..5e52252 --- /dev/null +++ b/variants/Teleport/class.js @@ -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 index 0000000..16965e0 --- /dev/null +++ b/variants/Teleport/rules.html @@ -0,0 +1,6 @@ +

+ Instead of playing a move, any piece (king excepted) + can be self-captured and teleported elsewhere. +

+ +

Philippe Rouzaud (2006).

diff --git a/variants/Teleport/style.css b/variants/Teleport/style.css new file mode 100644 index 0000000..a3550bc --- /dev/null +++ b/variants/Teleport/style.css @@ -0,0 +1 @@ +@import url("/base_pieces.css");