From 9066d9676ad02a2d93197f9cce5e6ec07779db64 Mon Sep 17 00:00:00 2001 From: log Date: Tue, 24 Jan 2023 15:08:52 +0100 Subject: [PATCH] log game in a folder now --- .../.ipynb_checkpoints/voidfunc-checkpoint.py | 92 +++++++ avoid/a-void.py | 231 ++++++++++++++++++ avoid/voidfunc.py | 92 +++++++ 3 files changed, 415 insertions(+) create mode 100644 avoid/.ipynb_checkpoints/voidfunc-checkpoint.py create mode 100644 avoid/a-void.py create mode 100644 avoid/voidfunc.py diff --git a/avoid/.ipynb_checkpoints/voidfunc-checkpoint.py b/avoid/.ipynb_checkpoints/voidfunc-checkpoint.py new file mode 100644 index 0000000..475a920 --- /dev/null +++ b/avoid/.ipynb_checkpoints/voidfunc-checkpoint.py @@ -0,0 +1,92 @@ +# A Void - Functions +# by Gorgs Prc +# +# Adaptation to IF by log +# ------------------ + +# Variables +# ------------------ + +import random +import os +from time import sleep +import sys + +global current_room +global visited_rooms +global viewedthings +current_room = "room" +visited_rooms=[] +viewedthings=[] + +class bcolors: + BLUE = '\033[94m' + CYAN = '\033[96m' + GREEN = '\033[92m' + YELLOW = '\033[93m' + RED = '\033[91m' + MAGENTA = '\x1b[35m' + ENDC = '\033[0m' + BOLD = '\033[1m' + UNDERLINE = '\033[4m' + + +# Funtions +# ------------------ + +def delayPrint(s): + for c in s: + sys.stdout.write(c) + sys.stdout.flush() + sleep(0.01) + print("\n") + sys.stdout.write(">") + +def interact(thing, roomthings): + print("") + delayPrint(roomthings[current_room][thing]) + viewedthings.append(thing) + +def look(roomthings, current_room): + roomstring = ", a ".join(roomthings[current_room]) + delayPrint(f"Looking around this spot, you sight a {roomstring}") + +def portflip(rooms): + global current_room + rooms.remove(current_room) + current_room = "bar" + rooms.append(current_room) + delayPrint("""COMMANDANT (vigorously nodding): That's right, a port-flip! Any port-flip in a storm, what? Ha ha ha! +BARMAN (as though in pain): I . . . don't .. . think . . . any . .. in .. . stock . . . +COMMANDANT (jumping up off his stool): What, no port-flips! But only last month I had (laboriously counting out) 1, 2, no, 3 port-flips in this bar! +BARMAN (almost inaudibly): But now . . . now . . . you can't. . . """) + +def defaultReply(): + messages = ["You cannot do that", "What?", "That won't work"] + return random.choice(messages) + +def nextroom(death,rooms,intro,message): + global current_room + sleep(1) + delayPrint(bcolors.RED + death[current_room] + bcolors.ENDC) + sleep(1) + rooms.remove(current_room) + if len(rooms) == 0: + gameover() + current_room = random.choice(rooms) + print(bcolors.CYAN + "-"*79) + sleep(1) + delayPrint("\n" + " "*40 + intro[current_room]) + print("-"*79 + bcolors.ENDC) + sleep(1) + delayPrint(message[current_room]) + +def gameover(): + print(bcolors.RED + "-"*79 + "\n" + "-"*80 + "\n" + "-"*80 + "\n") + sleep(1) + print("\n" + " "*28 + " / \ / \ / \ ") + print(" "*28 + "( f | i | n )") + print(" "*28 + " \_/ \_/ \_/ " + "\n") + sleep(1) + print("-"*79 + "\n" + "-"*80 + "\n" + "-"*80 + "\n" + bcolors.ENDC) + exit() diff --git a/avoid/a-void.py b/avoid/a-void.py new file mode 100644 index 0000000..24353e0 --- /dev/null +++ b/avoid/a-void.py @@ -0,0 +1,231 @@ +# A Void +# by Gorgs Prc +# +# Adaptation to IF by log +# ------------------ + +# Variables +# ------------------ + +import random +import os +from time import sleep +import sys + +rooms = ["room", "island", "bar"] +visited_rooms=[] +viewedthings=[] +current_room = "room" +roomthings = {} +roomthings["room"]={"bookstand": "To his right is a mahogany stand on which sit 26 books - on which, I should say, 26 books normally ought to sit, but, as always, a book is missing, a book with an inscription, '5', on its flap. Nothing about this stand, though, looks at all abnormal or out of proportion, no hint of a missing publication, no filing card or 'ghost', as librarians quaintly call it, no conspicuous gap or blank", + +"windowsill": "Crawling across his windowsill is a tiny animal, indigo and saffron in colour, not a cockroach, not a blowfly, but a kind of wasp, laboriously dragging a sugar crumb along with it. Hoping to crush it with a casual blow, Vowl lifts up his right hand; but it abruptly flaps its wings, flying off without giving its assailant an opportunity to do it any harm.", + +"door": "Padding into his bathroom, Vowl dabs at his brow and throat with a damp cloth. Back to his room.", + +"visiting-card": "Laid out languorously, all day long, on a couch or on a sofa, or on occasion rocking to and fro in his rocking chair, stubbornly trying to copy out on an old visiting-card that indistinct motif that had sprung at him from his rug, as frail as an infant but not now, thanks to Cochin's surgical skills, in all that much physical pain, our protagonist starts hallucinating, blowing his mind. ", + +"rug": "His mind runs riot. Lost in thought, scrutinising his rug, Vowl starts imagining 5, 6, 26 distinct visual combinations, absorbing but also insubstantial, as though an artist's rough drafts but of what? - that, possibly, which a psychiatrist would call Jungian slips, an infinity of dark, mythic, anonymous portraits flitting through his brain, as it burrows for a solitary, global signal that might satisfy his natural human lust for signification both instant and lasting, a signal that might commandingly stand out from this chain of discontinuous links, this miasma of shadowy tracings, all of which, or so you would think, ought to knit up to form a kind of paradigmatic configuration, of which such partial motifs can furnish only anagrams and insipid approximations: \n a body crumpling up, a hoodlum, a portrait of an artist as a young dog; \n a bullock, a Bogartian falcon, a brooding blackbird; \n an arthritic old man; \n a sigh;"} +roomthings["island"]={ +"stick": "At dusk, using a sharp rock, Ishmail cuts a notch on a stick (to tick off his first night as a castaway); and, with a total of 20 such cuts, constructs a hut, a sort of impromptu shack, with a door, four walls, and flooring and roofing built out of mud. With no matchsticks at hand, though, his food is invariably raw.", + +"compound": "It was built, circa 1930, in a crypto-rococo fashion imitating, variously, a pink-icing casino in Monaco, a bungalow on a Malayan plantation, a colonialist villa, an ultra-chic condominium in Miami and Tara from GWTW. ", + +"cushion": " a numb, downcast, haggard Ishmail withdraws his hand. What, again, occurs is that this cushion, say - a thing normally as soft and downy as a baby's bottom - is, to his touch, now a hard, cold, compact block, as rock-hard as a diamond, as though part of a shadowy twin world consubstantial with Ishmail's own but caught through a glass darkly, a living mirror of our own world and just as cold, shiny and insular as a mirror. "} +roomthings["bar"]={ +"barman": """BARMAN (who knows a thing or two): Morning, mon Commandant. +COMMANDANT (calming down now that, although in mufti, his rank is plain to this barman): Ah, good morning to you, my boy, good morning! +BARMAN (who has a slight but distinct hint of Oirishry about him): And what, pray, can I do for you, sir? Your wish is my command. +COMMANDANT (licking his lips): You know what I fancy most of all - a port-flip. +BARMAN (frowning)-. What? """, + +"port": """COMMANDANT (furiously pointing in front of him): Now look, that's port, isn't it? +BARMAN (in agony): Uh huh . . . but. . . +COMMANDANT (livid): So? So? And (pointing again) that's an. . . """} +bag = ["watch"] +message ={ +"room": """ +Incurably insomniac, Anton Vowl turns on a light. According to his watch it's only 12.20. With a loud and languorous sigh Vowl sits up, stuffs a pillow at his back, draws his quilt up around his chin, picks up his whodunit and idly scans a paragraph or two; but, judging its plot impossibly difficult to follow in his condition, its vocabulary too whimsically multisyllabic for comfort, throws it away in disgust. +""", + +"island": """ +But six days go past, and his unusually robust constitution allows him finally to sit up and look around him. Our protagonist is now disturbingly skinny but can still, if with difficulty, climb out of his pit — a pit that was almost his tomb. So Ishmail starts living again.""", + +"bar": """ +MAN, sitting down and barking (with gruff and, as you might say, military incivility): Barman! """} + +death ={ +"room": """ +It's all in vain. His subconscious vision starts buzzing around him again, buzzing around and within him, choking and suffocating him.""", + +"island": """ +At which point Ishmail falls victim to hallucinations, possibly from consuming a poisonous black mushroom or having had too much to drink; or, why not, from having shrunk so much as to vanish wholly from sight""", + +"bar": """BARMAN (abruptly dying): Aaaaaaah! Shhhhhhh . . . R.I.P. +COMMANDANT (about to go but first noticing his body): What a storm in a port-flip! + +Which is what you might call adding insult to injury.""",} + +intro ={ +"room":"""1 + +Which at first calls to mind a probably familiar story of a drunk man waking up with his brain in a whirl.""", + +"island":"""2 + +In which luck, God's alias and alibi, plays a callous trick on a suitor cast away on an island.""", + +"bar": """3 + +"Oh, how idiotic," murmurs Vowl. But just as idiotic, now, is his vision of a man going into a bar: """} +class bcolors: + BLUE = '\033[94m' + CYAN = '\033[96m' + GREEN = '\033[92m' + YELLOW = '\033[93m' + RED = '\033[91m' + MAGENTA = '\x1b[35m' + ENDC = '\033[0m' + BOLD = '\033[1m' + UNDERLINE = '\033[4m' + +# Funtions +# ------------------ + +def delayPrint(s): + for c in s: + sys.stdout.write(c) + sys.stdout.flush() + sleep(0.01) + print("\n") + sys.stdout.write(">") + +def interact(thing): + print("") + delayPrint(roomthings[current_room][thing]) + viewedthings.append(thing) + +def look(): + roomstring = ", a ".join(roomthings[current_room]) + delayPrint(f"Looking around this spot, you sight a {roomstring}") + +def portflip(): + global current_room + rooms.remove(current_room) + current_room = "bar" + rooms.append(current_room) + delayPrint("""COMMANDANT (vigorously nodding): That's right, a port-flip! Any port-flip in a storm, what? Ha ha ha! +BARMAN (as though in pain): I . . . don't .. . think . . . any . .. in .. . stock . . . +COMMANDANT (jumping up off his stool): What, no port-flips! But only last month I had (laboriously counting out) 1, 2, no, 3 port-flips in this bar! +BARMAN (almost inaudibly): But now . . . now . . . you can't. . . """) + +def defaultReply(): + messages = ["You cannot do that", "What?", "That won't work"] + return random.choice(messages) + +def nextroom(): + global current_room + sleep(1) + delayPrint(bcolors.RED + death[current_room] + bcolors.ENDC) + sleep(1) + rooms.remove(current_room) + if len(rooms) == 0: + gameover() + current_room = random.choice(rooms) + print(bcolors.CYAN + "-"*79) + sleep(1) + delayPrint("\n" + " "*40 + intro[current_room]) + print("-"*79 + bcolors.ENDC) + sleep(1) + delayPrint(message[current_room]) + +def gameover(): + print(bcolors.RED + "-"*79 + "\n" + "-"*80 + "\n" + "-"*80 + "\n") + sleep(1) + print("\n" + " "*28 + " / \ / \ / \ ") + print(" "*28 + "( f | i | n )") + print(" "*28 + " \_/ \_/ \_/ " + "\n") + sleep(1) + print("-"*79 + "\n" + "-"*80 + "\n" + "-"*80 + "\n" + bcolors.ENDC) + exit() + +# Start of book +# ------------------ + +os.system('clear') #this needs to be cls for windows +print(bcolors.CYAN + "-"*80 + "\n" + "-"*80 + "\n" + "-"*80 + "\n") +sleep(0.5) +print(""" + + _ _ + __ _ __ _____ (_) __| | + / _` | \ \ / / _ \| |/ _` | + | (_| | \ V / (_) | | (_| | + \__,_| \_/ \___/|_|\__,_| + + by Gorgs Prc + + + + + Push ↵ to start + +""") +sleep(0.5) +print("-"*80 + "\n" + "-"*80 + "\n" + "-"*80 + "\n" + bcolors.ENDC) +input() +os.system('clear') #this needs to be cls for windows +sleep(1) +print(bcolors.CYAN + "-"*80 + +""" + + ::: + :+:+: + +:+ + +#+ + +#+ + #+# + ####### + + _ _ _ _ _ _ _ _ _ + / \ / \ / \ / \ / \ / \ / \ / \ / \ + ( A | n | t | o | n ) ( V | o | w | l ) + \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ +""") +print("-"*80) +sleep(1) +delayPrint("\n" + " "*40 + intro[current_room]) +print("-"*79 + bcolors.ENDC) +sleep(1) +delayPrint(message[current_room]) + +while True: +# Wait for user input + reply = input() + +# End the game if all rooms have been explored + if len(rooms) == 0: + gameover() + break + +# End the room if all items have been interacted with + if any(s not in viewedthings for s in roomthings[current_room]): + pass + else: + nextroom() + +# Do functions based on reply + if "exit" in reply: + gameover() + break + elif "e" in reply or len(roomthings[current_room]) == 0: + nextroom() + elif "port" in reply and "flip" in reply: + portflip() + elif any(word in reply.split() for word in roomthings[current_room]): + word = next((s for s in reply.split() if s in roomthings[current_room]), None) + interact(word) + elif any(s in reply for s in ["look", "scan", "watch", "study", "spot", "spy", "analysis", "probing", "grill", current_room]): + look() + else: + delayPrint(defaultReply()) \ No newline at end of file diff --git a/avoid/voidfunc.py b/avoid/voidfunc.py new file mode 100644 index 0000000..475a920 --- /dev/null +++ b/avoid/voidfunc.py @@ -0,0 +1,92 @@ +# A Void - Functions +# by Gorgs Prc +# +# Adaptation to IF by log +# ------------------ + +# Variables +# ------------------ + +import random +import os +from time import sleep +import sys + +global current_room +global visited_rooms +global viewedthings +current_room = "room" +visited_rooms=[] +viewedthings=[] + +class bcolors: + BLUE = '\033[94m' + CYAN = '\033[96m' + GREEN = '\033[92m' + YELLOW = '\033[93m' + RED = '\033[91m' + MAGENTA = '\x1b[35m' + ENDC = '\033[0m' + BOLD = '\033[1m' + UNDERLINE = '\033[4m' + + +# Funtions +# ------------------ + +def delayPrint(s): + for c in s: + sys.stdout.write(c) + sys.stdout.flush() + sleep(0.01) + print("\n") + sys.stdout.write(">") + +def interact(thing, roomthings): + print("") + delayPrint(roomthings[current_room][thing]) + viewedthings.append(thing) + +def look(roomthings, current_room): + roomstring = ", a ".join(roomthings[current_room]) + delayPrint(f"Looking around this spot, you sight a {roomstring}") + +def portflip(rooms): + global current_room + rooms.remove(current_room) + current_room = "bar" + rooms.append(current_room) + delayPrint("""COMMANDANT (vigorously nodding): That's right, a port-flip! Any port-flip in a storm, what? Ha ha ha! +BARMAN (as though in pain): I . . . don't .. . think . . . any . .. in .. . stock . . . +COMMANDANT (jumping up off his stool): What, no port-flips! But only last month I had (laboriously counting out) 1, 2, no, 3 port-flips in this bar! +BARMAN (almost inaudibly): But now . . . now . . . you can't. . . """) + +def defaultReply(): + messages = ["You cannot do that", "What?", "That won't work"] + return random.choice(messages) + +def nextroom(death,rooms,intro,message): + global current_room + sleep(1) + delayPrint(bcolors.RED + death[current_room] + bcolors.ENDC) + sleep(1) + rooms.remove(current_room) + if len(rooms) == 0: + gameover() + current_room = random.choice(rooms) + print(bcolors.CYAN + "-"*79) + sleep(1) + delayPrint("\n" + " "*40 + intro[current_room]) + print("-"*79 + bcolors.ENDC) + sleep(1) + delayPrint(message[current_room]) + +def gameover(): + print(bcolors.RED + "-"*79 + "\n" + "-"*80 + "\n" + "-"*80 + "\n") + sleep(1) + print("\n" + " "*28 + " / \ / \ / \ ") + print(" "*28 + "( f | i | n )") + print(" "*28 + " \_/ \_/ \_/ " + "\n") + sleep(1) + print("-"*79 + "\n" + "-"*80 + "\n" + "-"*80 + "\n" + bcolors.ENDC) + exit()