How royzilber123/konanerep works
1. This repository is a Python project for the board game Konane, with an AI agent built around neural-network models. The codebase is split between game logic, an application/controller layer, a view layer, and separate training/analysis assets.
2. The core domain is centered on KonaneGame.py. This is the rules engine boundary: it is where board state, legal moves, turn progression, and win/loss logic would live. All other subsystems depend on this module as the source of truth for game state.
3. KonaneController.py appears to be the orchestration layer. It likely mediates between the game engine, the AI/network layer, and the view, deciding when moves are taken by a human or by the agent and advancing the match accordingly.
4. KonaneView.py is the presentation boundary. Its role is to render the board and user-facing state, keeping display concerns separate from the game rules and the AI logic. main.py is the application entry point that likely wires these parts together.
5. KonaneNetwork.py is the AI/model boundary. Given the saved .keras files in the repo, this module likely loads trained Keras models, transforms board state into model inputs, and produces move/value predictions used by the controller during play.
6. The repository contains two model families: ANN_MODELS_MULTI and CNN_MODELS. This shows the project compares multiple neural architectures for the same game-playing task. The ANN directory includes variants named by activation function (relu, gelu, elu, leaky_relu, mish) and each has best, final, and history artifacts, which suggests an experiment pipeline with training checkpoints and recorded metrics.
7. CNN_MODELS contains at least one convolutional model checkpoint and a summary file. This implies a second model track for board-position learning, likely using the spatial structure of the Konane board more directly than the dense ANN variants.
8. train_konane_ann.py is the training subsystem for the ANN side. It is separated from runtime play, so training is an offline process that produces model artifacts consumed later by KonaneNetwork.py or the controller. The existence of history JSON files indicates training metrics are preserved for later comparison or plotting.
9. KonanePlots.py is the analysis/reporting layer. It likely reads the saved history and summary artifacts to generate training curves or comparisons across model variants. This is the main post-training inspection boundary rather than part of the gameplay loop.
10. The primary data flow is: game state is created by KonaneGame, displayed by KonaneView, and coordinated by KonaneController; for AI turns, state is passed into KonaneNetwork, which loads one of the saved Keras models from ANN_MODELS_MULTI or CNN_MODELS and returns a move decision. Training flows in the opposite direction: train_konane_ann.py produces model checkpoints and history files that are later analyzed by KonanePlots.py and reused by the runtime agent.
11. In architectural terms, the important boundaries are: rules engine vs. orchestration vs. presentation, and runtime play vs. offline model training. The saved model directories are not source code; they are deployable assets that make the agent behavior reproducible across runs.
12. The README is minimal and points to an external document, so the repository structure itself is the best source of architecture. From the file tree, this is best understood as a Konane game application with a reinforcement-learning or model-based opponent, plus an experiment pipeline for comparing neural network architectures.
Main entry points: ANN_MODELS_MULTI ANN models · KonaneController.py Controller · main.py Main · KonaneNetwork.py Network
Components 16
Runtime app
Interactive Konane gameplay stack.
- Main · Application entry point that wires the game, controller, network, and view.
main.py - Controller · Coordinates turns, player input, and AI decisions.
KonaneController.py - Konane Game · Core board-state and move-validation source of truth.
KonaneGame.py - View · Renders the board and user-facing game state.
KonaneView.py - Network · Loads trained models and produces move or value predictions.
KonaneNetwork.py
Model training
Offline ANN training and saved artifacts.
- Train ANN · Offline trainer for dense neural-network Konane agents.
train_konane_ann.py - ANN models · Dense-model checkpoints and training histories across activation variants.
ANN_MODELS_MULTI - ReLU set · ReLU model checkpoints and history artifacts.
ANN_MODELS_MULTI/ann_relu_best.keras - GELU set · GELU model checkpoints and history artifacts.
ANN_MODELS_MULTI/ann_gelu_best.keras - ELU set · ELU model checkpoints and history artifacts.
ANN_MODELS_MULTI/ann_elu_best.keras - Leaky ReLU set · Leaky-ReLU model checkpoints and history artifacts.
ANN_MODELS_MULTI/ann_leaky_relu_best.keras - Mish set · Mish model checkpoints and history artifacts.
ANN_MODELS_MULTI/ann_mish_best.keras
Analysis assets
Saved summaries and plotting inputs.
- CNN models · Convolutional model checkpoint and summary asset.
CNN_MODELS - CNN ckpt · Representative convolutional model artifact.
CNN_MODELS/model_1_k3_best.keras - Plots · Reads histories and summaries to compare training runs.
KonanePlots.py - ANN summary · Aggregate metadata for ANN experiments.
ANN_MODELS_MULTI/summary.json
Connections 17
- Main → Controller: starts · Bootstraps the application flow.
- Main → View: renders · Initializes or connects the presentation layer.
- Main → Network: loads AI · Creates the agent-facing model boundary.
- Controller → Konane Game: reads state · Uses the rules engine as the source of truth.
- Controller → View: updates UI · Pushes game progress to the presentation layer.
- Controller → Network: asks move · Requests AI decisions for computer turns.
- Network → Konane Game: encodes state · Transforms board state into model inputs and interprets outputs against legal state.
- Train ANN → ANN models: writes · Produces dense-model checkpoints and histories.
- ANN models → ReLU set: includes · Contains the ReLU experiment artifacts.
- ANN models → GELU set: includes · Contains the GELU experiment artifacts.
- ANN models → ELU set: includes · Contains the ELU experiment artifacts.
- ANN models → Leaky ReLU set: includes · Contains the Leaky-ReLU experiment artifacts.
- ANN models → Mish set: includes · Contains the Mish experiment artifacts.
- Plots → ANN models: analyzes · Consumes training histories and summaries for comparison.
- Plots → CNN models: analyzes · Reads CNN artifacts for reporting.
- CNN models → CNN ckpt: includes · Contains the representative CNN checkpoint.
- ANN models → ANN summary: summarizes · Aggregate metadata for ANN experiment family.