e6542c47619299845b5c6050dabf4e23c6da3409
1 import AbstractFlipRules
from "/variants/_Flip/class.js";
2 import PiPo
from "/utils/PiPo.js";
4 export default class BenedictRules
extends AbstractFlipRules
{
8 select: C
.Options
.select
,
12 variable: "cleopatra",
29 if (!this.options
["cleopatra"])
30 return super.pieces(color
, x
, y
);
31 const allSpecs
= super.pieces(color
, x
, y
);
32 return Object
.assign({},
34 {'q': Object
.assign({}, allSpecs
['q'], {"class": "cleopatra"})}
38 postProcessPotentialMoves(moves
) {
39 const oppCol
= C
.GetOppCol(this.turn
);
40 let bMoves
= super.postProcessPotentialMoves(moves
);
43 if (!this.options
["cleopatra"] || m
.vanish
[0].p
== 'q') {
45 let attacks
= super.findDestSquares(
49 segments: this.options
["cylinder"]
51 ([i1
, j1
], [i2
, j2
]) => {
53 super.canTake([i1
, j1
], [i2
, j2
]) &&
54 (!this.options
["zen"] || this.getPiece(i2
, j2
) == 'k')
58 if (this.options
["zen"]) {
59 const zenAttacks
= super.findCapturesOn(
63 segments: this.options
["cylinder"]
65 ([i1
, j1
], [i2
, j2
]) =>
66 this.getPiece(i1
, j1
) != 'k' && super.canTake([i2
, j2
], [i1
, j1
])
68 Array
.prototype.push
.apply(attacks
, zenAttacks
);
71 attacks
.forEach(a
=> m
.flips
.push({x: a
.sq
[0], y: a
.sq
[1]}));