b0662d3aeaf807c50dbf68104c671d875e6df66d
1 import ChessRules
from "/base_rules.js";
2 import PiPo
from "/utils/PiPo.js";
3 import Move
from "/utils/Move.js";
5 export default class AtomicRules
extends ChessRules
{
9 select: C
.Options
.select
,
17 label: "Falling pawn",
22 styles: C
.Options
.styles
.filter(s
=> s
!= "atomic")
27 o
.options
["atomic"] = true;
32 if (this.options
["rempawn"] && this.movesCount
== 0)
33 return (this.turn
== side
&& this.getPiece(x
, y
) == "p");
34 return super.canIplay(x
, y
);
37 getPotentialMovesFrom([x
, y
], color
) {
38 if (this.options
["rempawn"] && this.movesCount
== 0) {
39 if ([1, 6].includes(x
)) {
40 const c
= this.getColor(x
, y
);
52 start: { x: x
, y: y
},
59 return super.getPotentialMovesFrom([x
, y
], color
);
63 if (!this.options
["rempawn"] || this.movesCount
>= 1)
64 return super.doClick(square
);
65 const [x
, y
] = [square
[0], square
[1]];
66 const moves
= this.getPotentialMovesFrom([x
, y
]);
67 return (moves
.length
>= 1 ? moves
[0] : null);