Ejemplo n.º 1
0
def play_match():

    # Call rps.ask_instructions() to see if player wants instructions
    rps.ask_instructions()


    # Call rps.get_name() to get a string of the players name
    # Be sure to save return value, i.e. player_name = rps.get_name()
    player_name = ""


    # Call rps.get_num_play to get the number of games to play
    # Be sure to save return value, i.e. num_times = rps.get_num_play()
    num_times = 0

    
    # Use these variables to keep track of who won
    ties = 0
    player_wins = 0
    computer_wins = 0


    # Use a while or for loop to call play_game the correct amount of times
    count = 0
    while count < num_times:
        game_winner = play_game(player_name)
        # Now use an if statement to increment total for winner
        if game_winner == "Player":
	player_wins += 1
        if game_winner = "Computer" :
	computer_wins += 1
        if game_winner = "Tie":
        ties += 1
        # i.e. will increment either ties, player_wins, or computer_winds
        count = count + 1

    # Call make_graph using the variables for win counts above.
    make_graph(player_name, player_wins, computer_wins, ties)




# Create a graph as we did in the previous lab
def make_graph(name, player_wins, comp_wins, ties):
    print "Not implemented yet"
Ejemplo n.º 2
0
def play_match():

    rps.ask_instructions()

    player_name = rps.get_name()

    num_times = rps.get_num_play()

    # Use these variables to keep track of who won
    ties = 0
    player_wins = 0
    computer_wins = 0

    # Use a while or for loop to call play_game the correct amount of times
    count = 0
    while count < num_times:
        game_winner = play_game(player_name)
        # Now use an if statement to increment total for winner
        # i.e. will increment either ties, player_wins, or computer_winds
        count = count + 1

    # Call make_graph using the variables for win counts above.
    make_graph(player_name, player_wins, computer_wins, ties)
Ejemplo n.º 3
0
def play_match():
    rps.ask_instructions()
    # Call rps.ask_instructions() to see if player wants instructions

    # Call rps.get_name() to get a string of the players name
    # Be sure to save return value, i.e. player_name = rps.get_name()
    player_name = rps.get_name()

    # Call rps.get_num_play to get the number of games to play
    # Be sure to save return value, i.e. num_times = rps.get_num_play()
    num_times = rps.get_num_play()
    num_times = int(num_times)

    # Use these variables to keep track of who won
    ties = 0
    player_wins = 0
    computer_wins = 0

    # Use a while or for loop to call play_game the correct amount of times
    count = 0
    game_winner = ""
    while count < num_times:
        count = count + 1
        game_winner = play_game(player_name)
        if (game_winner == "Player"):
            player_wins = player_wins + 1
        elif (game_winner == "Computer"):
            computer_wins = computer_wins + 1
        else:
            ties = ties + 1

        # Now use an if statement to increment total for winner
        # i.e. will increment either ties, player_wins, or computer_wins

    # Call make_graph using the variables for win counts above.
    make_graph(player_name, player_wins, computer_wins, ties)