-
Notifications
You must be signed in to change notification settings - Fork 0
/
score.py
184 lines (165 loc) · 4.57 KB
/
score.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
import os
import time
import sys
import getpass
def CROSS(colnum):
tl = "+"
for i in range(int(colnum)-2):
tl += "-"
tl += "+"
print tl
def EMPTY(rownum, colnum):
empt = (int(rows)-26) - 1
tl = ""
for i in range(int(colnum)-2):
tl += " "
for i in range(empt):
print tl
def TITLE(TITLE, colnum, lf):
empt = (int(colnum) - len(TITLE) - 2)/2
tr = "+"
for i in range(empt):
tr += " "
tr += TITLE
for i in range(empt):
tr += " "
if lf:
tr += "+"
else:
tr += "+"
print tr
def quad1(colnum, fwh, pdh, ah, hs):
tl = "+"
for i in range(int(colnum)-2):
tl += " "
tl += "+"
print tl
l1 = len("fireweed hits") + len("pandora hits")
l2 = len("arugula hits") + len("honey suckle hits")
empt1 = (int(colnum)-7-l1)/2
tr="+"
for i in range(empt1):
tr+= " "
tr += "FIREWEED HITS:" + str(fwh)
tr += " "
tr += "PANDORA HITS:" + str(pdh)
for i in range(empt1):
tr+= " "
tr += "+"
print tr
tl = "+"
for i in range(int(colnum)-2):
tl += " "
tl += "+"
print tl
empt2 = (int(colnum)-7-l2)/2
tr2="+"
for i in range(empt2-1):
tr2+= " "
tr2 += "ARUGULA HITS:" + str(ah)
tr2 += " "
tr2 += "HONEYSUCKLE HITS:" + str(hs)
for i in range(empt1):
tr2 += " "
tr2 += "+"
print tr2
def quad2(colnum, mp1, mp2, fr1, fr2):
tl = "+"
for i in range(int(colnum)-2):
tl += " "
tl += "+"
print tl
l1 = len("MISFIRE PENALTY (NO PLANTS)")
l2 = len("MISFIRE PENALTY (WRONG PLANTS)")
l3 = len("FINISH RING BONUS (POLLINATE)")
l4 = len("FINISH RING BONUS (DONATION)")
empt1 = (int(colnum)-3-l1-len(str(mp1)))/2
tr="+"
for i in range(empt1):
tr+= " "
tr += "MISFIRE PENALTY (NO PLANTS):" + str(mp1)
for i in range(empt1):
tr+= " "
if len(str(mp1)) % 2 == 0:
tr += " +"
else:
tr += "+"
print tr
empt2 = (int(colnum)-3-l2-len(str(mp2)))/2
tr="+"
for i in range(empt2):
tr+= " "
tr += "MISFIRE PENALTY (WRONG PLANTS):" + str(mp2)
for i in range(empt2+1):
tr+= " "
tr += "+"
print tr
def SCORE(SCORE, colnum, lf):
empt = (int(colnum) - len(str(SCORE)) - len("TOTAL SCORE:") - 2)/2
tr = "+"
for i in range(empt):
tr += " "
tr += "TOTAL SCORE:" + str(SCORE)
for i in range(empt):
tr += " "
if len(str(SCORE)) % 2 == 0:
tr += " +"
else:
tr += "+"
print tr
def POL_RATIO(NUM, DEN, colnum, lf):
empt = (int(colnum) - len("POLLINATION HIT RATIO:") - 5)/2
tr = "+"
for i in range(empt):
tr += " "
tr += "POLLINATION HIT RATIO:" + str(NUM) + "/" + str(DEN)
for i in range(empt):
tr += " "
if lf:
tr += " +"
else:
tr += "+"
print tr
if __name__ == "__main__":
ascititle = """
___ __ __ __
/ | _____/ /__________ / /_ ____ / /_____ _____ __ __
/ /| | / ___/ __/ ___/ __ \/ __ \/ __ \/ __/ __ `/ __ \/ / / /
/ ___ |(__ ) /_/ / / /_/ / /_/ / /_/ / /_/ /_/ / / / / /_/ /
/_/ |_/____/\__/_/ \____/_.___/\____/\__/\__,_/_/ /_/\__, /
/____/
"""
username = getpass.getuser()
while True:
rows, columns = os.popen('stty size', 'r').read().split()
f = open("/home/" + str(username) + "/ZR_Astrobee/out.txt")
gamepoints = []
for ind, item in enumerate(f.readlines()):
if ind != 0:
gamepoints.append(int(item))
else:
gamepoints.append(item.rstrip())
os.system("clear")
CROSS(columns)
print ascititle
#EMPTY(rows, columns)
CROSS(columns)
TITLE(gamepoints[0], columns, True)
CROSS(columns)
TITLE("COLLECTIONS", columns, False)
quad1(columns, gamepoints[1], gamepoints[2], gamepoints[3], gamepoints[4])
CROSS(columns)
TITLE("DONATIONS", columns, False)
quad1(columns, gamepoints[5], gamepoints[6], gamepoints[7], gamepoints[8])
CROSS(columns)
TITLE("BONUSES/PENALTIES", columns, False)
quad2(columns, gamepoints[9], gamepoints[10], gamepoints[11], gamepoints[12])
CROSS(columns)
POL_RATIO(gamepoints[13], gamepoints[14], columns, False)
CROSS(columns)
SCORE(gamepoints[15], columns, False)
CROSS(columns)
#EMPTY(rows, columns)
CROSS(columns)
time.sleep(1)
os.system("clear")