summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgroup1 <f16_group1@pbridge.adm.cs.cmu.edu>2016-10-13 23:51:42 -0400
committergroup1 <f16_group1@pbridge.adm.cs.cmu.edu>2016-10-13 23:51:42 -0400
commitcc3d2cd333f6c0c18a201d4ede36b1c62e9caef8 (patch)
tree42325e072f934e42b969a3219b35e73a51e51b9d
parent86761b1f1075953a08944d178b05c0b3c259d243 (diff)
downloadbridge-cc3d2cd333f6c0c18a201d4ede36b1c62e9caef8.tar.zst
Package include path fix and add optimization for computing coverage
-rw-r--r--ShowRunner.py4
-rw-r--r--fish_show.py4
-rwxr-xr-xwebapp/run.py2
3 files changed, 6 insertions, 4 deletions
diff --git a/ShowRunner.py b/ShowRunner.py
index 05877ed..0357efd 100644
--- a/ShowRunner.py
+++ b/ShowRunner.py
@@ -10,8 +10,8 @@ from run import server_thread, send_queue, recv_queue
def run_show():
server_thread.start()
bridge = Bridge()
- SunriseShow(bridge, send_queue=recv_queue, recv_queue=send_queue).run(framerate=FRAME_RATE)
+# SunriseShow(bridge, send_queue=recv_queue, recv_queue=send_queue).run(framerate=FRAME_RATE)
FishShow(bridge, send_queue=recv_queue, recv_queue=send_queue).run(framerate=FRAME_RATE)
print "done!"
-run_show() \ No newline at end of file
+run_show()
diff --git a/fish_show.py b/fish_show.py
index 6677ddd..84b0516 100644
--- a/fish_show.py
+++ b/fish_show.py
@@ -89,6 +89,7 @@ class Fish(object):
class Light(object):
"""Represent a bridge light and its state."""
+ __slots__=('light', 'color', 'transitioning_to', 'x', 'y', 'step')
def __init__(self, x, y, light):
"""Store all facts about a light."""
self.light = light
@@ -112,7 +113,8 @@ class Light(object):
new_color = new_background
for fish in fishes:
coverage = compute_coverage(fish, self.x, self.y)
- new_color = coverage * fish.color + (1 - coverage) * new_color
+ if coverage > 0.01:
+ new_color = coverage * fish.color + (1 - coverage) * new_color
self.light.setRGBRaw(
*map(lambda x: clamp(0, x, 1), new_color.components)
)
diff --git a/webapp/run.py b/webapp/run.py
index 2290f41..fb270a9 100755
--- a/webapp/run.py
+++ b/webapp/run.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import sys
-sys.path.append('packages')
+sys.path.append('webapp/packages')
import threading