Introduction
Impartial Combinatorial Games (ICGs), such as Nim and Chomp, are characterized by two players having identical move options from any given state. While solving specific instances of these games is a well-understood search problem, deriving a generalized winning strategy—a mathematical rule applicable to any board size or configuration—remains a significant challenge. Historically, such rules were discovered by human mathematicians (e.g., the XOR-sum rule for Nim). This paper introduces a fully automated framework to synthesize these general arithmetic rules from scratch using SMT solvers.
Methodology
The proposed framework utilizes a three-stage pipeline to move from game rules to a generalized strategy:
- Formalization: Games are described using a fragment of the Planning Domain Definition Language (PDDL) restricted to Linear Integer Arithmetic (LIA). This allows game states and transitions to be expressed as mathematical formulas.
- Winning Formula Synthesis: The system employs an enumerative synthesis approach to find a winning formula ($\phi$) that identifies states from which a player can force a victory. The algorithm iteratively generates candidate formulas of increasing complexity, verifying them against logical constraints using the Z3 SMT solver.
- Strategy Synthesis: Once $\phi$ is identified, it is refined into "meticulous" sub-formulas. For each, the system synthesizes a specific action (a "semi-ground action") guaranteed to transition the game into a losing state for the opponent ($\neg \phi$).
The use of SMT solvers enables a Counter-Example Guided Synthesis loop. If a candidate formula fails, the solver provides a specific game state (counter-example) to prune the search space effectively.
Results and Evaluation
The framework was evaluated on a benchmark suite including variants of Chomp, Nim, Empty-and-Divide, and numerous Take-away and Subtraction games.
Key performance highlights include:
- Efficiency: Most games were solved in seconds. For instance, the 2-piled Nim strategy was synthesized in 3.91 seconds, significantly outperforming previous state-of-the-art tools like SimSynth, which failed to solve it within 10 minutes.
- Scalability: The system demonstrated robust scaling, handling Take-away games with parameters up to $n=30$ in approximately 238 seconds.
- Full Automation: Unlike previous methods, this approach requires no human-provided templates or hints, synthesizing strategies purely from the game's formal definition.
Discussion and Limitations
The core insight of this work is that a winning strategy is intrinsically tied to the mathematical definition of the "winning zone." By restricting the logic to LIA, the authors ensure that the verification step is decidable, making automated search feasible for a broad class of games.
However, the reliance on LIA imposes constraints on expressivity. Games requiring non-linear mathematics, such as the Wythoff game (which involves the Golden Ratio), cannot currently be solved. Additionally, while the "refining" step for strategy synthesis did not cause issues in benchmarks, it could theoretically lead to an exponential blowup in the number of sub-formulas for more complex games.
Future research aims to extend this framework to "misere play" (where the last player to move loses) and partizan games (where players have different move sets, such as Chess or Go).
Summary updated