7846addfe3a228111e2447e9e4a948fcf1916623
1 import ChessRules
from "/base_rules.js";
3 export class AbstractAntikingRules
extends ChessRules
{
26 // Move like a king, no attacks
28 moves: super.pieces(color
, x
, y
)['k'].moves
,
35 p
= this.getPiece(x
, y
);
36 return ['k', 'a'].includes(p
);
39 canTake([x1
, y1
], [x2
, y2
]) {
40 const piece1
= this.getPiece(x1
, y1
);
41 const piece2
= this.getPiece(x2
, y2
);
42 const color1
= this.getColor(x1
, y1
);
43 const color2
= this.getColor(x2
, y2
);
47 (piece1
!= 'a' && color1
!= color2
) ||
48 (piece1
== 'a' && color1
== color2
)
53 underCheck(squares
, color
) {
54 const oppCol
= C
.GetOppCol(color
);
56 squares
.forEach(sq
=> {
57 switch (this.getPiece(sq
[0], sq
[1])) {
59 res
||= super.underAttack(sq
, oppCol
);
62 res
||= !super.underAttack(sq
, oppCol
);