5503f2f4e1f2e5a2c1dfe92be1f97538a68dcdae
1 import AbstractFlipRules
from "/variants/_Flip/class.js";
3 export default class BenedictRules
extends AbstractFlipRules
{
7 select: C
.Options
.select
,
11 variable: "cleopatra",
28 if (!this.options
["cleopatra"])
29 return super.pieces(color
, x
, y
);
30 const allSpecs
= super.pieces(color
, x
, y
);
31 return Object
.assign({},
33 {'q': Object
.assign({}, allSpecs
['q'], {"class": "cleopatra"})}
37 postProcessPotentialMoves(moves
) {
38 const oppCol
= C
.GetOppCol(this.turn
);
39 let bMoves
= super.postProcessPotentialMoves(moves
);
42 if (!this.options
["cleopatra"] || m
.vanish
[0].p
== 'q') {
44 let attacks
= super.findDestSquares(
48 segments: this.options
["cylinder"]
50 ([i1
, j1
], [i2
, j2
]) => {
52 super.canTake([i1
, j1
], [i2
, j2
]) &&
53 (!this.options
["zen"] || this.getPiece(i2
, j2
) == 'k')
57 if (this.options
["zen"]) {
58 const zenAttacks
= super.findCapturesOn(
62 segments: this.options
["cylinder"]
64 ([i1
, j1
], [i2
, j2
]) =>
65 this.getPiece(i1
, j1
) != 'k' && super.canTake([i2
, j2
], [i1
, j1
])
67 Array
.prototype.push
.apply(attacks
, zenAttacks
);
70 attacks
.forEach(a
=> m
.flips
.push({x: a
.sq
[0], y: a
.sq
[1]}));