forked from HelmerNylen/mkbsc
/
print.py
38 lines (32 loc) · 1.07 KB
/
print.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
from mkbsc import export
from parse import parse
import os
import json
import shutil
def printpng(file):
character = ""
index1 = 1
index2 = 1
f = open(file, 'r')
if os.path.isdir("pictures/basegame"):
shutil.rmtree("pictures/basegame") #deletes previous folders with pictures
os.mkdir("pictures/basegame")
for line in f:
data = json.loads(line)
if(data['stabilises'] > 0):
character = "stabilised" + str(index1)
index1 += 1
else:
character = "divergent" + str(index2)
index2 += 1
os.mkdir("pictures/basegame/" + character)
game = parse(data)
g1 = game.KBSC()
g2 = g1.KBSC()
g3 = g2.KBSC()
export(game, "G", folder="pictures/basegame/"+character, view=False)
export(g1, "GK1", folder="pictures/basegame/"+character, view=False)
export(g2, "GK3", folder="pictures/basegame/"+character, view=False)
export(g3, "GK4", folder="pictures/basegame/"+character, view=False)
print("hi")
printpng('analysedgames.txt')