# coding: utf-8
from __future__ import division, print_function
import random

# Please implement the function `optimal_move(board)`.
# If the board is in N-position `optimal_move(board)` should return a random valid move.
# If the board is in P-position `optimal_move(board)` should return a random optimal move, as
# discussed in the pdf file.
# You need not to worry about the special case of the empty board. We will make sure that the
# empty board never enters the `optimal_move` function.

# Pro tip: you can use `random.randint` to draw random numbers.

# Your solution to nim_sum goes here:
def nim_sum(board):
    # Your code goes here!
    pass

# Your solution to the task goes here:
def optimal_move(board):
    pass

# You can use the following test case to test your solution locally:
result = optimal_move([5, 4, 3, 2, 1])
assert any([result == (5, 1), result == (3, 1), result == (1, 1)])

# Note: due to technical limitations, there is no automated feedback for this exercise. It's
# up to you to make sure that your function behaves correctly. Ask your tutor if in doubt.
