aboutsummaryrefslogtreecommitdiff
path: root/behaviors/Square.py
diff options
context:
space:
mode:
Diffstat (limited to 'behaviors/Square.py')
-rw-r--r--behaviors/Square.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/behaviors/Square.py b/behaviors/Square.py
index aef3622..ecd000c 100644
--- a/behaviors/Square.py
+++ b/behaviors/Square.py
@@ -2,11 +2,12 @@ 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'] = 'True'
- sensory['Location'] =\
- '{x}<'+str(xLoc+width)+',{x}>'+str(xLoc-width)+\
- ',{y}<'+str(yLoc+width)+',{y}>'+str(yLoc-width)
+ if 'Location' in sensory:
+ xLoc = sensory['Location'][0]
+ yLoc = sensory['Location'][1]
+ width = self['Width']
+ #sensory['Location'] = 'True'
+ sensory['Location'] =\
+ '{x}<'+str(xLoc+width)+',{x}>'+str(xLoc-width)+\
+ ',{y}<'+str(yLoc+width)+',{y}>'+str(yLoc-width)
return (sensorInputs, recursiveInputs)