# polanarasimharao/gaming architecture

> Architecture diagram of the GitHub repository polanarasimharao/gaming, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/polanarasimharao/gaming
- Repository: https://github.com/polanarasimharao/gaming

## Overview

##### Project type and purpose
- This is a Python-based AI experiment: using the NEAT (NeuroEvolution of Augmenting Topologies) library to train a neural network that learns to play Flappy Bird.
- There is no separate frontend/backend in the traditional sense—rather, the project combines:
- A game-simulation engine (Flappy Bird via Pygame or similar)
- A NEAT-Python evolutionary algorithm engine
- Model persistence (pickled genomes)
- The goal is to evolve bird agents (neural networks) that maximize fitness (survive as long as possible).

##### File structure
- Flappy_brd.pk1 – pickled “best” genome (persisted neural network)
- Main.py – orchestrates the training loop: loads config, spawns populations, runs simulation, computes fitness, evolves genomes, saves best model
- Test.py – loads the pickled model and runs an inference-only game demo
- config-feedforward.txt – NEAT configuration (population size, mutation rates, network structure)
- README.md – project description

##### README for additional insights
- It confirms “Gaming with Python” and NEAT model training.

## Diagram (Mermaid)

```mermaid
graph TB

    %% Subgraphs for modes
    subgraph "Training Mode"
        direction TB
        Config["config-feedforward.txt"]:::pers
        NEAT["Evolutionary Algorithm"]:::ai
        Sim["Simulation Environment"]:::sim
        Trainer["Main.py"]:::orchestrator
        ModelStore["Flappy_brd.pk1"]:::pers
    end

    subgraph "Inference Mode"
        direction TB
        Inference["Test.py"]:::inference
        ModelStore2["Flappy_brd.pk1"]:::pers
        NEAT2["Evolutionary Algorithm"]:::ai
        Sim2["Simulation Environment"]:::sim
    end

    %% Documentation
    Doc["README.md"]:::doc

    %% Connections - Training
    Config -->|"initializes"| NEAT
    Trainer -->|"drives loop"| NEAT
    NEAT -->|"neural decisions"| Sim
    Sim -->|"fitness scores"| NEAT
    Trainer -->|"saves best genome"| ModelStore

    %% Connections - Inference
    Inference -->|"loads genome"| ModelStore2
    Inference -->|"uses"| NEAT2
    NEAT2 -->|"neural decisions"| Sim2

    %% Doc link
    Doc

    %% Click Events
    click Sim "https://github.com/polanarasimharao/gaming/blob/main/Main.py"
    click NEAT "https://github.com/polanarasimharao/gaming/blob/main/Main.py"
    click Trainer "https://github.com/polanarasimharao/gaming/blob/main/Main.py"
    click Inference "https://github.com/polanarasimharao/gaming/blob/main/Test.py"
    click Config "https://github.com/polanarasimharao/gaming/blob/main/config-feedforward.txt"
    click ModelStore "https://github.com/polanarasimharao/gaming/blob/main/Flappy_brd.pk1"
    click ModelStore2 "https://github.com/polanarasimharao/gaming/blob/main/Flappy_brd.pk1"
    click Doc "https://github.com/polanarasimharao/gaming/blob/main/README.md"

    %% Styles
    classDef sim fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef ai fill:#90EE90,stroke:#000,stroke-width:1px
    classDef pers fill:#FFA500,stroke:#000,stroke-width:1px
    classDef orchestrator fill:#98FB98,stroke:#000,stroke-width:1px
    classDef inference fill:#98FB98,stroke:#000,stroke-width:1px
    classDef doc fill:#D3D3D3,stroke:#000,stroke-width:1px
```
