1 import ChessRules
from "/base_rules.js";
3 export default class AbstractFlipRules
extends ChessRules
{
5 // For games without captures (replaced by flips)
20 super.playOnBoard(move);
21 this.flipColorOf(move.flips
);
24 super.undoOnBoard(move);
25 this.flipColorOf(move.flips
);
29 for (let xy
of flips
) {
30 const newColor
= C
.GetOppTurn(this.getColor(xy
.x
, xy
.y
));
31 this.board
[xy
.x
][xy
.y
] = newColor
+ this.board
[xy
.x
][xy
.y
][1];
36 super.playVisual(move, r
);
37 move.flips
.forEach(f
=> {
38 this.g_pieces
[f
.x
][f
.y
].classList
.toggle("white");
39 this.g_pieces
[f
.x
][f
.y
].classList
.toggle("black");