X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=variants%2FChakart%2Fclass.js;h=2b502b670fee1c2953cc9de8782d4ab682f8f6ac;hb=7fbcb53de45ba7b7aed99d6087928779713810b1;hp=5202b489dfeaad00f5a74cac6f4a678a87a7cc94;hpb=b9877ed29697640d72b8f3d89848863fc87bd7e8;p=xogo.git diff --git a/variants/Chakart/class.js b/variants/Chakart/class.js index 5202b48..2b502b6 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"; @@ -116,7 +116,6 @@ export default class ChakartRules extends ChessRules { { 'y': { // Virtual piece for "king remote shell captures" - moves: [], attack: [ { steps: [ @@ -132,11 +131,18 @@ export default class ChakartRules extends ChessRules { } 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) { @@ -214,7 +220,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