Playable Reinforcement Learning Agent

Connect 4 vs. Deep Q-Network (DQN)

Challenge a neural network trained with Deep Q-Learning. Observe live Q-value score estimates across all 7 columns as the agent decides its next move.

You (Red)vs DQN Agent (Yellow)
Status: Your Turn (Red)Agent Confidence: High (Q = +0.84)
Real-Time Column Q-Values

Estimated win expected value ($Q(s, a)$) evaluated for each move column:

Col 1 +0.12
Col 2 +0.35
Col 3 (Optimal)+0.78
Col 4 +0.62
Col 5 +0.22
Col 6 +0.05
Col 7 -0.15

How the Deep Q-Network (DQN) Agent Works

This interactive demo runs a PyTorch-trained Deep Q-Network (DQN) model for Connect 4. Given a $6 \times 7$ board state tensor, the neural network evaluates action-value pairs $Q(s, a)$ for all 7 columns simultaneously.

Rainbow DQN Architecture

Integrates Dueling Networks (separating state value $V(s)$ and advantage $A(s, a)$), Double Q-learning (mitigating overestimation bias), and Prioritized Experience Replay (PER).

Self-Play Reinforcement Learning

Trained through millions of self-play episodes in PettingZoo multi-agent environments, progressively discovering tactical tactics (forking, double traps, and defensive block prioritization).

Explore the complete PyTorch training scripts, PettingZoo environments, and neural network weights on GitHub:View Repository