diff --git a/chart.py b/chart.py index eed717e..f730f66 100644 --- a/chart.py +++ b/chart.py @@ -19,7 +19,7 @@ def form_values(gammme, depth, fragmentation_percentage, should_defragment, custom_branching): - lst, ratios = game_parser.parse_individual_games(gammme, depth, custom_branching) #whether or not to implement custom branching + lst, ratios, kick_depth = game_parser.parse_individual_games(gammme, depth, custom_branching) #whether or not to implement custom branching """Create parent, id, labels, and values """ firstx = [ lst[i][:depth] for i in range(len(lst)) @@ -30,7 +30,7 @@ def form_values(gammme, depth, fragmentation_percentage, should_defragment, cust holder = [firstx[i][0] for i in range(len(firstx))] holder = dict(Counter(holder)) - percentage_holder = [] + percentage_holder, firstmove = [], [] while counter < depth: if counter == 0: @@ -250,4 +250,5 @@ def graph(database, depth=5, fragmentation_percentage=0.0032, should_defragment= # only then can you download the image without failure # switch the.jpeg to your favourite format such as pdf or svg -# fig.write_image("fig1.jpeg") +def download(fig, format): + fig.write_image("fig1."+format) diff --git a/game_parser.py b/game_parser.py index d11c1f0..84878a9 100644 --- a/game_parser.py +++ b/game_parser.py @@ -34,10 +34,13 @@ def parse_individual_games(pgn, depth, custom_branching): full_list.append(small_list) full_rats.append(game.headers['Result']) + kick_depth = 0 + if custom_branching == True: a = input('Custom Branching: ') a = list(a.split()) del_list = [] + kick_depth = len(a) for i in range(len(full_list)): b = full_list[i][0:len(a)] if a == b: @@ -49,4 +52,4 @@ def parse_individual_games(pgn, depth, custom_branching): full_list = [full_list[i] for i in range(len(full_list)) if i not in del_list] - return full_list, full_rats + return full_list, full_rats, kick_depth