Tron Reinforcement Learning AI

A Deep Q-Network AI to play the game Tron

Overview

This project was an interactive program to show how machine learning applies to the Light Cycle game from Tron. In it, two AIs move around the board to try to survive long enough to cut off the other player's space. It was created as part of the Michigan State University (MSU) AI Club, and it was later modified for a more interactive display for the 2025 MSU Science Festival on behalf of the MSU Institute for Cyber-Enabled Research (ICER).

The project was created in Python with the AI developed using PyTorch to set up a Q-learning architecture in order to process information from the game board. Each possible move gets a calculated probability of being a good move, and during training, a random move is chosen according to their probability. As the AI moves, the previous state of the board gets added to a queue along with the score for the action it took, and this queue is later used to modify the model and incentivise moves with a higher score. Over time, the scores for moves get propagated back further, effectively giving which moves lead to better board states, even in neutral situations.

The original version of the project, showcased at the MSU AI Club Fall 2024 End of Semester Showcase, showed a trained version of the AI competing with itself, often surviving for long periods of time. It also allowed for a person to play directly against the AI, as well as for different rates of game speed. However, due to the way that actions were prioritized and the length of time trained, the AI learned to prioritize survival over trapping the other player, leading to prolonged games with the AI eventually filling the entire board.

ICER approached some projects for an interactive demonstration at the two-day 2025 MSU Science Festival, where they intended to show the uses and benefits of the High-Performance Computing Center through demonstrations of AI. The project was modified to learn in real-time to demonstrate how AIs learn and make decisions. The project runs many iterations in the background and displays the most recent state, along with showing the current probabilities for each AI to move in each direction. It also retained the capability for a human to play against the current AI, as well as the ability to showcase a few pre-trained models.

Images