Initial commit

This commit is contained in:
test_user_lai676 2023-07-10 20:35:05 +00:00
commit e43f94b8a0
11 changed files with 204 additions and 0 deletions

BIN
.assets/fork.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
bag
treasure.png
key.txt
.timer

View File

@ -0,0 +1,48 @@
# This is a Python program. You should run it by typing "chest.py"
import os
from urllib.request import urlretrieve
import threading
import datetime
def treasure():
print(" something shining brightly from within, so bright you can't")
print(" quite make out what it is.\n")
def monster1():
print(" *rumble* *rumble* *rumble* \n")
print(" Around the reef, nothing seems out of place.\n")
def monster2():
print(" *rumble* *rumble* *rumble* \n")
print(" A SEA MONSTER APPEARS FROM THE REEF! \n")
print(" The sea monster must have seen you open the chest!")
print(" There's no time to squander. You grab the treasure from the chest without taking a closer look!")
print(" Quick, use mkdir to make a \"bag\" directory and mv to")
print(" hide the treasure.jpg in the bag. ")
print(" Then get back to the surface ASAP! The monster is coming! \n")
print(" Don't forget to take your treasure bag with you up to the top directory!")
now = datetime.datetime.now()
with open(".timer", "w") as timerfile:
timerfile.write(str(now))
secret = "318"
print(" You approach the chest and see that the lock is surprisingly free of rust.")
print(" In fact, the code dials turn smoothly. Try entering a code.")
guess = input(" > ")
if guess == secret:
print(" The chest snaps open, releasing several huge air bubbles.")
print(" You look into the chest and see...\n")
os.system('cp ./../../../.assets/fork.jpg treasure.jpg')
timer1 = threading.Timer(1.0, treasure)
timer2 = threading.Timer(3.0, monster1)
timer3 = threading.Timer(5.0, monster2)
timer1.start()
timer2.start()
timer3.start()
else:
print(" 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/ _|

View File

@ -0,0 +1,7 @@
After several moments of peaceful floating, you make a gentle landing on
the seafloor, several hundered meters away from the sunken ship. You appear
to be at the edge of a plateau whose edges are encrusted with beautiful
corals.
Both sunken_ship and coral_reef are directories, so use the "cd" command
to go into whichever one you want.

View File

@ -0,0 +1,17 @@
# This is a Python file. You can run it by typing "python ghost.py"
from pathlib import Path
if Path("key.txt").exists():
print(" The ghost glances over at you. 'I hope you find some use for that key.'")
else:
print(" You enter the cramped galley and notice a sad, lonely ghost wandering")
print(" around. You always wondered if you would be afraid of ghosts, but")
print(" somehow this feels completely normal. The ghost begins to speak.")
print("")
print(" 'It has been a long while since I have seen anybody down here,' she says")
print(" 'I would like to give you a gift. Here's a key.'")
with open("key.txt", "w") as keyfile:
keyfile.write(" Even in the faint light of your lamp, the key has a golden gleam.\n")

View File

@ -0,0 +1,5 @@
The sunken ship is lying on the seafloor at a slight angle. From the remains
of its masts and rigging, you can tell it's from the age before ships were made
of steel and powered by engines. You climb up in the deck, and see a large hole
allowing access to the inner chambers. You flick on your suit's light and
go inside.

View File

@ -0,0 +1,14 @@
# This is a Python program. You can run it by typing "python desk.py"
from pathlib import Path
print(" The stateroom contains the ruins of an elegant office. Scraps of wallpaper")
print(" are peeling from the wall; there is an eel living in the chandelier.")
print(" There is a huge desk at the center of the room.")
if Path("../galley/key.txt").exists():
print(" You try your key in the desk drawer, and it clicks open. There are")
print(" many decaying pieces of paper. One has the numbers 318 written in")
print(" a fine script.")
else:
print(" You try to open the desk's drawer, but it is firmly locked.")

9
adventure/sinking.txt Normal file
View File

@ -0,0 +1,9 @@
As you are lowered off the edge of the research boat, you wave goodbye to
your friends. The diving suit is tight and stiff, and your vision is limited
to the round window in front of you. Your head goes below water, and the
sharp details of the boat are replaced by a wash of blues and greens. Below
you is an endless expanse of water. You can just barely see the sunken ship
on the seafloor. You relax, allowing your body to gently float down...
To continue, you need to go into the seafloor directory by typing
"cd seafloor". Once you're there, type "ls" to see what's inside.

15
pyproject.toml Normal file
View File

@ -0,0 +1,15 @@
[tool.poetry]
name = "lab_terminal"
version = "0.1.0"
description = ""
authors = ["Chris Proctor <chris@chrisproctor.net>"]
license = "MIT"
[tool.poetry.dependencies]
python = "^3.11"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

62
returnToShip.py Normal file
View File

@ -0,0 +1,62 @@
from pathlib import Path
import shutil
from datetime import datetime
from datetime import timedelta
import subprocess
def reset():
shutil.rmtree('bag')
Path('adventure/seafloor/coral_reef/.timer').unlink()
print(" You are swimming as fast as you can towards the boat but you can")
print(" feel the water begin to pull you back as the sea monster opens its")
print(" giant mouth.")
print(" You kick with all your might, sure that you are about to breath your")
print(" last breath.")
print(" ")
print(" ")
print(" Suddenly... The treasure bag slips out of your hand!")
print(" It swirls down through the water and into the mouth of the sea monster.")
print(" The beast's mouth snaps closed and it jets away into the depth of the")
print(" ocean, taking with it the treasure.")
print(" You are safe... but will you attempt the dive again?")
def win():
print(" You are swimming as fast as you can towards the boat but you can")
print(" feel the water begin to pull you back as the sea monster opens its")
print(" giant mouth.")
print(" You kick with all your might, sure that you are about to breathe your")
print(" last breath.")
print(" ")
print(" ")
print(" Suddenly... A hand appears!")
print(" You've made it to the boat! The crew pulls you into the boat, just in")
print(" time to avoid the sea monster's vicious maw.")
print(" You're safe at last!")
print(" Now you can finally show off the treasure you risked your life for...")
print(" Use open treasure.jpg to take a peek.")
now = datetime.now()
if not Path("adventure/seafloor/coral_reef/.timer").exists():
print(" Your adventure has only just begun. You are not yet ready to return")
print(" to the ship. More secrets await you in the ocean's depths.")
else:
if not Path("./bag/treasure.jpg").exists():
print(" You forgot your treasure bag! Hurry back to get it before the sea monster")
print(" hides it away forever!")
else:
with open ("adventure/seafloor/coral_reef/.timer", "r") as timerFile:
timeChestOpenedAsList=timerFile.readlines()
timeChestOpened = datetime.strptime(('').join(timeChestOpenedAsList), '%Y-%m-%d %H:%M:%S.%f')
if timeChestOpened + timedelta(seconds=60) < now:
reset()
else:
win()