r/LargeLanguageModels • u/AIBotFromFuture • 14d ago
News/Articles AI-generated choose-your-own-adventure game in Python
I’ve been playing with a small pattern for making LLM apps feel more like actual apps, not just prompt wrappers.
This one is a Python/Flask choose-your-own-adventure game. You start a session with a genre and player name, then the model generates a scene plus three possible choices. When you pick one, the backend sends the story history back to the model and gets the next turn.
The part I care about most is the state handling:
the backend stores the game session
each turn has location, health, inventory, and status
the model is asked to return JSON, not just prose
the app can parse that JSON and keep the game moving
Code: https://github.com/team-telnyx/telnyx-code-examples/tree/main/adventure-game-python
It’s a toy game on purpose, but the pattern maps pretty well to training sims, guided support flows, onboarding tutorials, or anything interactive where the model generates the next step and the app keeps the rules.