Пример #1
0
def pick_game():
    tables = lobby.sort_by_stakes(LOBBY.all_tables())

    print(lobby.numbered_list(tables))
    valid_choices = list(range(len(tables)))
    print('What game do you want to play?')
    return tables[get_menu_number(valid_choices)]
Пример #2
0
    def do_games(self, args):
        """ View the available games.  """
        # pylint: disable=unused-argument, bad-builtin
        games = lobby.sort_by_stakes(self.lobby.all_tables())
        print(lobby.numbered_list(games))

        valid_choices = list(range(len(games)))

        try:
            choice = int(input("Pick a game to play :> "))
        except ValueError:
            print("Not a valid number...")
            return

        if choice in valid_choices:
            g = games[choice]
            self.casino.set_game(g)
            print("Game set to {}".format(g.tablename))
        else:
            print("Not a valid game...")