From 5fb3ea060025241105dc8e9a174513c112f9a133 Mon Sep 17 00:00:00 2001 From: rcoh Date: Thu, 27 Jan 2011 16:50:59 -0500 Subject: A metric $#%$-ton of changes. Added doc-strings to EVERYTHING. Phew. Fixed a massive bug that increases performance in by up to a factor of 60. A bunch of new behaviors for the class. --- behaviors/Square.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'behaviors/Square.py') diff --git a/behaviors/Square.py b/behaviors/Square.py index aef3622..9d3223a 100644 --- a/behaviors/Square.py +++ b/behaviors/Square.py @@ -1,12 +1,17 @@ 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) - return (sensorInputs, recursiveInputs) + """Square is a simple behavior that makes a square with side lengths Width*2 around locations in + the sensor input. Specify: + -- the sidelength/2 + """ + + 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) + return (sensorInputs, recursiveInputs) -- cgit v1.2.3