def who_wins(h1, d1, t1, h2, d2, t2): """ Determines who wins in a computer game between two players, given their unit stats. Args: h1: The health of the first player's unit. d1: The damage of the first player's unit. t1: The reload time of the first player's unit. h2: The health of the second player's unit. d2: The damage of the second player's unit. t2: The reload time of the second player's unit. Returns: A string indicating who wins the game, or "draw" if the game is a draw. """ # Calculate the time it takes for the first player to destroy the second player's unit. time_to_destroy_2 = h2 / d1 + (t1 - 0.5) # Calculate the time it takes for the second player to destroy the first player's unit. time_to_destroy_1 = h1 / d2 + (t2 - 0.5) # If the first player's unit is destroyed before the second player's unit, then the first player wins. if time_to_destroy_1 < time_to_destroy_2: return "player one" # If the second player's unit is destroyed before the first player's unit, then the second player wins. elif time_to_destroy_2 < time_to_destroy_1: return "player two" # Otherwise, the game is a draw. else: return "draw" # Example usage: h1, d1, t1 = 100, 10, 1 h2, d2, t2 = 50, 20, 2 winner = who_wins(h1, d1, t1, h2, d2, t2) print(winner)