diff --git a/src/Puppitor_test_harness.py b/src/Puppitor_test_harness.py new file mode 100644 index 0000000..1424240 --- /dev/null +++ b/src/Puppitor_test_harness.py @@ -0,0 +1,64 @@ +import affecter +import gesture_keys +import animation_structure + +test_affecter = affecter.Gesture_Affecter('test_passions_rules.json','./affect_rules/') +test_anim_struct = animation_structure.Animation_Structure(4) +test_affect_vector = affecter.Affect_Vector(test_affecter.affect_rules.keys(), test_affecter.affect_rules) + +test_gesture_keys_obj = gesture_keys.Gesture_Interface() + +test_gesture_keys_obj.update_possible_states('open_flow', True) +test_gesture_keys_obj.update_possible_states('tempo_up', True) +test_gesture_keys_obj.update_possible_states('tempo_down', True) +test_gesture_keys_obj.update_possible_states('closed_flow', True) +test_gesture_keys_obj.update_possible_states('projected_energy', True) +test_gesture_keys_obj.update_possible_states('pause', True) + +print(test_gesture_keys_obj.possible_action_states) +print() + +test_gesture_keys_obj.update_actual_states('open_flow', True) +test_affecter.update_affect(test_affect_vector, test_gesture_keys_obj.current_states['actions'], test_gesture_keys_obj.current_states['modifiers']) +print(test_gesture_keys_obj.actual_action_states) +print() +print(test_affect_vector.affects) +test_gesture_keys_obj.update_actual_states('closed_flow', True) +test_affecter.update_affect(test_affect_vector, test_gesture_keys_obj.current_states['actions'], test_gesture_keys_obj.current_states['modifiers']) +print(test_gesture_keys_obj.actual_action_states) +print() +print(test_affect_vector.affects) +print() +test_gesture_keys_obj.update_actual_states('projected_energy', True) +test_affecter.update_affect(test_affect_vector, test_gesture_keys_obj.current_states['actions'], test_gesture_keys_obj.current_states['modifiers']) +print(test_gesture_keys_obj.actual_action_states) +print() +print(test_affect_vector.affects) +print() +test_gesture_keys_obj.update_actual_states('resting', True) +test_affecter.update_affect(test_affect_vector, test_gesture_keys_obj.current_states['actions'], test_gesture_keys_obj.current_states['modifiers']) +print(test_gesture_keys_obj.actual_action_states) +print() +print(test_affect_vector.affects) +print() +test_gesture_keys_obj.update_actual_states('tempo_up', True) +test_affecter.update_affect(test_affect_vector, test_gesture_keys_obj.current_states['actions'], test_gesture_keys_obj.current_states['modifiers']) +print(test_gesture_keys_obj.actual_action_states) +print() +print(test_affect_vector.affects) +print() +test_gesture_keys_obj.update_actual_states('tempo_down', True) +test_affecter.update_affect(test_affect_vector, test_gesture_keys_obj.current_states['actions'], test_gesture_keys_obj.current_states['modifiers']) +print(test_gesture_keys_obj.actual_action_states) +print() +print(test_affect_vector.affects) +print() +test_gesture_keys_obj.update_actual_states('neutral', True) +test_affecter.update_affect(test_affect_vector, test_gesture_keys_obj.current_states['actions'], test_gesture_keys_obj.current_states['modifiers']) +print(test_gesture_keys_obj.actual_action_states) +print() +print(test_affect_vector.affects) +print() + +print(test_affecter.get_possible_affects(test_affect_vector)) +print(test_affecter.get_prevailing_affect(test_affect_vector)) \ No newline at end of file diff --git a/src/__pycache__/affecter.cpython-38.pyc b/src/__pycache__/affecter.cpython-38.pyc new file mode 100644 index 0000000..a9f2d8e Binary files /dev/null and b/src/__pycache__/affecter.cpython-38.pyc differ diff --git a/src/__pycache__/animation_structure.cpython-38.pyc b/src/__pycache__/animation_structure.cpython-38.pyc new file mode 100644 index 0000000..4eb93a2 Binary files /dev/null and b/src/__pycache__/animation_structure.cpython-38.pyc differ diff --git a/src/__pycache__/gesture_keys.cpython-38.pyc b/src/__pycache__/gesture_keys.cpython-38.pyc new file mode 100644 index 0000000..027ff86 Binary files /dev/null and b/src/__pycache__/gesture_keys.cpython-38.pyc differ diff --git a/src/affecter.py b/src/affecter.py index 92552ae..a54507d 100644 --- a/src/affecter.py +++ b/src/affecter.py @@ -20,7 +20,7 @@ def __init__(self, affect_rules_name, affect_rules_directory, affect_floor = 0.0 self.floor_value = affect_floor self.ceil_value = affect_ceiling self.equilibrium_action = equilibrium_action - self.current_affect = self.affect_rules.keys()[0] # TODO do something more consistent and robust + self.current_affect = None # changed to None because this value will get updated immediately through the run loop (as long as you call update_affect() # for use clamping the updated affect values between a given floor_value and ceil_value def _update_and_clamp_values(self, affect_value, affect_update_value, floor_value, ceil_value):