def test_unite_parameters(): """ test ActionNTimesWithSimilarParameters """ a = [0, 0] def a_action(parameters): a = parameters a[0] += 1 def b_action(parameters): a = parameters a[1] += 1 _sequences = [ sequence.ActionNTimesWithSimilarParameters(a_action, a, 5), sequence.ActionNTimesWithSimilarParameters(b_action, a, 5) ] _sequence = sequence.Unite(_sequences) def snapshot(index): print(a) def check(): return True result = sequence.handle(_sequence, check, snapshot) print(result) return
def test_handles_check(): a = [0] def a_action(parameters): a = parameters a[0] += 1 _sequence = sequence.ActionNTimesWithSimilarParameters(a_action, a, 10) def snapshot(index): print(a[0]) def check(): return a[0] < 6 result = sequence.handle(_sequence, check, snapshot) print(result) return
def test_action_n_times_with_similar_parameters(): """ test ActionNTimesWithSimilarParameters """ a = [0] def a_action(parameters): a = parameters a[0] += 1 _sequence = sequence.ActionNTimesWithSimilarParameters(a_action, a, 10) def snapshot(index): print(a[0]) def check(): return True result = sequence.handle(_sequence, check, snapshot) print(result) return
def get_sequence(self): frames = random.uniform(self._min_frames, self._max_frames) return sequence.ActionNTimesWithSimilarParameters( action.empty, (), frames)
def get_sequence(self): return sequence.ActionNTimesWithSimilarParameters( foo, self._num, self._len)