Skip to content

Instantly share code, notes, and snippets.

@MightyAlex200
Created December 11, 2019 04:25
Show Gist options
  • Save MightyAlex200/424faa2b3fd5fdf7ffb5b92ec57feeb4 to your computer and use it in GitHub Desktop.
Save MightyAlex200/424faa2b3fd5fdf7ffb5b92ec57feeb4 to your computer and use it in GitHub Desktop.
AIDungeon2 "Unrestricted mode"
%%bash
# Unrestricted mode
echo """From 3575611f662028515eb539f636a320302eafce59 Mon Sep 17 00:00:00 2001
From: MightyAlex200 <[email protected]>
Date: Tue, 10 Dec 2019 23:06:23 -0500
Subject: [PATCH] Prepend actions with '!' to perform raw input injection
---
play.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/play.py b/play.py
index 31cd2bd..11a7ed5 100644
--- a/play.py
+++ b/play.py
@@ -217,6 +217,9 @@ def play_aidungeon_2():
elif action[0] == '\"':
action = \"You say \" + action
+ elif action[0] == '!':
+ action = \"\\n\" + action[1:].replace(\"\\\\n\", \"\\n\") + \"\\n\"
+
else:
action = action.strip()
action = action[0].lower() + action[1:]
--
2.24.0""" > fix.patch
# email and username required
git config user.email "[email protected]"
git config user.name "Anonymous"
git am --3way fix.patch && echo Patch Applied!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment