File size: 788 Bytes
b463791 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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, {} |