X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=variants%2FAmbiguous%2Fclass.js;h=db24d0e372ac79cbe341cd23c3934e8a5dff12f8;hb=f3e90e30b6e7ff416afe288bc9dd865e5daf9860;hp=6a001a6f795e94349a439f30b7e0946218332d7b;hpb=554e3ad3773a3123701bd894db1df4c1843283b8;p=xogo.git diff --git a/variants/Ambiguous/class.js b/variants/Ambiguous/class.js index 6a001a6..db24d0e 100644 --- a/variants/Ambiguous/class.js +++ b/variants/Ambiguous/class.js @@ -55,14 +55,10 @@ export default class AmbiguousRules extends ChessRules { return true; }) .map(m => { - if (m.vanish.length == 1) { - m.appear[0].c = 'a'; //a-color + 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 = oppCol; - } m.vanish.shift(); return m; }) @@ -133,8 +129,8 @@ export default class AmbiguousRules extends ChessRules { 't': {"class": "target-queen", moves: []}, 'l': {"class": "target-king", moves: []} }; - return Object.assign( - { 'g': {"class": "target"} }, targets, super.pieces(color, x, y)); + return Object.assign({ 'g': {"class": "target", moves: []} }, + targets, super.pieces(color, x, y)); } atLeastOneMove() { @@ -153,15 +149,14 @@ export default class AmbiguousRules extends ChessRules { getCurrentScore() { // This function is only called at subTurn 1 const color = C.GetOppCol(this.turn); - const kingPos = this.searchKingPos(color); - if (kingPos[0] < 0) + if (this.searchKingPos(color).length == 0) return (color == 'w' ? "0-1" : "1-0"); return "*"; } postPlay(move) { const color = this.turn; - if (this.subTurn == 2 || this.searchKingPos(color)[0] < 0) { + if (this.subTurn == 2 || this.searchKingPos(color).length == 0) { this.turn = C.GetOppCol(color); this.movesCount++; }