Terminal state utilities.
Provides helper functions to determine if the current state is terminal
(win/loss) or valid (agent exists and has a position).
is_terminal_state(state, agent_id)
Return True if state already satisfies win/lose or agent is dead.
is_valid_state(state, agent_id)
Return True if agent exists and has a position.