def play(): """The engine that runs the game.""" # Clear the command prompt and show the game introduction. os.system('cls') print """ ______ _ _______ _______ _______ _ ( __ \ |\ /|( ( /|( ____ \( ____ \( ___ )( ( /| | ( \ )| ) ( || \ ( || ( \/| ( \/| ( ) || \ ( | | | ) || | | || \ | || | | (__ | | | || \ | | | | | || | | || (\ \) || | ____ | __) | | | || (\ \) | | | ) || | | || | \ || | \_ )| ( | | | || | \ | | (__/ )| (___) || ) \ || (___) || (____/\| (___) || ) \ | (______/ (_______)|/ )_)(_______)(_______/(_______)|/ )_) _______ _______ ______ _______ _______ _______ ( ___ )( ____ \ ( __ \ ( ___ )( ___ )( ) | ( ) || ( \/ | ( \ )| ( ) || ( ) || () () | | | | || (__ | | ) || | | || | | || || || | | | | || __) | | | || | | || | | || |(_)| | | | | || ( | | ) || | | || | | || | | | | (___) || ) | (__/ )| (___) || (___) || ) ( | (_______)|/ (______/ (_______)(_______)|/ \| Type help for instructions, q to quit. """ divider() print "Your quest is to defeat the evil spider in the Dungeon of Doom." divider() print rooms[player.room].description() # Run game engine while the player is alive. while player.is_alive(): try: # Provide prompt to user. divider() prompt = raw_input("\nWhat do you want to do?\n> ") os.system('cls') # Determine what action to take based on user input. parse(prompt) divider() # Update the toom conditions based on the user's action. rooms[player.room].update_room_conditions() # End game if victory condition is met. if victory(): break # Print the updated room conditions. print rooms[player.room].description() except KeyboardInterrupt: quit() # Final text printed when the game ends. print "The End."
# if passed a parameter, take that to be the timestamp for this ping. # if not, then this must not have been called by launch.py so tag as UNSCHED. if len(sys.argv) > 1: t = int(sys.argv[1]) else: autotags += " UNSCHED" t = time.time() # Can't lock the same lockfile here since launch.pl will have the lock! # This script may want to lock a separate lock file, just in case multiple # instances are invoked, but launch.pl will only launch one at a time. # lockb(); wait till we can get the lock. if pingtime - t > 9: print(util.divider('')) print(util.divider(" WARNING "*8)) print(util.divider('')) print("This popup is", pingtime - t, "seconds late.") print('Either you were answering a previous ping when ' 'this tried to pop up, or you just started the ' 'tagtime daemon (tagtimed.py), ' 'or your computer\'s extremely sluggish.') print(util.divider('')) # XXX tasks # TODO # Figure out what to do with taskfiles (as per the perl version) # taskfile = str(settings.path) + str(settings.user) + ".tsk" # walk through the task file, printing the active tasks and capturing the list # of tags for each task (capturing in a hash keyed on task number).