Initial commit

This commit is contained in:
2024-02-09 16:08:00 +00:00
commit 629036632b
14 changed files with 302 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
# chest.py
# --------
# By MWC Contributors
#
# This is a Python program. You should run it by typing `python chest.py`.
import os
from pathlib import Path
from urllib.request import urlretrieve
from threading import Timer
from datetime import datetime
import sys
sys.path.append('../../..')
from fancy_printing import print_fancy
CHEST_TIMER_FILE = ".timer"
SECRET = "318"
APPROACH_CHEST = [
"You approach the chest and see that the lock is surprisingly free of rust. In fact, the code dials turn smoothly. Try entering a code."
]
CHEST_OPENS = [
"The chest snaps open, releasing several huge air bubbles. You look into the chest and see..."
]
TREASURE = [
"something shining brightly from within, so bright you can't quite make out what it is."
]
MONSTER1 = [
"*rumble* *rumble* *rumble*",
"Around the reef, nothing seems out of place."
]
MONSTER2 = [
"*rumble* *rumble* *rumble*",
"A SEA MONSTER APPEARS FROM THE REEF!",
"The sea monster must have seen you open the chest! There's no time to squander. You grab the treasure from the chest without taking a closer look! Quick, make a bag and store your treasure inside, using the following commands:",
"mkdir bag",
"mv treasure.jpg bag",
"Then get back to the surface ASAP! Don't forget to take your treasure bag with you. Remember, `..` means 'the parent directory,' so these commands will move the bag to the parent directory and then move yourself:",
"mv bag ../bag",
"cd .."
]
print_fancy(APPROACH_CHEST)
guess = input(" > ")
if guess.strip() == SECRET:
Path(CHEST_TIMER_FILE).write_text(datetime.now().isoformat())
print_fancy(CHEST_OPENS)
os.system('cp ./../../../.assets/fork.jpg treasure.jpg')
Timer(1.0, print_fancy, [TREASURE]).start()
Timer(3.0, print_fancy, [MONSTER1]).start()
Timer(5.0, print_fancy, [MONSTER2]).start()
else:
print_fancy(["nothing happens. Maybe next time."])

View File

@@ -0,0 +1,23 @@
You are standing at the edge of a beautiful coral reef. Schools of fish are
swirling around you in every direction. In front of you is a deep chasm
where you see larger fish sliding through the shadows. There is a chest
half-buried in the seafloor.
____...------------...____
_.-"` /o/__ ____ __ __ __ \o\_`"-._
.' / / \ \ '.
|=====/o/======================\o\=====|
|____/_/________..____..________\_\____|
/ _/ \_ <_o#\__/#o_> _/ \_ \
\________________\####/________________/
|===\!/========================\!/===|
| |=| .---. |=| |
|===|o|=========/ \========|o|===|
| | | \() ()/ | | |
|===|o|======{'-.) A (.-'}=====|o|===|
| __/ \__ '-.\uuu/.-' __/ \__ |
|============= .'.'^'.'.=============|
| _\o/ __ {.' __ '.} _ _\o/ _|