- let isOpposite = La > 0 && this.oppositeMoves(this.amoves[La-1], m);
- if (res || isOpposite) {
- const moves2 = this.getAllPotentialMoves();
- for (let m2 of moves2) {
- this.play(m2);
- const res2 = this.underCheck(color);
- const amove = this.getAmove(m, m2);
- isOpposite =
- La > 0 && this.oppositeMoves(this.amoves[La-1], amove);
- this.undo(m2);
- if (!res2 && !isOpposite) {
- res = false;
- break;
+ if (this.subTurn == 2) {
+ let isOpposite = La > 0 && this.oppositeMoves(this.amoves[La-1], m);
+ if (res || isOpposite) {
+ const moves2 = this.getAllPotentialMoves();
+ for (let m2 of moves2) {
+ this.play(m2);
+ const res2 = this.underCheck(color);
+ const amove = this.getAmove(m, m2);
+ isOpposite =
+ La > 0 && this.oppositeMoves(this.amoves[La-1], amove);
+ this.undo(m2);
+ if (!res2 && !isOpposite) {
+ res = false;
+ break;
+ }