Advertisement
Guest User

Untitled

a guest
Sep 27th, 2022
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. @staticmethod
  2. def _recursive_build(tree_node, s, paths):
  3. map = tree_node['map']
  4. moves = map.get_moves()
  5. for move in moves:
  6. map_copy = deepcopy(map)
  7. map_copy.move(move)
  8. string = AI_Player._map_core_to_str(map_copy.get_core())
  9. if string in s:
  10. continue
  11. tree_node['children'].append( { 'map' : map_copy, 'path' : tree_node['path'] + move[2], 'children' : [] } )
  12. s.add(string)
  13. for child in tree_node['children']:
  14. if child['map'].has_ended():
  15. paths.append(child['path'])
  16. continue
  17. AI_Player._recursive_build(child, s, paths)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement