Learning to Play Like Humans: A Framework for LLM Adaptation in Interactive Fiction Games (2025)

Abstract: Interactive Fiction games (IF games) are where players interact through natural language commands. While recent advances in Artificial Intelligence agents have reignited interest in IF games as a domain for studying decision-making, existing approaches prioritize task-specific performance metrics over human-like comprehension of narrative context and gameplay logic. This work presents a cognitively inspired framework that guides Large Language Models (LLMs) to learn and play IF games systematically. Our proposed **L**earning to **P**lay **L**ike **H**umans (LPLH) framework integrates three key components: (1) structured map building to capture spatial and narrative relationships, (2) action learning to identify context-appropriate commands, and (3) feedback-driven experience analysis to refine decision-making over time. By aligning LLMs-based agents’ behavior with narrative intent and commonsense constraints, LPLH moves beyond purely exploratory strategies to deliver more interpretable, human-like performance. Crucially, this approach draws on cognitive science principles to more closely simulate how human players read, interpret, and respond within narrative worlds. As a result, LPLH reframes the IF games challenge as a learning problem for LLMs-based agents, offering a new path toward robust, context-aware gameplay in complex text-based environments.

## introduction interactive fiction games (if games), originating in the 1970s @xcite , demanded abstract reasoning, implicit world inference, and narrative reconstruction from textual cues alone. unlike visual or auditory games, if games rely solely on language and imagination. successful play involves iterative exploration, learning, and adaptation, guided by intuition, pattern recognition, and experience-driven generalization @xcite . consequently, if games offer a rich testbed for agent problem-solving, shedding light on core mechanisms of exploration and learning. deep recurrent neural network (drnn) @xcite sparked a growing interest in reinforcement learning (rl) settings where states and actions are expressed in natural language. consequently, if games have become a core testbed for integrating rl and natural language understanding @xcite . early rl agents rely heavily on action filters and simplistic policies @xcite @xcite . although subsequent rl approaches include more sophisticated techniques @xcite @xcite , their score-centric objectives still constrain nuanced narrative reasoning. recent works have begun leveraging large language mod-els (llms) @xcite , but no system llms work on playing if games yet. human intuition is central in how players navigate if games, enabling adaptive engagement with complex, text-based environments. @xcite characterizes diverse player motivations that shape exploratory and strategic behavior, while @xcite frames "fun" as the pleasure of pattern recognition-a fundamentally intuitive process of mapping novel challenges to learned solutions. similarly, @xcite emphasize how well-structured rules and freedom of interaction support creative problem-solving, highlighting the importance of intuitive, context-sensitive reasoning in game design and analysis. while prior work has often used if games to benchmark rl capabilities, we instead focus on leveraging llms' capacity for human-like, context-aware reasoning to actively play these games. llms have shown promise in multi-step inference, narrative comprehension, and decisionmaking across text-based domains @xcite @xcite @xcite . if games, with their rich narratives and open-ended interactions, demand precisely the kinds of situational reasoning and adaptivity that human players naturally exhibit-traits often underemphasized in score-centric rl approaches @xcite . to bridge this gap, we introduce the learning to play like humans (lplh) framework: a novel, training-free llms-based system designed to mirror human gameplay strategies in if environments. rather than treating human-like as a vague aspiration, lplh operationalizes it through three targeted modules inspired by common human behaviors during gameplay. dynamic map-building module incrementally constructs an internal spatial model of the game world, akin to how human players sketch or internalize maps to avoid disorientation. action-space learning captures and remembers verified verbs and manipulable objects, paralleling how humans accumulate an evolving vocabulary of game-relevant actions. experience reflection module synthesizes prior successes and failures into reusable summaries, enabling experiencedriven decision-making. through this modular design, lplh uses contextual game information and reflective memory to make informed decisions, tightly coupling human-inspired reasoning with interpretable, functional components. by integrating these key modules, the lplh framework entirely forgoes reliance on external knowledge to pre-train agents. instead, it fosters a self-innovative learning process that closely mirrors how human players approach new games: constructing detailed maps, incrementally exploring valid actions, and reflecting on experience to inform future decisions. we apply this approach to various if games from jercho dataset @xcite . the main contributions are as follows: 1) we propose the lplh framework, designed to simulate human players' behaviors, which, to our knowledge, is the first system to work to leverage llms for playing if games. 2) we demonstrate the robustness and efficiency of lplh framework by playing games on different baselines. 3) empirical results confirm that modeling human-like decisionmaking processes enhances llm performance on if game tasks, indicating the effectiveness of our human-player simulation strategy. 2 related work if games provide a structured environment that drives research on language-based agents. these text-based simulations (hausknecht et al., 2020) integrate challenges. many studies adapt rl methods to handle their vast, partially observable state-action spaces. kg-a2c (ammanabrolu and hausknecht, 2020) builds a knowledge graph (kg) to represent game states and constrain action spaces, addressing the complexity of natural language actions. guo et al., 2020 reformulates gameplay as a multi-passage reading comprehension task, using context-query attention and structured prediction to enhance action generation and mitigate partial observability. another strand of research targets the exploration challenges unique to if games. q*bert and mc!q*bert (ammanabrolu et al., 2020) employ knowledge-graph-based intrinsic motivation and strategic exploration to overcome bottlenecks in sparse-reward environments. complementing these efforts, tuyls et al., 2022 dissects the explorevs.-exploit dilemma by decomposing each episode into distinct exploitation and exploration phases, achieving notable improvements in normalized game scores across multiple environments. in parallel to the rl-centric approaches, recent works have explored integrating pre-trained language models to enhance agents' semantic understanding and action generation capabilities. the calm @xcite ) is trained on human gameplay data to produce a compact set of action candidates. calm significantly improves in-game scores, even on unseen games, when combined with an rl agent for action re-ranking. similarly, singh et al., 2022 leverages transformer-based models to inject rich semantic priors. ## lplh framework our framework draws direct inspiration from core principles in cognitive science, the interdisciplinary study of how humans perceive, remember, reason, and act @xcite . these principles are particularly relevant in if games, which demand narrative comprehension, exploration under uncertainty, and intuitive decision-making @xcite . rather than treating human-like behavior as a superficial output pattern, lplh operationalizes it through design choices grounded in cognitive theory. specifically, the lplh architecture simulates spatial reasoning and memory formation via a dynamic knowledge graph that evolves with the agent's exploration-analogous to how human players construct internal or external maps. it mirrors incremental learning and intuitive action formation by continually expanding a repository of validated commands, reflecting how players retain and recombine useful verbs and objects. lplh also encodes reflective learning through its experience module, enabling the agent to summarize lessons from both success and failure, in line with experiential learning models. finally, its decision-making process integrates current context, structured memory, and retrieved past experiences-closely paralleling dual-process theories of human reasoning, where both working memory and episodic recall inform adaptive behavior. in this section, we describe the overall lplh framework and its core modules in detail. figure 2 illustrates the system architecture. ## experiment this section will briefly introduce our chosen dataset, baselines, and experiment setup. ## result and analyzes this section assesses how the lplh framework advances performance in if games. first, we illustrate learning behaviors through the learning curves (section 5.1), compare game scores across various baselines (section 5.2), and conduct an ablation study (section 5.3). these analyses highlight lplh's adaptive, human-like language acquisition capacity and robust performance. for the scores '-/-,' the first represents a raw score of the end, and the second represents the max score. in llms-based agents, the raw on base computes the average score in all runs, while the raw on lplh computes the last three runs as "learning outcomes." scores with blue mean the highest score in raw, and scores with underline are the highest score in max. the max is the game's maximum score. ## discussion experiences' significance in lplh framework this section discusses two examples in zork1 to show how experiences are essential for the lplh framework to simulate humans. both are how lplh framework plays like humans with experience reflection to achieve higher scores and avoid failure, where we will use 'player' to represent the game character and 'agent' for lplh framework. ## error analysis: known puzzle bottlenecks despite lplh's improvements over baseline methods, rl-and llms-based approaches struggle with specific puzzle bottlenecks. this limitation stems mainly from the difficulty of discovering domain-specific or unconventional commands rarely seen in training data or standard exploration trajectories, which also has been pointed out in @xcite ; @xcite . in if games, key progress often hinges on executing highly specific actions that are not inferable from the immediate context. for instance, in zork1, players must type echo in the "loud room" to earn five points-a solution that eludes most automated agents, whether they sample from a predefined action space (e.g., jericho-based rl systems) or generate free-form text via llms. these methods typically lack the inductive bias or experiential grounding to propose such obscure commands. even with structural guidance from a dynamic knowledge graph, the agent may overlook necessary commands. in one representative case from the "living room," progress depends on typing move rug to reveal a hidden passage. the agent frequently fails here-substituting implausible variants like hit rug or ignoring the rug altogether-though it occasionally succeeds with move rug or pull rug. these examples illustrate a fundamental challenge in if games: successful progression often depends on domain-specific intuition, contextual knowledge, or cultural cues that are not easily recoverable from surface-level patterns. as a result, both rl-and llms-based agents still fall short of reliably solving such puzzles, limiting their ultimate performance despite improvements in exploration and memory modules. addressing this gap remains a crucial direction for future work, underscoring the need to align agents with intuition and imagination that guide human players. ## conclusion in this work, we introduced learning to play like humans framework, lplh, a novel framework designed to guide llms to play if games by simulating human player behaviors. to our knowledge, this is the first systemized approach leveraging llms to tackle well-known text-based if games. this cognitively inspired approach for llms-based if game agents integrates dynamic map building, action space learning, and experience-driven memory. lplh framework tries to balance narrative comprehension, exploration, and puzzle-solving by simulating human play processes without relying on external pre-training. although our approach still falls short of specialized rl agents in certain games and cannot match human-level scores, it yields more interpretable, human-like behaviors and enables more context-aware decision-making in interactive fiction game domains. furthermore, according to the performance of llms in if games, we believe that if games are a considerable challenge for llms in many aspects.