1 import { ChessRules
, Move
, PiPo
} from "@/base_rules";
2 import { Atomic1Rules
} from "@/variants/Atomic1";
4 export class Atomic2Rules
extends Atomic1Rules
{
6 getPotentialMovesFrom([x
, y
]) {
7 if (this.movesCount
== 0) {
8 if ([1, 6].includes(x
)) {
9 const c
= this.getColor(x
, y
);
14 new PiPo({ x: x
, y: y
, p: V
.PAWN
, c: c
})
16 start: { x: x
, y: y
},
23 return super.getPotentialMovesFrom([x
, y
]);
26 hoverHighlight([x
, y
]) {
27 return this.movesCount
== 0 && [1, 6].includes(x
);
30 canIplay(side
, [x
, y
]) {
31 if (this.movesCount
== 0)
32 return (this.turn
== side
&& this.getPiece(x
, y
) == V
.PAWN
);
33 return super.canIplay(side
, [x
, y
]);
37 if (this.movesCount
>= 1) return null;
38 const [x
, y
] = [square
[0], square
[1]];
39 if (![1, 6].includes(x
)) return null;
46 c: this.getColor(x
, y
),
50 start: { x: x
, y: y
},
56 if (move.appear
.length
== 0 && move.vanish
.length
== 1)
58 return V
.CoordsToSquare(move.start
) + "X";
59 return super.getNotation(move);