Implemented the isMoveLegal method

Implemented the isMoveLegal method for each piece, except for the pawn since it is more complicated and thus we need more functionality to determine whether a move is legal or not.