def init_suspect_positions (self): """ Initialises the suspects' location to a random position in their bedroom or, if that doesn't exist, a random room in the manor.. """ sl = self.suspect_list rooms = [] for s in xrange(sl.no_of_suspects()): rooms.append(None) manor = self.base_manor for r in manor.rooms: for i in manor.room_props[r].owners: rooms[i] = r for i in xrange(sl.no_of_suspects()): if i == sl.victim: continue if rooms[i] == None: rooms[i] = random.choice(manor.rooms) s = sl.get_suspect(i) s.pos = manor.get_random_pos_in_room(rooms[i]) if one_chance_in(5): self.set_suspect_path(i)
def initialise_parameters (self): """ Initialise the simple parameters. """ # Initially place the player in the centre of the entrance hall. manor = self.base_manor self.player_pos = manor.get_random_pos_in_room(manor.entrance_hall) self.init_command_list() self.game_start = True # Game just started. self.debugging = False # debugging mode self.message = None # A message displayed for one turn. self.dir_running = DIR_NOWHERE # Direction we are running (if any). self.travel_path = [] self.quit_game = False self.wait_for_key = True # If false, handle NPC movement without waiting for player key. self.turns = 0 self.init_command_parameters()