Skip to content
Browse files

Merge pull request #47 from elachuni/master

Added a cross fab task
  • Loading branch information...
2 parents 94228a2 + bd948ae commit 188fa4557e762d16fcafa426411df94dc1e90c8f @elachuni elachuni committed Jul 8, 2012
Showing with 16 additions and 4 deletions.
  1. +1 −4 bots/sulu.py
  2. +15 −0 fabfile.py
View
5 bots/sulu.py
@@ -1,6 +1,6 @@
from twisted.internet.protocol import ClientFactory
from twisted.internet import reactor
-from random import shuffle, choice
+from random import choice
from spacecraft.client_helpers import relative_angle
from spacecraft.euclid import LineSegment2, Point2, Matrix3
from math import sqrt, atan2, pi
@@ -167,9 +167,6 @@ def parse_sensor(self, message):
options = [o for o in options if o.visits == options[0].visits]
#~ print "Options:", options
self.going = max(options, key=lambda t:t.distance_to(x, y))
- # Random exploration
- #~ shuffle(options)
- #~ self.going = min(options, key=lambda t:t.visits)
speed = speedx**2 + speedy**2
speedangle = atan2(speedy, speedx)
targetangle = atan2(self.going.y - y, self.going.x - x)
View
15 fabfile.py
@@ -60,6 +60,21 @@ def versus(bot1, bot2, *server_args):
for proc in procs:
proc.terminate()
+def cross(*bots):
+ """Start a server and two clients, and a monitor to watch them"""
+ check_bootstrap()
+ procs = []
+ procs.append(subprocess.Popen(
+ ['./virtualenv/bin/twistd', '-n', 'spacecraft', '--map',
+ 'maps/cross.svg', '--xsize', '300', '--ysize', '300']))
+ sleep(2)
+ for bot in bots:
+ procs.append(subprocess.Popen(
+ ['./virtualenv/bin/python', bot], env={'PYTHONPATH': '.'}))
+ local('PYTHONPATH=. ./virtualenv/bin/python spacecraft/monitor.py --size 600x600')
+ for proc in procs:
+ proc.terminate()
+
# -----------------------------------------------------------------
# Tasks from here down aren't intended to be used directly

0 comments on commit 188fa45

Please sign in to comment.
Something went wrong with that request. Please try again.