aboutsummaryrefslogtreecommitdiff
path: root/behaviors/Square.py
blob: 9d3223a1b266fa617f36ed52a67d370f200cb10c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from operationscore.Behavior import *
class Square(Behavior):
    """Square is a simple behavior that makes a square with side lengths Width*2 around locations in
    the sensor input.  Specify:
    <Width> -- 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)