import random


def EXPAND(node):
    """
    choose a new child from current node
    :param node: the current node we are considering
    :return: the new child
    """
    random_action = random.choice(node.untried_action)  # select an action from the untried action of this node
    node.untried_action.remove(random_action)   # removed the selected action
    new_state = node.state.next_state(random_action)  # given current state, action, decide the next action
    node.add_child(new_state)  # add this new child to the node
    return node.children[-1]