Commit 49ba7a96 authored by Romain DUPONT's avatar Romain DUPONT
Browse files

implementation du mouvement du roi et de la reine

parent 853ee6bc
......@@ -76,7 +76,7 @@ export function whitePawnMove(board: Chessboard, move: Move): boolean {
*/
export function kingMove(board: Chessboard, move: Move): boolean {
// #TODO: Implement this function
return true;
return (Math.abs(move.to!.rank-move.from!.rank)==1 || Math.abs(move.to!.file-move.from!.file)==1);
}
/**
......@@ -89,7 +89,7 @@ export function kingMove(board: Chessboard, move: Move): boolean {
*/
export function queenMove(board: Chessboard, move: Move): boolean {
// #TODO: Implement this function
return rankFileMove(board, move);
return (rankFileMove(board, move) || DiagonalMove(board, move));
}
/**
......@@ -103,7 +103,6 @@ export function queenMove(board: Chessboard, move: Move): boolean {
export function rookMove(board: Chessboard, move: Move): boolean {
// #TODO: Implement this function
return rankFileMove(board, move);
}
......
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