summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-02-16 20:18:03 -0800
committerRose Hogenson <rhogenson@posteo.net>2022-02-16 20:18:03 -0800
commit549db4ef1922ef40569ee89eb87c256d7b96b6af (patch)
tree5a96524cb1d12b1e7e3ee25e654e8a4fb686f033
parent14f8e850fdbdc5902996d5c269702d0e27804805 (diff)
parent80d4689fe751b4bad22d231b8b6fdd6f16f4caa0 (diff)
downloadgpt-adventure-549db4ef1922ef40569ee89eb87c256d7b96b6af.tar.zst
Merge branch 'main' of gitlab.com:rhogenson/gpt-adventure
-rwxr-xr-xgpt_adventure.py (renamed from ai_dungeon.py)18
1 files changed, 5 insertions, 13 deletions
diff --git a/ai_dungeon.py b/gpt_adventure.py
index bd39133..c2137db 100755
--- a/ai_dungeon.py
+++ b/gpt_adventure.py
@@ -1,6 +1,6 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages (pkgs: with pkgs; [ keras nltk pytorch transformers ])"
-"""AI Dungeon is a text-adventure style game powered by AI."""
+"""GPT adventure is a text-adventure style game powered by AI."""
import argparse
import re
@@ -68,18 +68,6 @@ def pick_flavor() -> str:
"purifier for your settlement. You arrive at an\n"
"abandoned settlement to the east of your home."
),
- "doctor": (
- "Your name is Amelia Plenn. Today is your doctors appointment.\n"
- "You're kind of not looking forward to it because your doctor\n"
- "is kind of weird, but today when you get to the doctor's office\n"
- "it's a different person than usual.\n"
- 'The new doctor says to you, "Hello, my name is Doctor Cockman.\n'
- "It's my pleasure to see you today.\"\n"
- "Doctor Cockman is very handsome, and you feel yourself blush as\n"
- "he leads you to the doctor's seat. You sit in the seat and he\n"
- "runs his warm hands up and down your arms.\n"
- '"Are you feeling alright?" Doctor Cockman asks.'
- ),
"political": (
"You are a political dissident and revolutionary named\n"
"Vladimir Lenin, hiding in exile in Finland while your homeland \n"
@@ -96,6 +84,7 @@ def pick_flavor() -> str:
for i, (scenario, script) in enumerate(flavors.items()):
print(f"{i}.\t{scenario}")
choices.append(script)
+ print(f"{len(choices)}.\tcustom")
while True:
choice = input("Choose a scenario: ")
try:
@@ -103,6 +92,9 @@ def pick_flavor() -> str:
except ValueError:
print("Input must be an integer.")
continue
+ if choice_int == len(choices):
+ print("Enter a custom prompt. Press control-D when you're done.")
+ return sys.stdin.read().strip()
try:
return choices[choice_int]
except IndexError: