blob: 9ae98b91d0e41a589cc916a8c96b2d8f32471d8f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
from operationscore.Behavior import *
import util.ComponentRegistry as compReg
import util.Geo as Geo
import util.Strings as Strings
class MoveBehavior(Behavior):
def processResponse(self, sensorInputs, recursiveInputs):
print 'processing'
print sensorInputs
if recursiveInputs:
currRecLocs = recursiveInputs
else:
currRecLocs = [{'Location' : (5, 5)), 'Color' : [255, 255, 255]}]
if sensorInputs: # if input exists, change location
ret = []
for currRecLoc in currRecLocs:
currDict = dict(currRecLoc)
for sensorInput in sensorInputs:
currDict['Location'][0] += sensorInput['x'] * self['XStep']
currDict['Location'][1] += sensorInput['y'] * self['YStep']
#currDict['Color'] = sensorInput['color']
ret.append(currDict)
#print ret
return (ret, ret)
else: # if not, return current recursive location.
#print currRecLocs
return (currRecLocs, currRecLocs)
|