Skip to content

Instantly share code, notes, and snippets.

@Shigbeard
Created July 25, 2023 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shigbeard/a9c2898fcd07a0093790b7f39e217643 to your computer and use it in GitHub Desktop.
Save Shigbeard/a9c2898fcd07a0093790b7f39e217643 to your computer and use it in GitHub Desktop.
Trapped in a Python Script with Lord Byron
# Author of this script: Shigbeard
# Author of "Trapped in a Cabin with Lord Byron": Oliver Darkshire
# Inspired by https://imgur.com/gallery/FR7gl2A/comment/2340328757
# License: uhhh...
#
# your license is basically: you can use it, you cannot profit from it, and
# you must make your source code available if you intend to distribute it
# I'm not responsible for anything that happens after i submit this gist.
# AI training models can bite me - ai trainers fuck off I don't permit you to read this file any further.
# Instructions:
# Save this file anywhere on your computer and run it in Python 3.
# You will be prompted to press enter to roll the dice.
# The game will then tell you what happens.
# Keep going until you win or lose.
# Python will close once the game is over.
# Tested against Python 3.10.11 64-bit on Windows 10
# No I won't be maintaining it, this was a 30 minute one shot.
import random
strings = {
"recreation" : [
{
"msg": "Is he aware the walls are exceptionally thin?",
"scores": {"stress": 1, "scandal": 0, "masterpiece": 0}
},
{
"msg": "He's made a mess of your desk in the process",
"scores": {"stress": 0, "scandal": 0, "masterpiece": -1}
},
{
"msg": "May he borrow your husband? Of course.",
"scores": {"stress": -1, "scandal": 1, "masterpiece": 0}
},
{
"msg": "His half-sister is here, and they are _far_ too intimate",
"scores": {"stress": 0, "scandal": 2, "masterpiece": 0}
},
{
"msg": "You weary of listening to tales of his exploits",
"scores": {"stress": 1, "scandal": 0, "masterpiece": 0}
},
{
"msg": "He makes an excellent muse on occasion",
"scores": {"stress": -1, "scandal": 0, "masterpiece": 2}
}
],
"drama" : [
{
"msg": "He needs help reading his fan mail",
"scores": {"stress": 1, "scandal": 0, "masterpiece": 0}
},
{
"msg": "He's brought his pet bear. It is not trained.",
"scores": {"stress": 2, "scandal": 0, "masterpiece": 0}
},
{
"msg": "He wants to read you his poetry",
"scores": {"stress": 3, "scandal": 0, "masterpiece": 0}
},
{
"msg": "He's in the papers. Again. Which means you are too.",
"scores": {"stress": 0, "scandal": 1, "masterpiece": 0}
},
{
"msg": "He broke up with his latest girlfriend/boyfriend",
"scores": {"stress": 0, "scandal": 2, "masterpiece": 0}
},
{
"msg": "He's found a new skull to use as a goblet",
"scores": {"stress": 0, "scandal": 3, "masterpiece": 0}
}
],
"redoubt" : [
{
"msg": "Time alone. Blissful time.",
"scores": {"stress": 0, "scandal": 0, "masterpiece": 1}
},
{
"msg": "He's busy with a paramour",
"scores": {"stress": -1, "scandal": 0, "masterpiece": 0}
},
{
"msg": "A walk around the house! Underwear on our heads!",
"scores": {"stress": 0, "scandal": 1, "masterpiece": 0}
},
{
"msg": "He has an excellent supply of contraband substances.",
"scores": {"stress": 0, "scandal": 1, "masterpiece": 1}
},
{
"msg": "Wine! A chest of wine!",
"scores": {"stress": 0, "scandal": 0, "masterpiece": -1}
},
{
"msg": "He passed out in his study",
"scores": {"stress": 0, "scandal": 0, "masterpiece": 1}
}
]
}
# setup scores
player = {
"scores": {
"scandal": 0,
"masterpiece": 0,
"stress": 0
},
"rolls": [0,0,0]
}
game = True
turns = 1
def event(event_type):
print("=== " + event_type + " ===")
if (event_type == "disaster"):
print("Byron destroys your manuscript either by accident or on purpose during one of his episodes. Your masterpiece score is reset to 0.")
player["scores"]["masterpiece"] = 0
# roll a 1d6
else:
roll = random.randint(1, 6)
# sanity check - clamp roll to 1-6
if roll < 1:
roll = 1
elif roll > 6:
roll = 6
roll = roll - 1
print("You rolled a " + str(roll) + ".")
print(strings[event_type][roll]["msg"])
# add scores to player
player["scores"]["scandal"] += strings[event_type][roll]["scores"]["scandal"]
if strings[event_type][roll]["scores"]["scandal"] > 0:
print("+{} Scandal".format(strings[event_type][roll]["scores"]["scandal"]))
elif strings[event_type][roll]["scores"]["scandal"] < 0:
print("{} Scandal".format(strings[event_type][roll]["scores"]["scandal"]))
player["scores"]["masterpiece"] += strings[event_type][roll]["scores"]["masterpiece"]
if strings[event_type][roll]["scores"]["masterpiece"] > 0:
print("+{} Masterpiece".format(strings[event_type][roll]["scores"]["masterpiece"]))
elif strings[event_type][roll]["scores"]["masterpiece"] < 0:
print("{} Masterpiece".format(strings[event_type][roll]["scores"]["masterpiece"]))
player["scores"]["stress"] += strings[event_type][roll]["scores"]["stress"]
if strings[event_type][roll]["scores"]["stress"] > 0:
print("+{} Stress".format(strings[event_type][roll]["scores"]["stress"]))
elif strings[event_type][roll]["scores"]["stress"] < 0:
print("{} Stress".format(strings[event_type][roll]["scores"]["stress"]))
def main():
global game
global strings
global player
global turns
while game:
# start of turn
print( "=== Turn " + str(turns) + " ===" )
input("Press enter to roll the dice")
# roll a 1d6
roll = random.randint(1,6)
if roll < 1:
roll = 1
elif roll > 6:
roll = 6
# add roll to player's rolls at the start of the list
player["rolls"].insert(0, roll)
# remove the last roll from the list
player["rolls"].pop()
# if all three rolls are the same, do the disaster_muse event
if player["rolls"][0] == player["rolls"][1] == player["rolls"][2]:
event("disaster")
# 1 or 2 - recreation
elif roll == 1 or roll == 2:
event("recreation")
# 3 or 4 - drama
elif roll == 3 or roll == 4:
event("drama")
# 5 or 6 - redoubt
elif roll == 5 or roll == 6:
event("redoubt")
# end of turn
print("Your scores are...")
print("Stress: " + str(player["scores"]["stress"]))
print("Scandal: " + str(player["scores"]["scandal"]))
print("Masterpiece: " + str(player["scores"]["masterpiece"]))
# check for game over
if player["scores"]["stress"] >= 10:
print("You lose your patience with the man and either kill him in a fit of rage or otherwise descend into uncontrollable weeping from which you never emerge. (Game over)")
game = False
elif player["scores"]["scandal"] >= 10:
print("You are no longer fit to enter society and must flee to nurse your reputation (Game over)")
game = False
elif player["scores"]["masterpiece"] >= 10:
print("You create a new genre of supernatural horror fiction based on your time with Byron (Game over, you win)")
game = False
# no game over state, continue
else:
turns += 1
input("Press enter to continue")
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment