X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=variants%2FChakart%2Fclass.js;h=5202b489dfeaad00f5a74cac6f4a678a87a7cc94;hb=HEAD;hp=96a53f3640990b32479cce6d424a82a4b3d19e54;hpb=33b427488bb6ee5c505c3a024bccedbef763f80e;p=xogo.git diff --git a/variants/Chakart/class.js b/variants/Chakart/class.js index 96a53f3..3454d8f 100644 --- a/variants/Chakart/class.js +++ b/variants/Chakart/class.js @@ -1,7 +1,7 @@ import ChessRules from "/base_rules.js"; -import GiveawayRules from "/variants/Giveaway/class.js"; import {ArrayFun} from "/utils/array.js"; import {Random} from "/utils/alea.js"; +import {FenUtil} from "/utils/setupPieces.js"; import PiPo from "/utils/PiPo.js"; import Move from "/utils/Move.js"; @@ -130,12 +130,25 @@ export default class ChakartRules extends ChessRules { ); } + isKing(x, y, p) { + if (!p) + p = this.getPiece(x, y); + return ['k', 'l'].includes(p); + } + genRandInitBaseFen() { - const options = Object.assign({mode: "suicide"}, this.options); - const gr = new GiveawayRules({options: options, genFenOnly: true}); - let res = gr.genRandInitBaseFen(); - res.o["flags"] = "1111"; //Peach + Mario flags - return res; + const s = FenUtil.setupPieces( + ['r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'], + { + randomness: this.options["randomness"], + diffCol: ['b'] + } + ); + return { + fen: s.b.join("") + "/pppppppp/8/8/8/8/PPPPPPPP/" + + s.w.join("").toUpperCase(), + o: {flags: "1111"} //Peach + Mario + }; } fen2board(f) { @@ -213,7 +226,7 @@ export default class ChakartRules extends ChessRules { moves = this.getDropMovesFrom([x, y]); else if (this.egg == "kingboo") { const color = this.turn; - const oppCol = C.GetOppCol(color); + const oppCol = C.GetOppTurn(color); // Only allow to swap (non-immobilized!) pieces for (let i=0; i