Comparative analysis of player ability, game size, and ideal starting positions in Nim games

(1) Richard Montgomery High School, (2) Montgomery Blair High School, (3) Department of Computer Science, University of Maryland

https://doi.org/10.59720/25-114
Cover photo for Comparative analysis of player ability, game size, and ideal starting positions in Nim games
Image credit: Immo Wegmann

Nim is an impartial subtraction game consisting of a pile or piles of sticks, where two players alternate taking turns to remove sticks, and the player to remove the last stick wins. Nim has a mathematically proven solution, but the outcomes of games with imperfect, flawed play still remain unclear. We analyzed imperfect play in the game of Nim. More specifically, we questioned whether player ability or the starting positions are more important in influencing winning game outcomes. We also researched the required ability differential needed for a player to win from a losing position. We hypothesized that when the pile size is large, the initial position has minimal impact on win probability and player ability becomes the primary determinant under imperfect play. We tested several computational game simulations and derived a mathematical model for win percentages, both of which support our hypothesis. Our results showed that a favorable starting position only benefits a player until a certain point during imperfect play, then has negligible effect. This research holds significance because, according to the Sprague-Grundy Theorem, any impartial game is equivalent to a single-pile game of Nim. Additionally, artificial intelligence reinforcement learning algorithms, which learn through trial and feedback, face significant challenges with impartial games like Nim due to their highly abstract mathematical nature. Considering these limitations, our research provides insights on impartial game outcomes under imperfect play, which is essential to train robust decision-making agents that are capable of accurately making moves in uncertain, complex game or game-like environments.

Download Full Article as PDF