How rylinnm/mcts-in-pacman-capture-the-flag-environment works
Main Components
• Game Engine/Controller: This includes files like capture.py (which launches the game), game.py, and perhaps baselineTeam.py. These files control game flow, scoring, and team management.
• /Interface Modules: Files like captureGraphicsDisplay.py, graphicsDisplay.py, textDisplay.py, and keyboardAgents.py serve for rendering the game state, receiving user input, and providing visual feedback. A “Display/Interface Layer” should be a distinct component.
• Utility Modules: Several files (distanceCalculator.py, mazeGenerator.py, layout.py, graphicsUtils.py, util.py) provide supporting functions (e.g., calculating distances, generating maps and layouts). Represent these as auxiliary modules connected to both the game engine and agents.
Relationships and Interactions
• The Game Engine acts as the central controller. It initiates a match, sets up the environment, and communicates with the agents.
• The MCTS Agent, implemented in pathfinder.py, interacts with the game engine by receiving game state information and returning moves based on the MCTS algorithm.
• /Interface modules subscribe to game state updates and render the visuals or text based on updates from the game engine.
• Utility functions are used by both the game engine and agents (e.g., using distance calculations for pathfinding or maze generation for layouts).
Architectural Patterns and Design Principles
• Separation of Concerns: The design clearly separates game logic from display logic and agent decision-making.
• Modular Design: Each file or module has a specific responsibility (e.g., one file for agent logic, one for graphics, one for utility functions), suggesting a layered architecture.
• Branch out to show the MCTS Agent (pathfinder.py) along with a note on the algorithm it implements (MCTS via UCT variant).
• Separate branches for the visual elements, connecting relevant display files.
• Optionally, include an “Extended Agents” block for additional agent implementations like keyboardAgents.py or baselineTeam.py.
• Annotations where helpful, such as command-line parameters influencing game behavior or simulation parameters for MCTS iterations.