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;
})
'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() {
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++;
}