Adds legal_move function to determine if a move is legal or not