var black_frc_columns = tokens[2].match(/[a-h]/g);
if (black_frc_columns !== null) {
for (i = 0; i < black_frc_columns.length; ++i) {
- var sq = SQUARES.a1 + (black_frc_columns[0].charCodeAt(0) - "A".charCodeAt(0));
+ var sq = SQUARES.a8 + (black_frc_columns[0].charCodeAt(0) - "a".charCodeAt(0));
flag = sq < kings[BLACK] ? BITS.QSIDE_CASTLE : BITS.KSIDE_CASTLE;
castling.b |= flag;
rooks[BLACK].push({square: sq, flag: flag});
castling_from = move.to + 1;
}
- board[castling_to] = board[castling_from];
+ board[castling_to] = {type: ROOK, color: us};
if(castling_from !== move.from && castling_from !== castling_to)
board[castling_from] = null;
}