original_docstring: 
          Select a node in the tree to preform a single simulation from.
          
docstring: Select a node in the tree to preform a single simulation from.
docstring_tokens: Select a node in the tree to preform a single simulation from .
code: def select_node(self) -> tuple:
          """
          Select a node in the tree to preform a single simulation from.
          """
          node = self.root
          state = deepcopy(self.root_state)
  
          # stop if we reach a leaf node
          while len(node.children) != 0:
              max_value = max(node.children.values(),
                              key=lambda n:
                              n.value).value
              # descend to the maximum value node, break ties at random
              max_nodes = [n for n in node.children.values() if
                           n.value == max_value]
              node = choice(max_nodes)
              state.play(node.move)
  
              # if some child node has not been explored select it before expanding
              # other children
              if node.N == 0:
                  return node, state
  
          # if we reach a leaf node generate its children and return one of them
          # if the node is terminal, just return the terminal node
          if self.expand(node, state):
              node = choice(list(node.children.values()))
              state.play(node.move)
          return node, state
code_tokens: def select_node ( self ) -> tuple : node = self . root state = deepcopy ( self . root_state ) while len ( node . children ) != 0 : max_value = max ( node . children . values ( ) , key = lambda n : n . value ) . value max_nodes = [ n for n in node . children . values ( ) if n . value == max_value ] node = choice ( max_nodes ) state . play ( node . move ) if node . N == 0 : return node , state if self . expand ( node , state ) : node = choice ( list ( node . children . values ( ) ) ) state . play ( node . move ) return node , state
short_docstring: Select a node in the tree to preform a single simulation from.
short_docstring_tokens: Select a node in the tree to preform a single simulation from .
comment: """
          Select a node in the tree to preform a single simulation from.
          """$SEP$# stop if we reach a leaf node$SEP$# descend to the maximum value node, break ties at random$SEP$# if some child node has not been explored select it before expanding$SEP$# other children$SEP$# if we reach a leaf node generate its children and return one of them$SEP$# if the node is terminal, just return the terminal node