feat: expand and child node

This commit is contained in:
korzepadawid 2022-04-11 20:04:53 +02:00
parent 10485ce39d
commit 019b3c86be

View File

@ -45,11 +45,16 @@ class Node:
return hash(self.state) return hash(self.state)
def child_node(action: Action) -> Node: def expand(node: Node) -> List[Node]:
pass return [child_node(node=node, action=action) for action in actions(node.state)]
def actions(state: State) -> List[str]: def child_node(node: Node, action: Action) -> Node:
next_state = result(state=node.state, action=action)
return Node(state=next_state, parent=node, action=action)
def actions(state: State) -> List[Action]:
pass pass