Esempio n. 1
0
 def test_new_tour_date(self, new_date):
     eh = ErrorHandling()
     if eh.nonblank_string(new_date[0]) == False:
         failure_list = [False, "The address field must be filled."]
         return failure_list
     elif eh.nonblank_string(new_date[1]) == False:
         failure_list = [False, "The city field must be filled."]
         return failure_list
     elif eh.variable_length_checking(new_date[2], 2) == False:
         failure_list = [False, "The state field must be with a state abbreviation."]
         return failure_list
     elif eh.variable_length_checking(new_date[3], 5) == False:
         failure_list = [False, "The zip code field must be filled."]
         return failure_list
     elif eh.nonblank_string(new_date[4]) == False:
         failure_list = [False, "The venue field must be filled."]
         return failure_list
     elif eh.variable_length_checking(new_date[5], 10) == False:
         failure_list = [False, "The phone number field must be filled."]
         return failure_list
     elif eh.nonblank_string(new_date[6]) == False:
         failure_list = [False, "The date field must be filled."]
         return failure_list
     elif eh.range_integer_input_checking(new_date[7], 0, 99999) == False:
         failure_list = [False, "The capacity field must be filled."]
         return failure_list
     elif eh.float_check_range(new_date[8], 0, float('inf')) == False:
         failure_list = [False, "The cover charge field must be a positive integer."]
         return failure_list
     elif eh.float_check_range(new_date[9], 0, float('inf')) == False:
         failure_list = [False, "The door pay field must be filled."]
         return failure_list
     else:
         success_list = [True, "All input fields have been entered correctly."]
         return success_list
Esempio n. 2
0
 def merch_list_testing(self, merch_list):
     eh = ErrorHandling()
     if eh.nonblank_string(merch_list[0]) == False:
         failure_list = [False, "The type field must be filled."]
         return failure_list
     elif eh.float_check_range(merch_list[1], 0, float('inf')) == False:
         failure_list = [False, "The price field must be an number."]
         return failure_list
     elif eh.float_check_range(merch_list[2], 0, float('inf')) == False:
         failure_list = [False, "The unit cost must be a positive number."]
         return failure_list
     elif eh.range_integer_input_checking(merch_list[3], 0, float('inf')) == False:
         failure_list = [False, "The quanitity must be a positive number."]
         return failure_list
     else:
         success_list = [True, "All input fields have been entered correctly."]
         return success_list
Esempio n. 3
0
    def game_start(self):

        eh = ErrorHandling()

        human_players_input = "How many human players? "
        human_players = eh.range_integer_input_checking(human_players_input, 1, float("inf"))
        # human_players = eh.positive_integer_input_checking(human_players_input)

        counter = 0
        player_list = []

        # This adds the number of players to the player_list, creating a new instance of each player.
        while counter < human_players:
            name_text = "What is player " + str((counter + 1)) + "'s name? "
            name = eh.nonblank_string(name_text)
            p = Players(name, 0, 0, False)
            player_list.append(p)

            counter += 1

        computer_players_input = "How many computer players? "
        computer_players = eh.range_integer_input_checking(computer_players_input, 0, float("inf"))

        computer_count = 0

        while computer_count < computer_players:
            computer_player_name = "Computer Player " + str(computer_count + 1)
            p = Players(computer_player_name, 0, 0, True)
            player_list.append(p)
            computer_count += 1

        print("Let's play Press Your Bunco!")

        # This is where the game is played. First the board is set up. Then the game is played by people.
        game = GameBoard(player_list)
        return game.play_game()