From e43f94b8a0a6db2f1c45d3f922fe8e556349cd1e Mon Sep 17 00:00:00 2001 From: test_user_lai676 Date: Mon, 10 Jul 2023 20:35:05 +0000 Subject: [PATCH] Initial commit --- .assets/fork.jpg | Bin 0 -> 3887 bytes .gitignore | 4 ++ adventure/seafloor/coral_reef/chest.py | 48 ++++++++++++++ adventure/seafloor/coral_reef/reef.txt | 23 +++++++ adventure/seafloor/seafloor.txt | 7 ++ .../seafloor/sunken_ship/galley/ghost.py | 17 +++++ adventure/seafloor/sunken_ship/ship.txt | 5 ++ .../seafloor/sunken_ship/stateroom/desk.py | 14 ++++ adventure/sinking.txt | 9 +++ pyproject.toml | 15 +++++ returnToShip.py | 62 ++++++++++++++++++ 11 files changed, 204 insertions(+) create mode 100644 .assets/fork.jpg create mode 100644 .gitignore create mode 100644 adventure/seafloor/coral_reef/chest.py create mode 100644 adventure/seafloor/coral_reef/reef.txt create mode 100644 adventure/seafloor/seafloor.txt create mode 100644 adventure/seafloor/sunken_ship/galley/ghost.py create mode 100644 adventure/seafloor/sunken_ship/ship.txt create mode 100644 adventure/seafloor/sunken_ship/stateroom/desk.py create mode 100644 adventure/sinking.txt create mode 100644 pyproject.toml create mode 100644 returnToShip.py diff --git a/.assets/fork.jpg b/.assets/fork.jpg new file mode 100644 index 0000000000000000000000000000000000000000..144af85ad5dfe3cff64cd441d5a5e02ca747b986 GIT binary patch literal 3887 zcmb7GcTm$y*Zze-5=sIALLh+<2%=y>dKD#vCWwGk0l75kD7`3334{{5N)wePMHFc& z0xA%S3TP;5C?ZWn3`kLmqI~#%cfNW5xZauX?CzN@XV31lv-6y@%iNs;_)H9s83G^> z0D$%iusaSU0GtpgKa?N!y9x0N2n%6_1cXs&VPPQ=w1}ASUPo92FN?=u_w5%zNhnI} zlU0&eP(b64YADO8ACQw*2XS$6ad2=T_Ub_q0g;3MZ`o}JkT75zmQfcIP@!ARgJu!&mR zOm@jD1Z0mfK-ErDW=bxP>YO-T%VL?oI<|4B!#t!FX*bgu522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+0ztiH0q&czFt=t<5 z$sQXO11ZH3pvk_c2y+`R6eEcl_m3ERw`2@=7swYB5b~=*y85aC)2p)QD>?8EV=ywUbDi z3WRMWV)?R@lI!S2-XSL@B18p+d3hr94L{Mm;11!-nnLPJfiQ`)`#cjY-P-8g&Vsaf z?SZROb+~+r?MCDlqUV|g^3WdCm%&Dj?X6K5{;@@Q?bP>{7GIO=cG_#~H>as}RBtc) z=-^YQd0R_ZVR`%22;B1ZW1{l$$D8P$g<`-ScP_)28CVwRfccCr@ zU`;ttM{ldaS}7d!r;PbOsWfk1oj&_vHbn7)-Oa6gKXulBJp^ew!^sCt*LwZW8o;ZJ zo23rv>EjIIBCj(;%?VhXwc+wFsyHoO_<{hrUcKUpt=plL^B%MUB5`XIk ") + +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.") diff --git a/adventure/seafloor/coral_reef/reef.txt b/adventure/seafloor/coral_reef/reef.txt new file mode 100644 index 0000000..b5986ec --- /dev/null +++ b/adventure/seafloor/coral_reef/reef.txt @@ -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/ _| + + diff --git a/adventure/seafloor/seafloor.txt b/adventure/seafloor/seafloor.txt new file mode 100644 index 0000000..9ea297c --- /dev/null +++ b/adventure/seafloor/seafloor.txt @@ -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. diff --git a/adventure/seafloor/sunken_ship/galley/ghost.py b/adventure/seafloor/sunken_ship/galley/ghost.py new file mode 100644 index 0000000..f75807d --- /dev/null +++ b/adventure/seafloor/sunken_ship/galley/ghost.py @@ -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") diff --git a/adventure/seafloor/sunken_ship/ship.txt b/adventure/seafloor/sunken_ship/ship.txt new file mode 100644 index 0000000..6643b8b --- /dev/null +++ b/adventure/seafloor/sunken_ship/ship.txt @@ -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. diff --git a/adventure/seafloor/sunken_ship/stateroom/desk.py b/adventure/seafloor/sunken_ship/stateroom/desk.py new file mode 100644 index 0000000..3785648 --- /dev/null +++ b/adventure/seafloor/sunken_ship/stateroom/desk.py @@ -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.") diff --git a/adventure/sinking.txt b/adventure/sinking.txt new file mode 100644 index 0000000..d9dc56b --- /dev/null +++ b/adventure/sinking.txt @@ -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. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9ab73e4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,15 @@ +[tool.poetry] +name = "lab_terminal" +version = "0.1.0" +description = "" +authors = ["Chris Proctor "] +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" diff --git a/returnToShip.py b/returnToShip.py new file mode 100644 index 0000000..4752a67 --- /dev/null +++ b/returnToShip.py @@ -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()