UMass Amherst · 2026
Misere Nim Game Agent
A game-playing agent for misere Nim, where whoever takes the last stick loses. It searches ahead with minimax and alpha-beta pruning and always answers within the one-second move limit.
- 0.82ssearch time per move
In misere Nim you can take any number of sticks from one pile, and whoever takes the last stick loses. That flips the standard strategy near the end of the game, which is why a proper search is worth writing.
The agent uses iterative-deepening minimax with alpha-beta pruning and a transposition table keyed on the sorted pile sizes. Move ordering comes from an evaluation function I wrote for misere play, and it does most of the pruning, since alpha-beta without good ordering is close to plain minimax.
The server allows one second per move, so the agent stops searching at 0.82 seconds and checks the clock as it goes. Before searching, it works out a safe fallback move, so if time runs out it still returns a legal move instead of timing out.
Tools & methods
- Python
- Minimax
- Alpha-beta pruning
- Memoization