X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=variants%2FAmbiguous%2Fclass.js;h=a0cb7f2f602cdeca7af1dcae5d8daebff5503764;hb=a55fde41f82207bf401c54b158dd6d0182799fd3;hp=5e7029c61c5ce9a601ecc02cd29953201dc43f8b;hpb=9aebe2aac02158a4f1c92ad0ac529f8ed245602e;p=xogo.git diff --git a/variants/Ambiguous/class.js b/variants/Ambiguous/class.js index 5e7029c..a0cb7f2 100644 --- a/variants/Ambiguous/class.js +++ b/variants/Ambiguous/class.js @@ -1,5 +1,5 @@ import ChessRules from "/base_rules.js"; -import GiveawayRules from "/variants/Giveaway/class.js"; +import {FenUtil} from "/utils/setupPieces.js"; export default class AmbiguousRules extends ChessRules { @@ -23,9 +23,18 @@ export default class AmbiguousRules extends ChessRules { } genRandInitBaseFen() { - const options = Object.assign({mode: "suicide"}, this.options); - const gr = new GiveawayRules({options: options, genFenOnly: true}); - return gr.genRandInitBaseFen(); + 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: {} + }; } canStepOver(x, y) { @@ -36,7 +45,7 @@ export default class AmbiguousRules extends ChessRules { // Subturn 2: play a move for me (which just indicate a square). getPotentialMovesFrom([x, y]) { const color = this.turn; - const oppCol = C.GetOppCol(color); + const oppCol = C.GetOppTurn(color); if (this.subTurn == 2) { // Just play a normal move (which in fact only indicate a square) let movesHash = {}; @@ -152,7 +161,7 @@ export default class AmbiguousRules extends ChessRules { getCurrentScore() { // This function is only called at subTurn 1 - const color = C.GetOppCol(this.turn); + const color = C.GetOppTurn(this.turn); if (this.searchKingPos(color).length == 0) return (color == 'w' ? "0-1" : "1-0"); return "*"; @@ -161,7 +170,7 @@ export default class AmbiguousRules extends ChessRules { postPlay(move) { const color = this.turn; if (this.subTurn == 2 || this.searchKingPos(color).length == 0) { - this.turn = C.GetOppCol(color); + this.turn = C.GetOppTurn(color); this.movesCount++; } this.subTurn = 3 - this.subTurn;