1 from operationscore.Behavior import *
3 """Square is a simple behavior that makes a square with side lengths Width*2 around locations in
4 the sensor input. Specify:
5 <Width> -- the sidelength/2
6 """
7
9 for sensory in sensorInputs:
10 sensory['CenterLoc'] = list(sensory['Location'])
11 xLoc = sensory['Location'][0]
12 yLoc = sensory['Location'][1]
13 width = self['Width']
14
15 sensory['Location'] =\
16 '{x}<'+str(xLoc+width)+',{x}>'+str(xLoc-width)+\
17 ',{y}<'+str(yLoc+width)+',{y}>'+str(yLoc-width)
18 return (sensorInputs, recursiveInputs)
19
21 coutput = Behavior.deepCopyPacket(output)
22 for data in coutput:
23 data['Location'] = data['CenterLoc']
24 return coutput
25