← All builds

ai/ml coursework · 2026

Teaching an agent to play Ms. Pac-Man by trial and error.

An agent that sees only pixels and points learned Ms. Pac-Man over 100 games. Its mean score across five fixed test games rose from 492 to 680. I chose three settings, ran it once end to end, and reported what happened, including where it got worse.

Role Builder · Team Solo · Timeline September 2026

The trained agent playing Ms. Pac-Man

The problem

Reinforcement learning is easy to describe and hard to trust. The question wasn't only whether the score goes up, but whether the gain is real or noise.

What I did

  • Chose three settings and justified each: 100 episodes, exploration held at 0.20 as a control, and a learning rate 2.5x the reference so change would show up in a short run.
  • Wrote down my expectation before running: a modest gain of about 100 to 200 points.
  • Trained on a laptop GPU: 57,801 decisions and 14,201 updates in about 3.3 minutes.
  • Evaluated before and after on the same five seeds, and kept every GIF, plot, and checkpoint.
  • Explained the surprise. Loss went up while scores improved, which is expected in DQN as the value targets grow.

Results

492 → 680mean evaluation score
+188inside my predicted range
4 of 5test games improved
3.3 minto train

What I'd do differently

Five test games is too few to trust the mean. One game fell from 800 to 300, and the curve was flat for 80 episodes before a late jump. Next experiment: change only the episodes, from 100 to 500, to see whether the gain holds or was a lucky streak.

Artifacts

Notebook and evidence on GitHub ↗

Before training: the agent mostly circles one corner of the maze.
Before training: the agent mostly circles one corner of the maze.
After training: the best game from the final evaluation.
After training: the best game from the final evaluation.
The training dashboard: scores, update loss, and exploration per episode.
The training dashboard: scores, update loss, and exploration per episode.