diff options
Diffstat (limited to 'behaviors')
-rw-r--r-- | behaviors/RandomWalk.py | 2 | ||||
-rw-r--r-- | behaviors/RestrictLocation.py | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/behaviors/RandomWalk.py b/behaviors/RandomWalk.py index 5a32792..dfe6716 100644 --- a/behaviors/RandomWalk.py +++ b/behaviors/RandomWalk.py @@ -6,8 +6,8 @@ import random class RandomWalk(Behavior): def processResponse(self, sensors, recursives): ret = [] + s = self['StepSize'] for sensory in sensors: - s = self['StepSize'] step = [random.randint(-s,s), random.randint(-s,s)] outdict = dict(sensory) outdict[Strings.LOCATION] = Geo.addLocations(step, outdict[Strings.LOCATION]) diff --git a/behaviors/RestrictLocation.py b/behaviors/RestrictLocation.py new file mode 100644 index 0000000..649500f --- /dev/null +++ b/behaviors/RestrictLocation.py @@ -0,0 +1,12 @@ +from operationscore.Behavior import * +import util.ComponentRegistry as compReg +import util.Geo as Geo +import util.Strings as Strings +import random +class RestrictLocation(Behavior): + def behaviorInit(self): + action = self['Action'] + modifyParamArgs = {'ParamType': 'Sensor', + 'ParamName':self['ParamName'],'ParamOp':self['Action']} + + def processInput( |