From: Benjamin Auder Date: Thu, 30 Jun 2022 19:44:24 +0000 (+0200) Subject: Complete Antiking, add Antimatter X-Git-Url: https://git.auder.net/variants/Chakart/css/assets/doc/scripts/R.css?a=commitdiff_plain;h=006c778a7d68e01f635d3d8faa74284512842356;p=xogo.git Complete Antiking, add Antimatter --- diff --git a/variants.js b/variants.js index 3705c59..4108165 100644 --- a/variants.js +++ b/variants.js @@ -7,7 +7,7 @@ const variants = [ {name: 'Ambiguous', desc: "Play opponent's pieces"}, {name: 'Antiking1', desc: 'Keep antiking in check', disp: 'Anti-King I'}, {name: 'Antiking2', desc: 'Keep antiking in check', disp: 'Anti-King II'}, -// {name: 'Antimatter', desc: 'Dangerous collisions'}, + {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'}, diff --git a/variants/Antimatter/class.js b/variants/Antimatter/class.js new file mode 100644 index 0000000..b71abf7 --- /dev/null +++ b/variants/Antimatter/class.js @@ -0,0 +1,29 @@ +import ChessRules from "/base_rules.js"; + +export default class AntimatterRules extends ChessRules { + + static get Options() { + return { + select: C.Options.select, + input: C.Options.input, + styles: C.Options.styles.filter(s => !["atomic", "madrasi"].includes(s)) + }; + } + + getPotentialMovesFrom([x, y]) { + let moves = super.getPotentialMovesFrom([x, y]); + // Handle "matter collisions" + moves.forEach(m => { + if ( + m.vanish.length == 2 && + m.appear.length == 1 && + m.vanish[0].p == m.vanish[1].p && + m.vanish[0].c != m.vanish[1].c //for Recycle & Teleport + ) { + m.appear.pop(); + } + }); + return moves; + } + +}; diff --git a/variants/Antimatter/rules.html b/variants/Antimatter/rules.html new file mode 100644 index 0000000..78d8f29 --- /dev/null +++ b/variants/Antimatter/rules.html @@ -0,0 +1,3 @@ +

If a piece captures one of the same kind, both disappear.

+ +

Claudio Martins Jaguaribe (2010).

diff --git a/variants/Antimatter/style.css b/variants/Antimatter/style.css new file mode 100644 index 0000000..a3550bc --- /dev/null +++ b/variants/Antimatter/style.css @@ -0,0 +1 @@ +@import url("/base_pieces.css"); diff --git a/variants/_Antiking/class.js b/variants/_Antiking/class.js index e92edab..8e2173a 100644 --- a/variants/_Antiking/class.js +++ b/variants/_Antiking/class.js @@ -26,17 +26,9 @@ export default class AbstractAntikingRules extends ChessRules { } pieces(color, x, y) { - return Object.assign( - { - 'a': { - // Move like a king, no attacks - "class": "antiking", - moves: super.pieces(color, x, y)['k'].moves, - attack: [] - } - }, - super.pieces(color, x, y) - ); + let antikingSpec = super.pieces(color, x, y)['k']; + antikingSpec["class"] = "antiking"; + return Object.assign({'a': antikingSpec}, super.pieces(color, x, y)); } isKing(x, y, p) { diff --git a/variants/_Antiking/rules.html b/variants/_Antiking/rules.html index fee723a..e850c5e 100644 --- a/variants/_Antiking/rules.html +++ b/variants/_Antiking/rules.html @@ -1 +1,25 @@ -https://www.chessvariants.com/diffobjective.dir/anti-king-chess.html +

+ The antiking (represented by an upside-down king) + must always remain under attack. + It can capture pieces of its color. +

+ +

+ Win by checkmating the king, or anti-mating the antiking — that is to + say, making it unable to move to an attacked square. +

+ +

In Anti-King I,

+ + + + chessvariants page. + + +

Peter Aronson (2002).