Skip to content

Commit e525416

Browse files
committed
extended on range to account for variance in pause block weight
1 parent 006cfdd commit e525416

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

analyze.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ def graph():
1616
y5 = []
1717
y6 = []
1818
y7 = []
19+
y8 = []
1920

2021
axv_count = 0
2122
start = time.time()
2223
base = scale.tower_wt - scale.min_block_wt * 4
2324
start_time = time.time()
24-
input("Press enter to start graphing")
25+
input("Press enter to start graphing. Press down on tower lightly to end analysis.")
2526
print (base)
2627

2728
while True:
@@ -35,6 +36,7 @@ def graph():
3536
y5.append(scale.on_min)
3637
y6.append(scale.on_max)
3738
y7.append(scale.std_trigger + base)
39+
y8.append(scale.pause)
3840

3941
if scale.off() and axv_count == 0:
4042
x_vert.append(time.time() -start_time)
@@ -46,17 +48,18 @@ def graph():
4648
if scale.on():
4749
axv_count = 0
4850

49-
if scale.paused() or scale.current_weight() > 2:
51+
if scale.current_weight() > 2:
5052
break
5153

5254
#plot everything
53-
plt.plot(x,y7,label='std trigger',color='black')
54-
plt.plot(x,y1,label='current weight',color='blue',alpha=.6)
55-
plt.plot(x,y2,label='off range',color='yellow',alpha=0.2)
56-
plt.plot(x,y5,label='on range',color='grey',alpha=0.2)
57-
plt.plot(x,y4,label='tower std + 1.68',color='red',alpha=.6)
58-
plt.plot(x,y3,color='yellow',alpha=0.2)
59-
plt.plot(x,y6,color='grey',alpha=0.2)
55+
plt.plot(x,y7,label='std trigger', color='black')
56+
plt.plot(x,y1,label='current weight', color='blue', alpha=.6)
57+
plt.plot(x,y2,label='off range', color='yellow', alpha=0.2)
58+
plt.plot(x,y5,label='on range', color='grey', alpha=0.2)
59+
plt.plot(x,y4,label='tower std + 1.68', color='red', alpha=.6)
60+
plt.plot(x,y3,color='yellow', alpha=0.2)
61+
plt.plot(x,y6,color='grey', alpha=0.2)
62+
plt.plot(x,y8,label='pause line', color='blue', alpha=0.2)
6063

6164
for xc in x_vert:
6265
plt.axvline(x=xc, color='k', linestyle='--')

lib/scale.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def __init__(self):
4747
self.min_block_wt = (self.avg_block_wt * (1 - self.block_variance))
4848

4949
#set scale status variables
50-
self.on_max = self.tower_wt + self.avg_block_wt/10
51-
self.on_min = self.tower_wt - self.avg_block_wt/10
50+
self.on_max = self.tower_wt + (self.avg_block_wt * self.block_variance)
51+
self.on_min = self.tower_wt - (self.avg_block_wt * self.block_variance)
5252

5353
self.off_max = self.tower_wt - self.min_block_wt
5454
self.off_min = self.tower_wt - self.max_block_wt

play.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ def main():
3737
countdown = False
3838

3939
clear_screen()
40+
print("tower details:")
41+
print(scale.__dict__)
4042
input("Press enter to start the game")
4143
clear_screen()
4244

@@ -63,7 +65,7 @@ def main():
6365
print (game.current_player().status())
6466

6567
while scale.paused():
66-
pass
68+
print(scale.__dict__['pause'],scale.current_weight(),scale.status())
6769

6870
game.current_player().start_turn()
6971
sound.start_turn()

0 commit comments

Comments
 (0)