rui3000's picture
Upload 11 files
b463791 verified
import random
from typing import Dict, Any, Tuple, Optional
class RandomAI:
"""
AI that makes random moves. Simple version for Gradio demo.
"""
def __init__(self):
self.possible_moves = ["rock", "paper", "scissors"]
def make_move(self, model_state: Optional[Dict[str, Any]] = None) -> Tuple[str, Dict[str, Any]]:
"""
Makes a random move. Ignores model_state in this simple version.
Args:
model_state (dict, optional): Not used in this strategy.
Returns:
tuple[str, dict]: A random choice and an empty state dictionary.
"""
ai_choice = random.choice(self.possible_moves)
# Return the move and an empty dictionary as the state (since it's stateless)
return ai_choice, {}