def _find_action(command: str, actions: Iterable[Action], inform7: Inform7Game) -> None: """ Apply a text command to a game_progression object. """ commands = inform7.gen_commands_from_actions(actions) for action, cmd in zip(actions, commands): if command == cmd: return action raise ValueError("No action found matching command: {}.".format(command))
def _apply_command(command: str, game_progression: GameProgression, inform7: Inform7Game) -> None: """ Apply a text command to a game_progression object. """ valid_commands = inform7.gen_commands_from_actions(game_progression.valid_actions) for action, cmd in zip(game_progression.valid_actions, valid_commands): if command == cmd: game_progression.update(action) return raise ValueError("Not a valid command: {}. Expected: {}".format(command, valid_commands))