def splash_screen(): ''' display a simple splash screen which asks user to load/start game. ''' while True: print '"Load" existing game or "start" new game?' input_string = raw_input("load/start? ") if input_string == 'load' or input_string == 'l': player_game = GameInstance(load=DEFAULT_SAVE_FILE) upper_main(player_game) elif input_string == 'start' or input_string == 's': player_game = GameInstance() upper_main(player_game) # Just so I can test stuff. (Joshua) elif input_string == 'debug' or input_string == 'd': player_game = GameInstance() action_list = ['exit', 'take eggs from fridge', 'look inside fridge', 'go kitchen', 'go hallway'] # ^ Anyone know how I can have this work without it being backwards? refers to action_list.pop() below user_input.opening_setup(player_game,lambda (x): 'Joshua') counter = 1 while True: command = player_game.parser.parse(action_list.pop()) # next command print "%i: %s" % (counter, command.raw) player_game.take_action(command) player_game.check_events() counter += 1 else: invalid_input("Please enter \"load\" or \"start\"", input_string=input_string, tag='bad load/save choice')
def base_actions_test(self): ''' test to ensure that base actions don't crash ''' game = GameInstance() opening_setup(game,input=randomString) for action in BASE_ACTIONS: if action=="exit": # skip exit action (or else test breaks) continue elif action=="help": # ignore help continue else: game.take_action(action,input=randomString)
def base_actions_test(self): ''' test to ensure that base actions don't crash ''' game = GameInstance(input_func=randomString) for action in BASE_ACTIONS: if action=="exit": # skip exit action (or else test breaks) continue elif action=="help": # ignore help continue else: command = game.parser.parse(action) game.take_action(command,input=randomString)