def main(self): command_helper = InputHelper(["play", "exit"]) player_type_helper = InputHelper( ["player", "historian", "mostcommon", "random", "sequential"] ) try: next_command = command_helper.get_legal_input("Please enter a command: \n") if next_command == "play": players = [] for player_num in range(1, 3): player_name = input(f"Please enter player {player_num}'s NAME: ") player_type = player_type_helper.get_legal_input( f"Please enter player {player_num}'s TYPE: " ) players.append(self.__create_player(player_name, player_type)) number_of_games = int(input("Please enter number of rounds: ")) tournament = Tournament(players[0], players[1], number_of_games) tournament.arrange_tournament() else: sys.exit(0) except KeyboardInterrupt: return self.main()
def run_interface(self): """ Main interface that a user interacts with """ print("--------------------------Rock-Paper-Scissors--------------------------") self.get_player_types() self.declare_player_types() number_of_games = int(input("Number of games to be played: ")) player_one = self.__players__[0] player_two = self.__players__[1] tournament = Tournament(player_one, player_two, number_of_games) tournament.arrange_tournament() print("-----------------------------------------------------------------------")