Commit c2200be9 authored by Erwan Bousse's avatar Erwan Bousse
Browse files

move-validation: add return types

parent 9b59b967
......@@ -2,7 +2,7 @@ import { Chessboard, isEmpty, Square, squareAtPosition } from "./chessboard";
import { Move } from "./movements";
import { equals, left, right, bottom, top } from "./position";
export function blackPawnMove(board : Chessboard, move : Move) {
export function blackPawnMove(board: Chessboard, move: Move): boolean {
// #TODO: Manage special 'En passant' move.
if (equals(move.to!, top(move.from!))) {
......@@ -24,35 +24,35 @@ export function blackPawnMove(board : Chessboard, move : Move) {
}
export function blackKingMove(board : Chessboard, move : Move) {
export function blackKingMove(board: Chessboard, move: Move): boolean {
// #TODO: Implement this function
return true;
}
export function blackQueenMove(board : Chessboard, move : Move) {
export function blackQueenMove(board: Chessboard, move: Move): boolean {
// #TODO: Implement this function
return true;
}
export function blackRoockMove(board : Chessboard, move : Move) {
export function blackRoockMove(board: Chessboard, move: Move): boolean {
// #TODO: Implement this function
return true;
}
export function blackBishopMove(board : Chessboard, move : Move) {
export function blackBishopMove(board: Chessboard, move: Move): boolean {
// #TODO: Implement this function
return true;
}
export function blackKnightMove(board : Chessboard, move : Move) {
export function blackKnightMove(board: Chessboard, move: Move): boolean {
// #TODO: Implement this function
return true;
}
export function whitePawnMove(board : Chessboard, move : Move) {
export function whitePawnMove(board: Chessboard, move: Move): boolean {
// #TODO: Manage special 'En passant' move.
if (equals(move.to!,bottom(move.from!))) {
if (equals(move.to!, bottom(move.from!))) {
return isEmpty(board, move.to!);
}
......@@ -68,27 +68,27 @@ export function whitePawnMove(board : Chessboard, move : Move) {
return false;
}
export function whiteKingMove(board : Chessboard, move : Move) {
export function whiteKingMove(board: Chessboard, move: Move): boolean {
// #TODO: Implement this function
return true;
}
export function whiteQueenMove(board : Chessboard, move : Move) {
export function whiteQueenMove(board: Chessboard, move: Move): boolean {
// #TODO: Implement this function
return true;
}
export function whiteRoockMove(board : Chessboard, move : Move) {
export function whiteRoockMove(board: Chessboard, move: Move): boolean {
// #TODO: Implement this function
return true;
}
export function whiteBishopMove(board : Chessboard, move : Move) {
export function whiteBishopMove(board: Chessboard, move: Move): boolean {
// #TODO: Implement this function
return true;
}
export function whiteKnightMove(board : Chessboard, move : Move) {
export function whiteKnightMove(board: Chessboard, move: Move): boolean {
// #TODO: Implement this function
return true;
}
\ No newline at end of file
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