Skip to content

Agents

Simple bundled agents for testing and baselines.

BiasedRandomAgent

An agent that favors its own party where it can and otherwise plays at random.

It discards a policy of the other party, enacts a policy of its own party and always votes ja. Every other choice is random.

Attributes:

Name Type Description
uid

The player's unique ID.

__init__

__init__(uid: int)

Creates the agent.

Parameters:

Name Type Description Default
uid int

The player's unique ID.

required

choose_action async

choose_action(
    state: GameState, valid_actions: tuple[Action, ...]
) -> Action

Returns the first offered action that favors the agent's party, or a random one.

Parameters:

Name Type Description Default
state GameState

The game state, scrubbed for this agent.

required
valid_actions tuple[Action, ...]

The actions this agent may take now.

required

Returns:

Type Description
Action

One of valid_actions.

RandomAgent

An agent that chooses uniformly at random from the offered actions.

Attributes:

Name Type Description
uid

The player's unique ID.

__init__

__init__(uid: int)

Creates the agent.

Parameters:

Name Type Description Default
uid int

The player's unique ID.

required

choose_action async

choose_action(
    state: GameState, valid_actions: tuple[Action, ...]
) -> Action

Returns a random offered action.

Parameters:

Name Type Description Default
state GameState

The game state, scrubbed for this agent.

required
valid_actions tuple[Action, ...]

The actions this agent may take now.

required

Returns:

Type Description
Action

One of valid_actions.