"""BabySnake's observation_function: maps a game to its tabular Q-learning state.

Referenced from babysnake/pyproject.toml's [tool.retro-gamer] section, and
used directly by train_babysnake.py via GameEnvironment.
"""

ACTIONS = ["KEY_RIGHT", "KEY_DOWN", "KEY_LEFT", "KEY_UP"]


def get_state(game):
    """Return BabySnake's state as a hashable (agent_x, agent_y, food_x, food_y) tuple."""
    s = game.state
    return (int(s['agent_x']), int(s['agent_y']), int(s['food_x']), int(s['food_y']))
