Add a function that tells whether a move is legal