move both pieces when rook is paired while castling
This commit is contained in:
parent
def7ccdbcb
commit
c20dda886a
|
|
@ -301,13 +301,19 @@ function movePiece(priorBoard, side, from, to){
|
|||
|
||||
if (type === 'k' && actuallyFrom[0] === 'e' && to[0] === 'g') {
|
||||
board.move.castle = true;
|
||||
const alongsideRook = boardGet(board, 'h' + actuallyFrom[1], other);
|
||||
boardPut(board, 'h' + actuallyFrom[1], side, ' ');
|
||||
boardPut(board, 'h' + actuallyFrom[1], other, ' ');
|
||||
boardPut(board, 'f' + actuallyFrom[1], side, 'r');
|
||||
boardPut(board, 'f' + actuallyFrom[1], other, alongsideRook);
|
||||
}
|
||||
else if (type === 'k' && actuallyFrom[0] === 'e' && to[0] === 'c') {
|
||||
board.move.queen_castle = true;
|
||||
const alongsideRook = boardGet(board, 'a' + actuallyFrom[1], other);
|
||||
boardPut(board, 'a' + actuallyFrom[1], side, ' ');
|
||||
boardPut(board, 'a' + actuallyFrom[1], other, ' ');
|
||||
boardPut(board, 'd' + actuallyFrom[1], side, 'r');
|
||||
boardPut(board, 'd' + actuallyFrom[1], other, alongsideRook);
|
||||
}
|
||||
else if (type === 'p' && alongside === ' ' && replaced === ' ' && to[0] !== actuallyFrom[0]) {
|
||||
let otherBoard = priorBoard;
|
||||
|
|
|
|||
Loading…
Reference in New Issue