X-Git-Url: https://git.auder.net/?p=xogo.git;a=blobdiff_plain;f=variants%2FAmbiguous%2Fclass.js;h=4311c4d8a53a2b5802a5cee87b9267a3837731bd;hp=db24d0e372ac79cbe341cd23c3934e8a5dff12f8;hb=f31de5e46015a93dca20765da61670035ce8f491;hpb=006c778a7d68e01f635d3d8faa74284512842356 diff --git a/variants/Ambiguous/class.js b/variants/Ambiguous/class.js index db24d0e..4311c4d 100644 --- a/variants/Ambiguous/class.js +++ b/variants/Ambiguous/class.js @@ -22,10 +22,10 @@ export default class AmbiguousRules extends ChessRules { this.subTurn = 1; } - genRandInitFen(seed) { + genRandInitBaseFen() { const options = Object.assign({mode: "suicide"}, this.options); const gr = new GiveawayRules({options: options, genFenOnly: true}); - return gr.genRandInitFen(seed); + return gr.genRandInitBaseFen(); } canStepOver(x, y) { @@ -57,15 +57,17 @@ export default class AmbiguousRules extends ChessRules { .map(m => { if (m.vanish.length == 1) m.appear[0].p = V.GOAL; - else + else { m.appear[0].p = V.TARGET_CODE[m.vanish[1].p]; + m.appear[0].c = m.vanish[1].c; + } m.vanish.shift(); return m; }) ); } // At subTurn == 1, play a targeted move for the opponent. - // Search for target (we could also have it in a stack...) + // Search for target: let target = {x: -1, y: -1}; outerLoop: for (let i = 0; i < this.size.x; i++) { for (let j = 0; j < this.size.y; j++) { @@ -142,8 +144,10 @@ export default class AmbiguousRules extends ChessRules { return moves; } - isKing(symbol) { - return ['k', 'l'].includes(symbol); + isKing(x, y, p) { + if (!p) + p = this.getPiece(x, y); + return ['k', 'l'].includes(p); } getCurrentScore() {