Improve AgentOfChaos documentation

bram/mute
Bram van den Heuvel 2026-07-01 22:45:39 +02:00
parent 194f962746
commit 220c956ba0
1 changed files with 12 additions and 2 deletions

View File

@ -32,7 +32,7 @@ class AgentOfChaos(Agent):
def __init__(self) -> None:
"""
Create a new instance of the agent of chaos.
Agent that always tries to make a "random" move.
"""
super().__init__(
name="Agent of chaos",
@ -65,4 +65,14 @@ def play_tic_tac_toe(payload : Payload) -> Payload:
return { "move": random.choice(options) }
def play_royal_game_of_ur(payload : Payload) -> Payload:
return { "move": random.choice(payload.get("valid_moves", [""])) }
"""
The royal game of Ur already returns a set of valid moves.
We can lazily just pick one of these options and return it.
:param payload: The incoming game state.
:type payload: dict[str, Any]
:return: The agent of chaos' random choice
:rtype: dict[str, Any]
"""
return { "move": random.choice(payload.get("valid_moves", [""])) }