from os import stat from re import S from acts import * def check_condition(state, conditions, type=all): if type(i in state for i in conditions): return True return False def taktyka_dialogu(state): if should_respond_gently(state): return [hello_act, name_response_act] if should_prompt(state): return [hello_act, help_response_act] if should_respond_cold(state): return [name_response_act] return [unknown_act] def should_respond_gently(state): return check_condition(state, [hello_act, name_request_act]) def should_prompt(state): return check_condition(state, [hello_act], any) def should_respond_cold(state): return check_condition(state, [name_request_act])