How vytrg/quancapturegame works
Project Type and Purpose
• This is a monolithic, Python-based board game application (“Quan Capture Game”) that includes both the game engine and an AI opponent.
• The user interface is console/keyboard driven; core modules handle game rules, board representation, and AI move generation.
High-Level Components
a. Entry Point (UI Controller)
• app/main.py (and optionally root/main.py) – reads user input, renders the board, and invokes game logic.
b. Game Engine (Model + Controller)
• app/board.py & board.py – represents the game state, enforces rules, applies moves.
• square.py – cell/square abstraction on the board.
c. AI Engine
• minimax.py – search algorithm driver.
• heuristic.py – evaluation functions for board states.
• treenode.py – internal tree node structure for search.
d. Scoreboard Module
• app/scoreBoard.py – tracks, updates, and displays player scores.
e. Data & Assets
• data.py – configuration, constants (e.g., initial piece layout).
• image/ – any graphical assets (if used).
• requirements.txt – Python dependencies.
Relationships & Data Flow
• For human vs. AI modes, after a human move, UI Controller calls the AI Engine.
• AI Engine: minimax.py orchestrates search, uses treenode.py to construct the search tree and heuristic.py to evaluate leaves → returns best move.
• Game Engine updates its internal Board state → updates Scoreboard if captures occur.
• UI Controller re-renders the updated board and scores.
Architectural Patterns & Principles
• MVC-style separation:
• Model: Board, Square, Data
• View/Controller combined in app/main.py (input handling + rendering)
• Strategy pattern for AI: interchangeable heuristic functions plugged into the minimax driver.
• Single-process, synchronous flow (no microservices or external APIs).