- else {
- // Normal move
- const firstRank = (c == "w" ? V.size.x - 1 : 0);
- const oppCol = V.GetOppCol(c);
- const oppFirstRank = V.size.x - 1 - firstRank;
- if (move.vanish[0].p == V.KING && move.appear.length > 0)
- this.castleFlags[c] = [V.size.y, V.size.y];
- else if (
- move.start.x == firstRank &&
- this.castleFlags[c].includes(move.start.y)
- ) {
- const flagIdx = (move.start.y == this.castleFlags[c][0] ? 0 : 1);
- this.castleFlags[c][flagIdx] = V.size.y;
- }
- if (
- move.end.x == oppFirstRank &&
- this.castleFlags[oppCol].includes(move.end.y)
- ) {
- const flagIdx = (move.end.y == this.castleFlags[oppCol][0] ? 0 : 1);
- this.castleFlags[oppCol][flagIdx] = V.size.y;
- }
- }