def play_game(p1_points, p2_points): game = TennisGame("player1", "player2") for i in range(max(p1_points, p2_points)): if i < p1_points: game.won_point("player1") if i < p2_points: game.won_point("player2") return game
def play_out_game(player1_score, player2_score): player1_name = "Federer" player2_name = "Nadal" game = TennisGame(player1_name, player2_name) for point in range(max(player1_score, player2_score)): if point < player1_score: game.won_point(player1_name) if point < player2_score: game.won_point(player2_name) return game
def main(): game = TennisGame("player1", "player2") print(game.get_score()) game.won_point("player1") print(game.get_score()) game.won_point("player1") print(game.get_score()) game.won_point("player2") print(game.get_score()) game.won_point("player1") print(game.get_score()) game.won_point("player1") print(game.get_score())