no recursion there either

This commit is contained in:
Sander Land committed 2020-05-12 17:55:06 +02:00
1 parent 3253dd6698
commit b19d61a026
2 files changed
+12 -3

No files matched your search

+5 -2
View File
@@ -104,7 +104,7 @@ test_ais = [
AI("Default", {}, {"model": "bots/6b.bin.gz", "max_visits": 500}),
AI("Default", {}, {"model": "bots/6b104-s22347264.txt.gz", "max_visits": 500}),
AI("Default", {}, {"model": "bots/6b104-s42364928.txt.gz", "max_visits": 500}),
# AI("Default", {}, {"model": "KataGo/models/b10-1.3.txt.gz", "max_visits": 500}),
# AI("Default", {}, {"model": "KataGo/models/b10-1.3.txt.gz", "max_visits": 500}),
AI("Policy", {}),
AI("P:Local", {}),
AI("P:Weighted", {}),
@@ -143,7 +143,10 @@ def play_games(black: AI, white: AI):
while not game.current_node.analysis_ready:
time.sleep(0.001)
game.game_id += f"_{game.current_node.format_score()}"
print(f"{tag}\tGame finished in {time.time()-start_time:.1f}s @ move {game.current_node.depth} {game.current_node.format_score()} -> {game.write_sgf('sgf_selfplay/')}", file=sys.stderr)
print(
f"{tag}\tGame finished in {time.time()-start_time:.1f}s @ move {game.current_node.depth} {game.current_node.format_score()} -> {game.write_sgf('sgf_selfplay/')}",
file=sys.stderr,
)
score = game.current_node.score
if score > 0.3:
black.elo_comp.beat(white.elo_comp)
+7 -1
View File
@@ -214,7 +214,13 @@ class SGFNode:
@property
def nodes_in_tree(self) -> List:
"""Returns all nodes in the tree rooted at this node"""
return [self] + sum([c.nodes_in_tree for c in self.children], [])
stack = [self]
nodes = []
while stack:
item = stack.pop(0)
nodes.append(item)
stack += item.children
return nodes
@property
def nodes_from_root(self) -> List: