in games/play.py [0:0]
def make_play():
last_move = None
@tool("play")
def play(
observations: list[str],
reward: str,
step: int,
game: int,
move: str,
rationale: str,
) -> str:
"""Play a move in rock-paper-scissors.
Given observations and reward; play a move with the given rationale.
Args:
observations (list[str]): Previous moves from the opponent, list
of START, ROCK, PAPER, SCISSORS.
reward (str): Previous reward from the last turn, one of LOSS, TIE,
WIN.
step (int): The step number.
game (int): The game number.
move (str): The move to make, one of ROCK, PAPER, SCISSORS.
rationale (str): Why we're making this move.
Returns:
Move made with rationale."""
nonlocal last_move
last_move = move
return f"Played {move} because {rationale}"
return play, lambda: last_move