"""Example usage of the Monopoly agent.This example demonstrates how to run a Monopoly game with AI agents.The game will use the Rich UI to display the game state.Usage: python example.py"""importloggingfromhaive.games.monopoly.configimportMonopolyGameAgentConfigfromhaive.games.monopoly.main_agentimportMonopolyAgentfromhaive.games.monopoly.ui_fixedimportMonopolyRichUI# Configure logginglogging.basicConfig(level=logging.INFO)logger=logging.getLogger(__name__)
[docs]defmain():"""Run the example Monopoly game with AI agents."""logger.info("Starting Monopoly game with AI agents")# Create configuration with AI agentsconfig=MonopolyGameAgentConfig(name="monopoly_example",player_names=["Alice","Bob","Charlie","Diana"],max_turns=50,# Limit turns for demoenable_trading=True,enable_building=True,enable_auctions=True,# Set higher recursion limit to avoid errorsrunnable_config={"configurable":{"recursion_limit":500,"thread_id":"monopoly_example"}},)# Create the agentagent=MonopolyAgent(config)# Create the UI and run the gameui=MonopolyRichUI()logger.info("Starting Monopoly game with Rich UI...")ui.run(agent,delay=1.0)