- for (let p of pk) this.reserve[color][p] = myPieces[p];
- for (let i=0; i<8; i++) {
- for (let j=0; j<8; j++) {
- if (
- this.board[i][j] != V.EMPTY &&
- this.getColor(i, j) == color &&
- piecesList.includes(this.getPiece(i, j))
- ) {
- this.board[i][j] = color + V.UNDEFINED;
+ move.reserve = JSON.parse(JSON.stringify(this.reserve));
+ V.PlayOnBoard(this.board, move);
+ for (
+ let cp of [{ c: color, pk: my_pk }, { c: oppCol, pk: opp_pk }]
+ ) {
+ if (cp.pk.length >= 2 || (cp.c == oppCol && oppRevert)) {
+ for (let p of cp.pk)
+ this.reserve[cp.c][p] += definedPieces[cp.c][p];
+ for (let i=0; i<8; i++) {
+ for (let j=0; j<8; j++) {
+ if (
+ this.board[i][j] != V.EMPTY &&
+ this.getColor(i, j) == cp.c &&
+ piecesList.includes(this.getPiece(i, j))
+ ) {
+ this.board[i][j] = cp.c + V.UNDEFINED;
+ }
+ }