Пример #1
0
 def processResponse(self, sensorInputs, recursiveInputs):
     ret = []
     for sensory in sensorInputs:
         newDict = dict(sensory) 
         if self['ColorList'] != None:
             if isinstance(self['ColorList'], list):
                 newDict['Color'] = color.chooseRandomColor(self['ColorList'])  #Pick randomly
             else:
                 newDict['Color'] = self['ColorList'] #Unless there is only one
         else:
             newDict['Color'] = color.randomColor() 
         ret.append(newDict)
     return (ret, [])
Пример #2
0
 def processResponse(self, sensorInputs, recursiveInputs):
     ret = []
     for sensory in sensorInputs:
         newDict = dict(sensory) 
         if self['ColorList'] != None:
             if isinstance(self['ColorList'], list):
                 newDict['Color'] = color.chooseRandomColor(self['ColorList'])  #Pick randomly
             else:
                 newDict['Color'] = self['ColorList'] #Unless there is only one
         else:
             newDict['Color'] = color.randomColor() 
         ret.append(newDict)
     #print ret
     return (ret, [])
Пример #3
0
    def processResponse(self, sInputs, rInputs):
        simpleOut = []
        recurOut = []
        
        for data in rInputs:
            if data['Radius'] > self['MaxRadius']:
                continue
            
            data['Radius'] += self['StepSize']
            xLoc = data['CenterLoc'][0]
            yLoc = data['CenterLoc'][1]
            rad = data['Radius']
            cond = '>=' if self['Outside'] else '<='
            circleStr = 'math.sqrt(({x}-'+str(xLoc)+')**2+(({y}-'+str(yLoc)+')**2))'+cond+str(rad)
            data['Location'] = circleStr

            simpleOut.append(data)            
            recurOut.append(data)
                        
        for data in sInputs:
            data['Radius'] = 1
            #import pdb; pdb.set_trace()
            if 'CenterLoc' in data:
                xLoc = data['CenterLoc'][0]
                yLoc = data['CenterLoc'][1]
            else:
                data['CenterLoc'] = tuple(data['Location'])
                xLoc = data['Location'][0]
                yLoc = data['Location'][1]

            #if not self['Id']+'Radius' in data:
            #    data[self['Id']+'Radius'] = self['Radius']
                
            rad = data['Radius']
            cond = '>=' if self['Outside'] else '<='
            circleStr = 'math.sqrt(({x}-'+str(xLoc)+')**2+(({y}-'+str(yLoc)+')**2))'+cond+str(rad)
            data['Location'] = circleStr
            data['Color'] = color.randomColor() 

            simpleOut.append(data)
            recurOut.append(data)
            
        return (simpleOut, recurOut)