Skip to content

Instantly share code, notes, and snippets.

@blackle
Last active June 29, 2022 20:31
Show Gist options
  • Save blackle/6946aee1359ac9c29d122bb1deaca272 to your computer and use it in GitHub Desktop.
Save blackle/6946aee1359ac9c29d122bb1deaca272 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
def printen(strr):
print(strr, end='')
adventure = [
'''welcome to the <b>choost adventure engine!</b>
would you like to play a game?''',
{
"01_play": ['''welcome adventurer, to a quest of great sights and wonders!<br/><br/>you find yourself in a beautiful village just off the highway. what will your first action be?''', {
"02_look at real estate": ['''ah! looking to settle down already? what joy! you open up the classifieds and find three potential real estate investments, which do you choose?''', {
"01_the quaint corner loft": ['''good choice! this stunning property on the corner of whatever street and wherever boulevard makes you feel tingly in places you didn't even know could feel tingly. so... sooo tingly. oh goodness... I think... I think you're gonna marry this house?<br/><br/><i>you got the "conjugal rental" ending!</i>''', {}],
"02_a beautiful seaside suite": ['''beautiful! so beautiful! too beautiful! it's just beautiful! that's it! beautiful! the beaut! beautiful! beautiful! beautiful! beautiful!<br/><br/><i>you got the "beautiful" ending!</i>''', {}],
"03_swamp hole": ['''oh. oh god. you've picked the swamp hole. do you understand the implications of your choice?''', {
"01_of course": ['''oh. I see. oh well. I guess we're going to the swamp hole.<br/><br/><i><b>the swamp hole beckons.</b></i>''', {
"01_enter the swamp hole": ['''<i>you got the "swamp hole" ending!</i>''', {}]
}],
"02_what?": ['''oh god. you don't even know what you've done.<br/><i><b>the swamp hole beckons.</b></i>''', {
"01_RUN": ['''you run as fast as you can, as far as you can, but you can never escape the swamp hole.<br/><br/><i>you got the "swamp hole" ending!</i>''', {}]
}]
}]
}],
"01_get mad swole at the gym": ['''nice idea! getting buff is a healthy part of any balanced breakfast!<br/><br/>you bunnyhop to the gym, building up incredible forward velocity. you smash through the gym doors and front roll into the main training area. what will you train with?''', {
"01_the dumbbells": ['''what did you just call me, punk?''', {
"01_w-what?": ['''don't play dumb with me, what did you just call me?''', {
"01_i-i didn't...": ['''you didn't? hm? you insult a shark and pretend you didn't do it? do you want to know what sharks do to prey like you?''', {
"01_I'm sorry please don't eat me": ['''fine. I won't. anyway you have a grand ol time with the dumbbells but you eventually die of old age<br/><br/><i>you got the "full and peaceful life" ending!</i>''', {}],
"02_why am I turned on right now": ['''<i>you got the "we're all perverts here!" ending!</i>''', {}]
}]
}]
}],
"02_whatever that thing is": ['''what? oh. oh that thing. you sure? I'm pretty sure all that rusty stuff is dried blood splatter.''', {
"02_yeah lets do it!": ['''ok! you get into the contraption and almost immediately your skull is unceremoniously ripped from your head, leaving it looking like a deflated party balloon. feels great on your quads, though.<br/><br/><i>you got the "feel the burn" ending!</i>''', {}]
}]
}]
}]
}]
def to_html(adventure, depth):
printen('''<div style="position:absolute;left:0;right:0;bottom:0;top:0;background:#444;color:#aea;padding:2em">''')
printen(f'''<div style="text-align:center;">{adventure[0]}</div><br/>''')
keys = sorted(adventure[1].keys())
for key in keys:
val = adventure[1][key]
printen(f'''<details style="z-index:{depth};">''')
printen(f'''<summary style="width:100%;cursor:pointer;">{key[3:]}</summary>''')
to_html(val, depth+1)
printen('''</details>''')
printen('''</div>''')
printen('''<div style="font-family:monospace;position:relative;width:calc(100% + 2em);margin:-1em;height:450px;">''')
to_html(adventure, 0)
printen('''<img src="https://staging.cohostcdn.org/attachment/d4f229e7-0962-4c5f-856d-013c022dd8c4/screenoverlay.png" style="pointer-events:none;position:absolute;left:0;right:0;bottom:0;top:0;margin:0;width:100%;height:450px;"/></div>''')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment