github.com/gorgonia/agogo@v0.1.1/mcts/unsafe_safe.go (about)

     1  // +build !unsafe
     2  
     3  package mcts
     4  
     5  // nodeFromNaughty gets the node given the pointer.
     6  func (t *MCTS) nodeFromNaughty(ptr naughty) *Node {
     7  	t.RLock()
     8  	nodes := t.nodes
     9  	t.RUnlock()
    10  	retVal := &nodes[int(ptr)]
    11  	return retVal
    12  }
    13  
    14  // Children returns a list of children
    15  func (t *MCTS) Children(of naughty) []naughty {
    16  	t.RLock()
    17  	retVal := t.children[of]
    18  	t.RUnlock()
    19  	return retVal
    20  }