forked from tensorflow/minigo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsgf_dump.py
More file actions
25 lines (20 loc) · 735 Bytes
/
Copy pathsgf_dump.py
File metadata and controls
25 lines (20 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
""" simple utils
"""
import glob
import os.path
import coords
import myconf
from sgf_wrapper import SGFReader
def dump_sgf_moves(sgf_pattern: str):
""" dump a bunch of *.sgf in gtp moves, for quick inspection """
for sgf_fname in glob.glob(sgf_pattern):
basename = os.path.basename(sgf_fname).removesuffix('.sgf')
reader = SGFReader.from_file_compatible(sgf_fname)
moves = [coords.to_gtp(x.next_move) for x in reader.iter_pwcs()]
moves_str = ' '.join(moves)
result_str = reader.result_str()
print(f'{basename}: {moves_str}\t{result_str}')
def test_dump_sgf_moves():
fpattern = f'{myconf.EXP_HOME}/selfplay0/sgf/full/Problem 1-*'
print()
dump_sgf_moves(fpattern)