Commit f29f2f17 authored by Saad MAHBOUBI's avatar Saad MAHBOUBI
Browse files

La fonction rookMove completer mais bug (la piece saute les autre

pieces)
parent bc7daa66
......@@ -188,7 +188,16 @@ export function queenMove(board: Chessboard, move: Move): boolean {
export function rookMove(board: Chessboard, move: Move): boolean {
// #TODO: Implement this function
if (move.from!.rank === move.to!.rank)
let depart: Square = squareAtPosition(board, move.from!);
let destination: Square = squareAtPosition(board, move.to!);
if (move.from!.rank === move.to!.rank ){
return isEmpty(board, move.to!) || depart.piece!.isWhite === !destination.piece!.isWhite ;
}
if (move.from!.file === move.to!.file ){
return isEmpty(board, move.to!) || depart.piece!.isWhite === !destination.piece!.isWhite ;
}
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment