- // May be a continuation: adjust numbers of pieces according to captures + rebirths
- this.moves.forEach(m => {
- if (m.vanish.length == 2)
- this.reserve[m.appear[0].c][m.vanish[1].p]++;
- else if (m.vanish.length == 0)
- this.reserve[m.appear[0].c][m.appear[0].p]--;
- });
+ const [sizeX,sizeY] = VariantRules.size;
+ this.promoted = doubleArray(sizeX, sizeY, false);
+ // May be a continuation: adjust numbers of pieces in reserve + promoted pieces
+ this.moves.forEach(m => { this.updateVariables(m); });
+ }
+
+ getColor(i,j)
+ {
+ const sizeX = VariantRules.size[0];
+ if (i >= sizeX)
+ return (i==sizeX ? "w" : "b");
+ return this.board[i][j].charAt(0);
+ }
+ getPiece(i,j)
+ {
+ const sizeX = VariantRules.size[0];
+ if (i >= sizeX)
+ return VariantRules.RESERVE_PIECES[j];
+ return this.board[i][j].charAt(1);