From aaf8bdbee7fdc1d4721f43307fc824c373c69ec4 Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Mon, 10 Jan 2011 23:24:02 -0500 Subject: some improvements to behavior chain. A "Square" Behavior --- behaviors/Square.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 behaviors/Square.py (limited to 'behaviors/Square.py') diff --git a/behaviors/Square.py b/behaviors/Square.py new file mode 100644 index 0000000..a6e9401 --- /dev/null +++ b/behaviors/Square.py @@ -0,0 +1,11 @@ +from operationscore.Behavior import * +class Square(Behavior): + 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'] =\ + '{x}<'+str(xLoc+width)+',{x}>'+str(xLoc-width)+\ + ',{y}<'+str(yLoc+width)+',{y}>'+str(yLoc-width) + return (sensorInputs, recursiveInputs) -- cgit v1.2.3