-
Notifications
You must be signed in to change notification settings - Fork 16
/
reader.py
102 lines (88 loc) · 2.88 KB
/
reader.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# reader (by Guo Hao)
# 读取复盘数据,以文本形式输出
import shelve
filename="[E.M]T_Unicorn-VS-T_idiot" # 根据待转换文件名修改
file=shelve.open(filename)
with open("[E.M]T_Unicorn-VS-T_idiot.txt",'w') as output: # 根据输出文件名修改
output.write("DIM:")
output.write(str(file['DIM']))
output.write("\n")
output.write("TMAX:")
output.write(str(file['TMAX']))
output.write("\n")
output.write("tick_step:")
output.write(str(file['tick_step']))
output.write("\n")
output.write("West:")
output.write(file['West'])
output.write("\n")
output.write("East:")
output.write(file['East'])
output.write("\n")
output.write("tick_total:")
output.write(str(file['tick_total']))
output.write("\n")
output.write("winner:")
output.write(file['winner'] )
output.write("\n")
output.write("reason:")
output.write(file['reason'])
output.write("\n")
output.write("log:")
for entry in file["log"]:
output.write("\n")
output.write("tick:")
output.write(str(entry.tick))
output.write("\n")
output.write("side:")
output.write("\n")
output.write(" life:")
output.write(str(entry.side.life))
output.write("\n")
output.write(" pos:")
output.write(str(entry.side.pos))
output.write("\n")
output.write(" action:")
output.write("\n")
output.write(" bat:")
output.write(str(entry.side.action.bat))
output.write("\n")
output.write(" acc:")
output.write(str(entry.side.action.acc))
output.write("\n")
output.write(" run:")
output.write(str(entry.side.action.run))
output.write("\n")
output.write(" card_box:")
output.write(str(entry.side.card_box))
output.write("\n")
output.write("op_side:")
output.write("\n")
output.write(" life:")
output.write(str(entry.op_side.life))
output.write("\n")
output.write(" pos:")
output.write(str(entry.op_side.pos))
output.write("\n")
output.write(" action:")
output.write("\n")
output.write(" bat:")
output.write(str(entry.op_side.action.bat))
output.write("\n")
output.write(" acc:")
output.write(str(entry.op_side.action.acc))
output.write("\n")
output.write(" run:")
output.write(str(entry.op_side.action.run))
output.write("\n")
output.write(" card_box:")
output.write(str(entry.op_side.card_box))
output.write("\n")
output.write("ball:")
output.write("\n")
output.write(" pos:")
output.write(str(entry.ball.pos))
output.write("\n")
output.write(" velocity:")
output.write(str(entry.ball.velocity))
output.write("\n")