X-Git-Url: https://git.auder.net/rpsls.js?a=blobdiff_plain;ds=sidebyside;f=variants%2FChakart%2Fclass.js;h=2b502b670fee1c2953cc9de8782d4ab682f8f6ac;hb=727f2e558776b14a29cb1552a05a88cc9a4b0297;hp=96a53f3640990b32479cce6d424a82a4b3d19e54;hpb=33b427488bb6ee5c505c3a024bccedbef763f80e;p=xogo.git diff --git a/variants/Chakart/class.js b/variants/Chakart/class.js index 96a53f3..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"; @@ -131,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) { @@ -213,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