Code World Models for General Game Playing
On the map: World models → World models for language agents
also in 1 more
Abstract (arXiv)
Large Language Models (LLMs) reasoning abilities are increasingly being applied to classical board and card games, but the dominant approach -- involving prompting for direct move generation -- has significant drawbacks. It relies on the model's implicit fragile pattern-matching capabilities, leading to frequent illegal moves and strategically shallow play. Here we introduce an alternative approach: We use the LLM to translate natural language rules and game trajectories into a formal, executable world model represented as Python code. This generated model -- comprising functions for state transition, legal move enumeration, and termination checks -- serves as a verifiable simulation engine for high-performance planning algorithms like Monte Carlo tree search (MCTS). In addition, we prompt the LLM to generate heuristic value functions (to make MCTS more efficient), and inference functions (to estimate hidden states in imperfect information games). Our method offers three distinct advantages compared to directly using the LLM as a policy: (1) Verifiability: The generated CWM serves as a formal specification of the game's rules, allowing planners to algorithmically enumerate valid actions and avoid illegal moves, contingent on the correctness of the synthesized model; (2) Strategic Depth: We combine LLM semantic understanding with the deep search power of classical planners; and (3) Generalization: We direct the LLM to focus on the meta-task of data-to-code translation, enabling it to adapt to new games more easily. We evaluate our agent on 10 different games, of which 4 are novel and created for this paper. 5 of the games are fully observed (perfect information), and 5 are partially observed (imperfect information). We find that our method outperforms or matches Gemini 2.5 Pro in 9 out of the 10 considered games.
Key facts. Cited by 25 papers in the map (data through 7 Oct 2026). Placed in World models for language agents, one of 11 directions in World models. Builds on 20 of its 37 references that are in the map. First posted on arXiv 6 Oct 2025.
Builds on
20 of 37 references.
Closest ancestors · 2
Same direction, newest first
- 2025Assessing Adaptive World Models in Machines with Novel Games17 Jul
- 2024WorldCoder, a Model-Based LLM Agent: Building World Models by Writing Code and Interacting with the Environment19 Feb
Other references · 18
- 2014Adam: A Method for Stochastic Optimizationcited by 36,960
- 2017Proximal Policy Optimization Algorithmscited by 14,441
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
- 2019OpenSpiel: A Framework for Reinforcement Learning in Gamescited by 180
- 2024A Survey on Large Language Model-Based Game Agentscited by 106
- 2024GameBench: Evaluating Strategic Reasoning Abilities of LLM Agentscited by 89
- 2025lmgame-Bench: How Good are LLMs at Playing Games?cited by 54
- 2024Mastering Board Games by External and Internal Planning with Language Modelscited by 27
- 2025TextArenacited by 24
- 2025Measuring General Intelligence with Generated Gamescited by 21
- 2025Game Theory Meets Large Language Models: A Systematic Survey with Taxonomy and New Frontierscited by 14
- 2025Are Large Language Models Reliable AI Scientists? Assessing Reverse-Engineering of Black-Box Systemscited by 13
6 more
- 2025LLM-Guided Probabilistic Program Induction for POMDP Model Estimationcited by 11
- 2025Game Reasoning Arena: A Framework and Benchmark for Assessing Reasoning Capabilities of Large Language Models via Game Playcited by 10
- 2025Think in Games: Learning to Reason in Games via Reinforcement Learning with Large Language Modelscited by 7
- 2024Reinforcement Learning: An Overviewcited by 6
- 2024Autoformalization of Game Descriptions using Large Language Modelscited by 5
- 2024Generative Agents for Multi-Agent Autoformalization of Interaction Scenarioscited by 5
Built on by
Citing papers per year: 2026: 25.
25 papers.
Sort:
By area:
- 2026AutoHarness: improving LLM agents by automatically synthesizing a code harnesscited by 63
- 2026Qwen-AgentWorld: Language World Models for General Agentscited by 22
- 2026Generative Visual Code Mobile World Modelscited by 13
- 2026AI Gamestore: Scalable, Open-Ended Evaluation of Machine General Intelligence with Human Gamescited by 10
- 2026Agentic World Modeling: Foundations, Capabilities, Laws, and Beyondcited by 10
- 2026Code World Model: Coding Agent as World Braincited by 9
- 2026Code as Worlds: Agentic Discovery of Executable World Representations for Physical Reasoningcited by 6
- 2026Self-Improving World Modelling with Latent Actionscited by 5
- 2026PatchWorld: Gradient-Free Optimization of Executable World Models for Agent Environmentscited by 5
- 2026Debugging code world modelscited by 4
- 2026Distilling Game Code World Model Generation into Lightweight Large Language Modelscited by 4
- 2026Towards Generalist Game Players: An Investigation of Foundation Models in the Game Multiversecited by 2
13 more
- 2026AI for Games in the Foundation Model Eracited by 2
- 2026Joint Learning of Hierarchical Neural Options and Abstract World Modelcited by 1
- 2026Baba in Wonderland: Online Self-Supervised Dynamics Discovery for Executable World Modelscited by 1
- 2026VisualPatchWorld: Code World Models as Latent Structured Representations for Planningcited by 1
- 2026Abstraction Agentcited by 1
- 2026Towards Improving Sequential Decision-Making in LLM Agents via Experience Memorycited by 0
- 2026Position: Profiling Game Worlds by Transition Complexitycited by 0
- 2026WMLLM: Self-Evolving Optimization Agents via Predict-Then-Act World Modelingcited by 0
- 2026World-Time Compute with Verified Code World Modelscited by 0
- 2026COUNTERMEM: World-Model Verified Counter-Factual Memory for Language Agentscited by 0
- 2026EMPIRIC: Experiment-Driven Learning of Residual World Models for Robot Planningcited by 0
- 2026Memento 3: Model-Based Recursive Self-Improvement through Reflective Rulebookscited by 0
- 2026AgentGarten: Code Worlds for Evolving Agentscited by 0
- 2026AgentGarten: Code Worlds for Evolving Agents8 Oct 2026
- 2026Memento 3: Model-Based Recursive Self-Improvement through Reflective Rulebooks8 Oct 2026
- 2026EMPIRIC: Experiment-Driven Learning of Residual World Models for Robot Planning28 Sep 2026
- 2026COUNTERMEM: World-Model Verified Counter-Factual Memory for Language Agents25 Sep 2026
- 2026AI for Games in the Foundation Model Era15 Sep 2026
- 2026Abstraction Agent3 Sep 2026
- 2026Code as Worlds: Agentic Discovery of Executable World Representations for Physical Reasoning27 Aug 2026
- 2026Code World Model: Coding Agent as World Brain26 Aug 2026
- 2026Towards Improving Sequential Decision-Making in LLM Agents via Experience Memory4 Aug 2026
- 2026VisualPatchWorld: Code World Models as Latent Structured Representations for Planning28 Jul 2026
- 2026World-Time Compute with Verified Code World Models7 Jul 2026
- 2026Qwen-AgentWorld: Language World Models for General Agents23 Jun 2026
13 more
- 2026WMLLM: Self-Evolving Optimization Agents via Predict-Then-Act World Modeling2 Jun 2026
- 2026Position: Profiling Game Worlds by Transition Complexity29 May 2026
- 2026PatchWorld: Gradient-Free Optimization of Executable World Models for Agent Environments29 May 2026
- 2026Distilling Game Code World Model Generation into Lightweight Large Language Models23 May 2026
- 2026Baba in Wonderland: Online Self-Supervised Dynamics Discovery for Executable World Models16 May 2026
- 2026Towards Generalist Game Players: An Investigation of Foundation Models in the Game Multiverse11 May 2026
- 2026Agentic World Modeling: Foundations, Capabilities, Laws, and Beyond24 Apr 2026
- 2026AI Gamestore: Scalable, Open-Ended Evaluation of Machine General Intelligence with Human Games19 Feb 2026
- 2026AutoHarness: improving LLM agents by automatically synthesizing a code harness10 Feb 2026
- 2026Debugging code world models7 Feb 2026
- 2026Self-Improving World Modelling with Latent Actions5 Feb 2026
- 2026Joint Learning of Hierarchical Neural Options and Abstract World Model2 Feb 2026
- 2026Generative Visual Code Mobile World Models2 Feb 2026
- 2026Qwen-AgentWorld: Language World Models for General Agentscited by 22
- 2026Generative Visual Code Mobile World Modelscited by 13
- 2026Agentic World Modeling: Foundations, Capabilities, Laws, and Beyondcited by 10
- 2026Code World Model: Coding Agent as World Braincited by 9
- 2026Self-Improving World Modelling with Latent Actionscited by 5
- 2026PatchWorld: Gradient-Free Optimization of Executable World Models for Agent Environmentscited by 5
- 2026Debugging code world modelscited by 4
- 2026Distilling Game Code World Model Generation into Lightweight Large Language Modelscited by 4
- 2026AI for Games in the Foundation Model Eracited by 2
- 2026Joint Learning of Hierarchical Neural Options and Abstract World Modelcited by 1
- 2026Baba in Wonderland: Online Self-Supervised Dynamics Discovery for Executable World Modelscited by 1
- 2026VisualPatchWorld: Code World Models as Latent Structured Representations for Planningcited by 1
12 most cited of 17 All 17 (JSON)
- 2026EMPIRIC: Experiment-Driven Learning of Residual World Models for Robot Planning28 Sep 2026
- 2026COUNTERMEM: World-Model Verified Counter-Factual Memory for Language Agents25 Sep 2026
- 2026AI for Games in the Foundation Model Era15 Sep 2026
- 2026Code World Model: Coding Agent as World Brain26 Aug 2026
- 2026VisualPatchWorld: Code World Models as Latent Structured Representations for Planning28 Jul 2026
- 2026World-Time Compute with Verified Code World Models7 Jul 2026
- 2026Qwen-AgentWorld: Language World Models for General Agents23 Jun 2026
- 2026WMLLM: Self-Evolving Optimization Agents via Predict-Then-Act World Modeling2 Jun 2026
- 2026Position: Profiling Game Worlds by Transition Complexity29 May 2026
- 2026PatchWorld: Gradient-Free Optimization of Executable World Models for Agent Environments29 May 2026
- 2026Distilling Game Code World Model Generation into Lightweight Large Language Models23 May 2026
- 2026Baba in Wonderland: Online Self-Supervised Dynamics Discovery for Executable World Models16 May 2026
12 newest of 17 All 17 (JSON)
- 2026AI Gamestore: Scalable, Open-Ended Evaluation of Machine General Intelligence with Human Gamescited by 10
- 2026Towards Generalist Game Players: An Investigation of Foundation Models in the Game Multiversecited by 2
- 2026Memento 3: Model-Based Recursive Self-Improvement through Reflective Rulebookscited by 0
- 2026AgentGarten: Code Worlds for Evolving Agentscited by 0
- 2026AgentGarten: Code Worlds for Evolving Agents8 Oct 2026
- 2026Memento 3: Model-Based Recursive Self-Improvement through Reflective Rulebooks8 Oct 2026
- 2026Towards Generalist Game Players: An Investigation of Foundation Models in the Game Multiverse11 May 2026
- 2026AI Gamestore: Scalable, Open-Ended Evaluation of Machine General Intelligence with Human Games19 Feb 2026
Similar, not cited
Close in wording, no citation either way
- 2026Reasoning Capabilities of Large Language Models. Lessons Learned from General Game Playing
- 2024GTBench: Uncovering the Strategic Reasoning Limitations of LLMs via Game-Theoretic Evaluations
- 2024GAMEBoT: Transparent Assessment of LLM Reasoning in Games
- 2024LogicGame: Benchmarking Rule-Based Reasoning Abilities of Large Language Models
- 2026When a Verified World Model Still Loses: Play-Adequacy vs Prediction-Accuracy in LLM-Synthesized Code World Models
- 2024Can Large Language Models Play Games? A Case Study of A Self-Play Approach
- 2026How Far Are LLMs from Professional Poker Players? Revisiting Game-Theoretic Reasoning with Agentic Tool Use
- 2025Tracking World States with Language Models: State-Based Evaluation Using Chess