projects / proj-flag-012
Next task →
Projects/Reinforcement Learning/Monte Carlo tree search with a learned model for Connect Four
Level 4 · advanced · ~40 h

Monte Carlo tree search with a learned model for Connect Four

Implement a Monte Carlo tree search agent with a learned value and policy network for Connect Four, and compare search quality against a min-max solver with alpha-beta pruning under a fixed node budget.
Add to portfolio →

Problem statement

  • 01Implement a Monte Carlo tree search agent with a learned value and policy network for Connect Four, and compare search quality against a min-max solver with alpha-beta pruning under a fixed node budget.

Real-world motivation

  • 01Combining learned priors with search is the core idea behind modern game-playing agents; Connect Four is small enough to evaluate exactly.

Learning objectives

  • 01Implement UCT search with neural priors
  • 02Train a network from self-play
  • 03Compare against an exact solver

Technical architecture

  • 01bitboard game representation
  • 02PUCT selection with a learned policy prior
  • 03value-network leaf evaluation

Mathematical foundations

  • 01$a=\arg\max_a\left(Q(s,a)+c_{puct}P(s,a)\frac{\sqrt{\sum_b N(s,b)}}{1+N(s,a)}\right)$
  • 02PUCT exploration with c_puct and dirichlet root noise

Dataset and sources

  • 01self-play Connect Four games
  • 02official Connect Four position test set

Step-by-step tasks

  • 01Implement legal move generation and terminal detection
  • 02Implement a min-max alpha-beta baseline
  • 03Implement UCT/PUCT tree search with node reuse
  • 04Train a policy-value network from self-play games
  • 05Evaluate head-to-head under equal node budgets
  • 06Measure how search quality scales with simulations

Implementation requirements

  • 01Use bitboards for fast win detection
  • 02Cache the tree between moves
  • 03Use 800 simulations per move at evaluation

Testing requirements

  • 01Verify no illegal moves generated
  • 02Check alpha-beta returns the exact game value on small boards
  • 03Confirm tree statistics reset correctly

Evaluation metrics

  • 01win rate
  • 02decision accuracy versus solver
  • 03nodes per second
  • 04search time per move

Expected outputs

  • 01agent code
  • 02match results
  • 03search scaling plot
  • 04trained network

Common failure modes

  • 01policy priors can bias search away from winning moves

Stretch goals

  • 01add progressive widening
  • 02study temperature schedules for self-play

Research extensions

  • 01derive search error as a function of node budget
  • 02study the value-network bias in leaf evaluation

GitHub submission requirements

  • 01Implementation and baselines
  • 02Match results table
  • 03Scaling experiments
  • 04Report with analysis

Completion rubric

  • 01game logic correct
  • 02search correct
  • 03baseline comparison fair
  • 04node budget controlled
  • 05scaling measured

Submit when every rubric item is satisfied and your repository contains runnable code plus a reproduction command.