X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=variants%2FBicolour%2Fclass.js;h=e049e0c96e13a459de547ab31f2fdd3e050d7c4f;hb=52718c94d69b40e79f9ba4fd4ff70376bbf8a774;hp=fd2cdb0331ea6e50d079fc37a9247f5cf75e6b74;hpb=33b427488bb6ee5c505c3a024bccedbef763f80e;p=xogo.git diff --git a/variants/Bicolour/class.js b/variants/Bicolour/class.js index fd2cdb0..e049e0c 100644 --- a/variants/Bicolour/class.js +++ b/variants/Bicolour/class.js @@ -2,16 +2,40 @@ import ChessRules from "/base_rules.js"; 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() { @@ -103,9 +127,8 @@ export class BicolourRules extends ChessRules { }; } - 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']); } };