deleted log game

fruitual
log 2 years ago
parent 5d7638d68f
commit dafce480d1

@ -11,11 +11,9 @@ import random
import os
from time import sleep
import sys
import voidfunc
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",
@ -89,66 +87,6 @@ class bcolors:
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
# ------------------
@ -194,10 +132,10 @@ print(bcolors.CYAN + "-"*80 +
""")
print("-"*80)
sleep(1)
delayPrint("\n" + " "*40 + intro[current_room])
voidfunc.delayPrint("\n" + " "*40 + intro[voidfunc.current_room])
print("-"*79 + bcolors.ENDC)
sleep(1)
delayPrint(message[current_room])
voidfunc.delayPrint(message[voidfunc.current_room])
while True:
# Wait for user input
@ -205,27 +143,27 @@ while True:
# End the game if all rooms have been explored
if len(rooms) == 0:
gameover()
voidfunc.gameover()
break
# End the room if all items have been interacted with
if any(s not in viewedthings for s in roomthings[current_room]):
if any(s not in voidfunc.viewedthings for s in roomthings[voidfunc.current_room]):
pass
else:
nextroom()
voidfunc.nextroom(death,rooms,intro,message)
# Do functions based on reply
if "exit" in reply:
gameover()
voidfunc.gameover()
break
elif "e" in reply or len(roomthings[current_room]) == 0:
nextroom()
elif "e" in reply or len(roomthings[voidfunc.current_room]) == 0:
voidfunc.nextroom(death,rooms,intro,message)
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()
voidfunc.portflip(rooms)
elif any(word in reply.split() for word in roomthings[voidfunc.current_room]):
word = next((s for s in reply.split() if s in roomthings[voidfunc.current_room]), None)
voidfunc.interact(word, roomthings)
elif any(s in reply for s in ["look", "scan", "watch", "study", "spot", "spy", "analysis", "probing", "grill", voidfunc.current_room]):
voidfunc.look(roomthings, voidfunc.current_room)
else:
delayPrint(defaultReply())
voidfunc.delayPrint(voidfunc.defaultReply())
Loading…
Cancel
Save