{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'},
--- /dev/null
+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;
+ }
+
+};
--- /dev/null
+<p>If a piece captures one of the same kind, both disappear.</p>
+
+<p class="author">Claudio Martins Jaguaribe (2010).</p>
--- /dev/null
+@import url("/base_pieces.css");
}
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) {
-https://www.chessvariants.com/diffobjective.dir/anti-king-chess.html
+<p>
+ The antiking (represented by an upside-down king)
+ must always remain under attack.
+ It can capture pieces of its color.
+</p>
+
+<p>
+ Win by checkmating the king, or anti-mating the antiking — that is to
+ say, making it unable to move to an attacked square.
+</p>
+
+<p>In Anti-King I,</p>
+<ul>
+ <li>Pawns are Berolina: they move diagonally and capture vertically.</li>
+ <li>
+ King and Antiking can play one non-capturing knight move,
+ as long as they never moved earlier.
+ </li>
+</ul>
+
+<a href="https://www.chessvariants.com/diffobjective.dir/anti-king-chess.html">
+ chessvariants page.
+</a>
+
+<p class="author">Peter Aronson (2002).</p>