Fix Eightpieces
[vchess.git] / client / src / variants / Antimatter.js
CommitLineData
8b405c81
BA
1import { ChessRules } from "@/base_rules";
2
32f6285e 3export class AntimatterRules extends ChessRules {
7e8a7ea1 4
8b405c81
BA
5 getPotentialMovesFrom([x, y]) {
6 let moves = super.getPotentialMovesFrom([x, y]);
8b405c81
BA
7 // Handle "matter collisions"
8 moves.forEach(m => {
9 if (
10 m.vanish.length > 1 &&
11 m.appear.length <= 1 &&
12 m.vanish[0].p == m.vanish[1].p
13 ) {
14 m.appear.pop();
15 }
16 });
8b405c81
BA
17 return moves;
18 }
7e8a7ea1 19
8b405c81 20};