import {Random} from "/utils/alea.js";
import {ArrayFun} from "/utils/array.js";
-export class BicolourRules extends ChessRules {
+export default class BicolourRules extends ChessRules {
- // TODO: Options
+ static get Options() {
+ return {
+ select: C.Options.select,
+ input: [
+ {
+ label: "King takes all",
+ variable: "takeboth",
+ type: "checkbox",
+ defaut: true
+ },
+ {
+ label: "Capture king",
+ variable: "taking",
+ type: "checkbox",
+ defaut: false
+ }
+ ],
+ styles: ["balance", "capture", "cylinder", "dark",
+ "doublemove", "madrasi", "progressive", "zen"]
+ };
+ }
get hasFlags() {
return false;
}
canTake([x1, y1], [x2, y2]) {
- return (this.getPiece(x2, y2) == 'k' || super.canTake([x1, y1], [x2, y2]));
+ return (
+ this.getPiece(x2, y2) == 'k' ||
+ (this.getPiece(x1, y1) == 'k' && this.options["takeboth"]) ||
+ super.canTake([x1, y1], [x2, y2])
+ );
}
genRandInitBaseFen() {
};
}
- underCheck(color) {
- const kingPos = this.searchKingPos(color)[0],
- return (this.underAttack(kingPos, 'w') || this.underAttack(kingPos, 'b'));
+ underCheck(square_s) {
+ return super.underCheck(square_s, ['w', 'b']);
}
};