import pygame # Homework: show a "You Win!" message when the score reaches 10. # Click to increase the score. When score >= 10, render "You Win!" # in large text in the center of the screen instead of the normal display. # The game should still be closeable after winning. pygame.init() screen = pygame.display.set_mode((640, 480)) pygame.display.set_caption("Win Condition") clock = pygame.time.Clock() BG = (15, 30, 50) WHITE = (255, 255, 255) YELLOW = (240, 200, 40) font_score = pygame.font.SysFont(None, 48) font_win = pygame.font.SysFont(None, 80) score = 0 WIN_SCORE = 10 running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False elif event.type == pygame.MOUSEBUTTONDOWN: if score < WIN_SCORE: score += 1 screen.fill(BG) if score >= WIN_SCORE: # TODO: render "You Win!" in font_win centered on screen pass else: # TODO: render f"Score: {score} / {WIN_SCORE}" in font_score pass pygame.display.flip() clock.tick(60) pygame.quit()