filterValid(moves) {
const color = this.turn;
- const oppCol = C.GetOppCol(color);
+ const oppCol = C.GetOppTurn(color);
const kingPos = this.searchKingPos(color)[0];
const kingPiece = this.getPiece(kingPos[0], kingPos[1]);
return super.filterValid(moves).filter(m => {
this.playOnBoard(m);
m.appear.forEach(a => this.toggleWorld(a.x, a.y));
const kingAppear = m.appear.find(a => this.isKing(0, 0, a.p));
- const target = kingAppear ? [kingAppear.x, kingAppear.y] : kingPos;
+ const target = [kingAppear ? [kingAppear.x, kingAppear.y] : kingPos];
const res = this.underCheck(target, oppCol);
m.appear.forEach(a => this.toggleWorld(a.x, a.y));
this.undoOnBoard(m);