1 from operationscore.Behavior import *
2 import pdb
4 """RecursiveDecay is an event to allow recursive hooks to stop recursing after a certain number
5 of iterations specified in
6 <InitialResponseCount> -- Int, number of total responses.
7 Designed to be used as part of a recursive hook.
8 """
10 ret = []
11 for response in sensorInputs:
12 if not 'ResponsesLeft' in response:
13 response['ResponsesLeft'] = self['InitialResponseCount']
14 else:
15 response['ResponsesLeft'] -= 1
16 if response['ResponsesLeft'] > 0:
17 ret.append(response)
18 return (ret, [])
19