Skip to content

Commit

Permalink
fix custom branching bug to due functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Destaq committed May 2, 2020
1 parent fd6b5a3 commit d11a94b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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:
Expand Down Expand Up @@ -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)
5 changes: 4 additions & 1 deletion game_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

0 comments on commit d11a94b

Please sign in to comment.