AI-PONG
An evolutionary Pong experiment

Teach a network to play.

AI-Pong uses a genetic algorithm to evolve neural networks that learn to rally against a CPU opponent. Watch the population play, inspect the network, and explore the training process.

AI-Pong / game view Saved model
CPU 0 AI 0
Saved model vs CPU. Inference only.
Inside the project

A playable window into evolution.

A Python project that brings together neural networks, a genetic algorithm, and a rendered Pong simulation.

Neural network decisions

Seven normalized game observations flow through a fully connected 7 → 8 → 6 → 2 network to select paddle movement.

Population-based learning

Players are evaluated, selected, crossed, and mutated to make each new generation. Batched PyTorch inference helps evaluate the population in parallel.

Rendered and headless runs

Arcade renders a representative game and network view; the same simulation can also train headlessly and save run metrics and model checkpoints.

The training loop

Play. Select. Evolve.

Each generation turns game performance into the next population of candidate players.

01 / PLAY

Evaluate the population

Candidate networks observe the game and choose paddle actions while their fitness is measured.

02 / SELECT

Keep and combine survivors

The genetic algorithm ranks players, retains survivors, and probabilistically selects parents for crossover.

03 / EVOLVE

Mutate the next generation

Offspring inherit network parameters, receive mutations, and form the population for another round.

Current fully connected network 7 observations 8 6 2 actions
AI-Pong gameplay with the Pong court and neural-network visualization

Project demo · rendered gameplay and network view

See it in action

Follow the game and the decisions.

The rendered runner displays a population representative alongside a live network visualization. The GIF is a project demo; it is not evidence that a particular model is a trained elite.

Explore the architecture
Python 3.10+

Run your first generation.

Set up the project, install its dependencies, then start the rendered genetic algorithm.

# Install dependencies
python -m pip install -r requirements.txt

# Start rendered training
python -m src.main

Training continues until interrupted unless a generation limit is set. Validation is an informational signal, not a guarantee of general reliability or a condition that stops training. See the training guide for options and validation guidance.