From 8debc311024b5967214be86ae06712eba0b4da3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=A0=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Tue, 26 May 2026 08:48:03 +0000 Subject: [PATCH] Add README --- llm-adventure-game-2/README.md | 53 ++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 llm-adventure-game-2/README.md diff --git a/llm-adventure-game-2/README.md b/llm-adventure-game-2/README.md new file mode 100644 index 0000000..9bf7c3f --- /dev/null +++ b/llm-adventure-game-2/README.md @@ -0,0 +1,53 @@ +# LLM Adventure Game + +A simple text‑based adventure game that uses OpenAI's GPT‑3.5 to generate the story. The game runs in a terminal and accepts free‑form player commands. The LLM keeps the narrative and responds to the player. + +## Features + +* **LLM powered narration** – GPT‑3.5 generates vivid scenes and dialogue. +* **Interrupt / pause** – Type `pause` to view the current game state and resume later. +* **State persistence** – The game automatically saves the conversation history to `game_state.json` so you can quit and resume. +* **Simple command interface** – `help`, `pause`, `resume`, `exit`. + +## Requirements + +* Python 3.8+. +* `openai` library. +* An OpenAI API key. + +## Installation + +```bash +# Clone the repo +git clone https://git.brojs.ru/RK-A/llm-adventure-game-2.git +cd llm-adventure-game-2 + +# Create a virtual environment (optional but recommended) +python -m venv venv +source venv/bin/activate # On Windows use `venv\Scripts\activate` + +# Install dependencies +pip install -r requirements.txt +``` + +## Usage + +```bash +# Set your OpenAI API key +export OPENAI_API_KEY=sk-... # On Windows use `set` instead of `export` + +# Run the game +python main.py +``` + +Once the game starts, type any action or command and the LLM will generate the next part of the story. + +### Pausing and Resuming + +* Type `pause` to pause the game. The current state will be printed. +* While paused you can type `resume` to continue or `exit` to quit. +* If you exit the game, the state is cleared. If you close the terminal or hit `Ctrl+C`, the state is saved and you can resume by running `python main.py` again. + +## License + +MIT License.