aboutsummaryrefslogtreecommitdiff
path: root/behaviors/Square.py
diff options
context:
space:
mode:
authorGravatar Russell Cohen <rcoh@mit.edu>2011-01-10 23:24:02 -0500
committerGravatar Russell Cohen <rcoh@mit.edu>2011-01-10 23:24:02 -0500
commitaaf8bdbee7fdc1d4721f43307fc824c373c69ec4 (patch)
treeee22f0ac45dede7fa8263cfc91f2730b19d07da9 /behaviors/Square.py
parenta1969e4c4bf61bc6e73c6a59fbef96e8ce361611 (diff)
some improvements to behavior chain. A "Square" Behavior
Diffstat (limited to 'behaviors/Square.py')
-rw-r--r--behaviors/Square.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/behaviors/Square.py b/behaviors/Square.py
new file mode 100644
index 0000000..a6e9401
--- /dev/null
+++ b/behaviors/Square.py
@@ -0,0 +1,11 @@
+from operationscore.Behavior import *
+class Square(Behavior):
+ def processResponse(self, sensorInputs, recursiveInputs):
+ for sensory in sensorInputs:#TODO: consider replicating the dict
+ xLoc = sensory['Location'][0]
+ yLoc = sensory['Location'][1]
+ width = self['Width']
+ sensory['Location'] =\
+ '{x}<'+str(xLoc+width)+',{x}>'+str(xLoc-width)+\
+ ',{y}<'+str(yLoc+width)+',{y}>'+str(yLoc-width)
+ return (sensorInputs, recursiveInputs)