Skip to content
TheChatArchiveThe Chat Archive
Geminigemini-2.5-flash-preview-04-17· GoogleHugging Face LMArena Human Preference 140K

Create a retro-themed, horse-racing arcade game in Python. The game design looks like it…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Geminigemini-2.5-flash-lite-preview-06-17-thinking’s answer.
  1. User

    Create a retro-themed, horse-racing arcade game in Python. The game design looks like it could have been played in an arcade back in the 80's. Do not rely on external file uploads and instead create your own assets and designs.

  2. Gemini Assistant

    Okay, let's create a retro-themed horse racing arcade game using Pygame, completely from scratch without external asset files. We'll draw everything using Pygame's built-in drawing functions and use simple text characters or blocks for horses to achieve that 80s feel.

    Game Concept:

    • Multiple horses race across the screen from left to right.
    • The player can bet on one horse.
    • During the race, the player can "boost" their chosen horse by pressing a button repeatedly.
    • Horses have random movement variations.
    • Simple betting and payout system.
    • Basic title/betting/racing/results screens.
    • Visuals will be simple shapes, lines, and blocky text.

    Assets (Programmatically Generated):

    • Horses: Represented by colored text characters (like '&' or '>') or small colored rectangles.
    • Track: Simple horizontal lines representing lanes on a colored background.
    • Background: Solid color.
    • Text: Use Pygame's default font or a simple system font, rendered large and blocky.
    • UI Elements: Rectangles, lines, text.

    Code Structure:

    1. Setup: Import Pygame, initialize, set up screen dimensions, colors, fonts.
    2. Constants: Define colors, screen size, horse parameters, track layout.
    3. Horse Class: A simple class to hold horse data (position, speed, color, name, odds).
    4. Game States: Manage the flow (Title, Betting, Racing, Results).
    5. Drawing Functions: Functions to draw the track, horses, UI elements for each state.
    6. Game Logic:
      • Initialize horses.
      • Handle betting input.
      • Update horse positions during the race (base speed + randomness + player boost).
      • Check for finish line crossing.
      • Determine winner and finishing order.
      • Calculate payout.
    7. Main Game Loop: Handle events, update state, draw state.
    import pygame
    import random
    import sys
    import time # Using time for a simple boost cooldown/limit feel
    
    # --------------------
    # CONSTANTS
    # --------------------
    
    # Screen dimensions
    SCREEN_WIDTH = 800
    SCREEN_HEIGHT = 400
    
    # Colors (RGB) - A limited, bright 80s palette
    BLACK = (0, 0, 0)
    WHITE = (255, 255, 255)
    RED = (255, 0, 0)
    GREEN = (0, 255, 0)
    BLUE = (0, 0, 255)
    YELLOW = (255, 255, 0)
    CYAN = (0, 255, 255)
    MAGENTA = (255, 0, 255)
    GRAY = (128, 128, 128)
    DARK_GREEN = (0, 100, 0)
    BROWN = (139, 69, 19)
    
    # Retro Palette Example ( CGA-like or EGA-like feel)
    PALETTE = [
        BLACK, WHITE, RED, CYAN, MAGENTA, GREEN, BLUE, YELLOW,
        GRAY, DARK_GREEN, BROWN, (255, 165, 0), # Orange
        (128, 0, 128), # Purple
        (0, 128, 128), # Teal
        (210, 180, 140) # Tan
    ]
    
    # Game parameters
    NUM_HORSES = 4
    TRACK_START_X = 50
    TRACK_END_X = SCREEN_WIDTH - 50
    TRACK_WIDTH = TRACK_END_X - TRACK_START_X
    LANE_HEIGHT = 60 # Height for each lane
    TRACK_TOP_Y = SCREEN_HEIGHT - (NUM_HORSES * LANE_HEIGHT) - 20 # Start track from bottom
    FINISH_LINE_X = TRACK_END_X
    
    # Horse parameters
    BASE_SPEED = 1
    RANDOM_SPEED_VARIATION = 1.5 # How much speed can vary each frame
    PLAYER_BOOST = 3 # Extra speed when boosting
    BOOST_DECREASE_RATE = 0.05 # How quickly boost wears off per frame if not pressing
    BOOST_PRESS_INCREMENT = 0.2 # How much boost meter increases per key press (simulated)
    MAX_BOOST_METER = 10 # Max value for boost meter
    
    # Betting parameters
    MIN_BET = 10
    MAX_BET = 100
    INITIAL_MONEY = 500
    ODDS = [2, 3, 4, 5] # Simple fixed odds for horses 1, 2, 3, 4
    
    # Game States
    STATE_TITLE = 0
    STATE_BETTING_SELECT_HORSE = 1
    STATE_BETTING_SELECT_AMOUNT = 2
    STATE_RACING = 3
    STATE_RESULTS = 4
    STATE_GAME_OVER = 5
    
    # --------------------
    # CLASSES
    # --------------------
    
    class Horse:
        def __init__(self, index, color, odds):
            self.index = index # 0-indexed
            self.name = f"HORSE {index + 1}"
            self.color = color
            self.odds = odds
            self.reset()
    
        def reset(self):
            # Position is logical distance from start, not screen pixels
            self.position = 0
            self.speed = BASE_SPEED
            self.is_finished = False
            self.finish_time = None
            self.boost_meter = 0 # Tracks player boost potential
    
        def update(self, player_boosting_this_horse):
            if self.is_finished:
                return
    
            # Apply random speed variation
            random_variation = random.uniform(-RANDOM_SPEED_VARIATION / 2, RANDOM_SPEED_VARIATION)
            current_frame_speed = self.speed + random_variation
    
            # Apply player boost if this is the player's horse and they are boosting
            if player_boosting_this_horse:
                 # Use boost meter: pressing key increases meter, speed consumes meter
                 if self.boost_meter > 0:
                     boost_speed = min(self.boost_meter, PLAYER_BOOST) # Consume up to PLAYER_BOOST from meter
                     current_frame_speed += boost_speed
                     self.boost_meter -= boost_speed # Decrease meter based on boost consumed
                     self.boost_meter = max(0, self.boost_meter) # Don't go below zero
                 # Even if meter is low, the press itself could give a tiny nudge or increase meter
                 # We handle meter increase in event loop based on key press
    
            # Speed naturally decreases slightly if boost meter is high but not being used (simple model)
            # Or just make boost decay if not pressing the button (simpler)
            if not player_boosting_this_horse and self.boost_meter > 0:
                 self.boost_meter -= BOOST_DECREASE_RATE * 5 # Meter decays faster if not pressing
                 self.boost_meter = max(0, self.boost_meter)
    
    
            # Ensure speed doesn't go below a minimum
            current_frame_speed = max(0.1, current_frame_speed)
    
    
            self.position += current_frame_speed
    
            # Check if finished (logical position vs logical finish line)
            # The "track width" is the distance to cover logically
            if self.position >= TRACK_WIDTH:
                self.position = TRACK_WIDTH # Cap position
                self.is_finished = True
                self.finish_time = pygame.time.get_ticks() # Record finish time in milliseconds
    
        def get_screen_pos(self):
            # Convert logical position to screen position
            # Horse starts at TRACK_START_X + small offset
            # Horse moves towards TRACK_END_X
            progress_ratio = self.position / TRACK_WIDTH
            screen_x = TRACK_START_X + (TRACK_WIDTH * progress_ratio)
            # Y position is determined by lane
            screen_y = TRACK_TOP_Y + self.index * LANE_HEIGHT + LANE_HEIGHT // 2
            return int(screen_x), int(screen_y)
    
        def draw(self, screen, font):
            x, y = self.get_screen_pos()
    
            # Draw horse representation - simple text character
            # Use a blocky character or maybe just the horse number
            horse_char = f"{self.index + 1}" # Or '&', '>' etc.
            text_surface = font.render(horse_char, True, self.color)
            text_rect = text_surface.get_rect(center=(x, y))
            screen.blit(text_surface, text_rect)
    
            # Optional: Draw a simple rectangle behind/around the text
            # pygame.draw.rect(screen, self.color, (x - 10, y - 10, 20, 20))
            # text_surface = font.render(horse_char, True, BLACK) # Draw text in black on color block
            # text_rect = text_surface.get_rect(center=(x, y))
            # screen.blit(text_surface, text_rect)
    
    
    # --------------------
    # INITIALIZATION
    # --------------------
    
    pygame.init()
    screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
    pygame.display.set_caption("RETRO HORSE RACING")
    clock = pygame.time.Clock()
    
    # Fonts
    # Pygame default font is suitable for retro look
    font_small = pygame.font.Font(None, 24)
    font_medium = pygame.font.Font(None, 36)
    font_large = pygame.font.Font(None, 72)
    
    # Horses setup
    horse_colors = random.sample(PALETTE[2:], NUM_HORSES) # Use vibrant colors, skip black/white
    horses = [Horse(i, horse_colors[i], ODDS[i]) for i in range(NUM_HORSES)]
    
    # Game state variables
    game_state = STATE_TITLE
    player_money = INITIAL_MONEY
    bet_horse_index = -1 # -1 means no horse selected
    current_bet_amount = 0
    results = [] # List to store finishing order
    boost_key_state = False # Track if boost key is currently held down (for boost meter charging)
    player_boost_meter = 0 # Player's global boost meter
    
    
    # --------------------
    # DRAWING FUNCTIONS
    # --------------------
    
    def draw_title_screen():
        screen.fill(BLACK)
        title_text = font_large.render("RETRO RACE", True, YELLOW)
        subtitle_text = font_medium.render("Press SPACE to Start", True, WHITE)
        money_text = font_small.render(f"YOU HAVE ${player_money}", True, GREEN)
    
        title_rect = title_text.get_rect(center=(SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2 - 50))
        subtitle_rect = subtitle_text.get_rect(center=(SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2 + 20))
        money_rect = money_text.get_rect(center=(SCREEN_WIDTH // 2, SCREEN_HEIGHT - 50))
    
        screen.blit(title_text, title_rect)
        screen.blit(subtitle_text, subtitle_rect)
        screen.blit(money_text, money_rect)
    
    def draw_betting_select_horse():
        screen.fill(DARK_GREEN) # Green felt feel?
        title_text = font_large.render("PLACE YOUR BET", True, YELLOW)
        title_rect = title_text.get_rect(center=(SCREEN_WIDTH // 2, 50))
        screen.blit(title_text, title_rect)
    
        money_text = font_medium.render(f"MONEY: ${player_money}", True, WHITE)
        money_rect = money_text.get_rect(topright=(SCREEN_WIDTH - 20, 20))
        screen.blit(money_text, money_rect)
    
    
        prompt_text = font_medium.render("SELECT HORSE [1-4]", True, CYAN)
        prompt_rect = prompt_text.get_rect(center=(SCREEN_WIDTH // 2, 150))
        screen.blit(prompt_text, prompt_rect)
    
        # Display horse info and odds
        info_y_start = 220
        for i, horse in enumerate(horses):
            horse_info_text = font_medium.render(f"{horse.name} (Odds: {horse.odds}.00)", True, horse.color)
            horse_info_rect = horse_info_text.get_rect(center=(SCREEN_WIDTH // 2, info_y_start + i * 40))
            screen.blit(horse_info_text, horse_info_rect)
    
    def draw_betting_select_amount():
        screen.fill(DARK_GREEN)
        title_text = font_large.render("PLACE YOUR BET", True, YELLOW)
        title_rect = title_text.get_rect(center=(SCREEN_WIDTH // 2, 50))
        screen.blit(title_text, title_rect)
    
        money_text = font_medium.render(f"MONEY: ${player_money}", True, WHITE)
        money_rect = money_text.get_rect(topright=(SCREEN_WIDTH - 20, 20))
        screen.blit(money_text, money_rect)
    
        horse_info_text = font_medium.render(f"BETTING ON: {horses[bet_horse_index].name} (Odds: {horses[bet_horse_index].odds}.00)", True, horses[bet_horse_index].color)
        horse_info_rect = horse_info_text.get_rect(center=(SCREEN_WIDTH // 2, 150))
        screen.blit(horse_info_text, horse_info_rect)
    
    
        bet_text = font_medium.render(f"BET AMOUNT: ${current_bet_amount}", True, CYAN)
        bet_rect = bet_text.get_rect(center=(SCREEN_WIDTH // 2, 220))
        screen.blit(bet_text, bet_rect)
    
        prompt_text = font_small.render(f"UP/DOWN to change (${MIN_BET}-${MAX_BET}), SPACE to confirm", True, WHITE)
        prompt_rect = prompt_text.get_rect(center=(SCREEN_WIDTH // 2, 270))
        screen.blit(prompt_text, prompt_rect)
    
    
    def draw_racing_screen():
        screen.fill(DARK_GREEN) # Grass color
    
        # Draw Track Lanes
        for i in range(NUM_HORSES + 1): # Draw lines above and below each lane
            y = TRACK_TOP_Y + i * LANE_HEIGHT
            pygame.draw.line(screen, BROWN, (TRACK_START_X - 10, y), (TRACK_END_X + 10, y), 3) # Track color lines
    
        # Draw Start Line
        pygame.draw.line(screen, WHITE, (TRACK_START_X, TRACK_TOP_Y), (TRACK_START_X, TRACK_TOP_Y + NUM_HORSES * LANE_HEIGHT), 5)
        start_text = font_small.render("START", True, WHITE)
        screen.blit(start_text, (TRACK_START_X - start_text.get_width() - 5, TRACK_TOP_Y + NUM_HORSES * LANE_HEIGHT // 2 - start_text.get_height() // 2))
    
        # Draw Finish Line
        # Make it checkered pattern for retro look
        checker_size = 15
        finish_line_color1 = WHITE
        finish_line_color2 = BLACK
        for i in range(NUM_HORSES * LANE_HEIGHT // checker_size):
            color = finish_line_color1 if i % 2 == 0 else finish_line_color2
            pygame.draw.rect(screen, color, (FINISH_LINE_X, TRACK_TOP_Y + i * checker_size, checker_size, checker_size))
        finish_text = font_small.render("FINISH", True, WHITE)
        screen.blit(finish_text, (FINISH_LINE_X + 5, TRACK_TOP_Y + NUM_HORSES * LANE_HEIGHT // 2 - finish_text.get_height() // 2))
    
    
        # Draw horses
        for horse in horses:
            horse.draw(screen, font_medium)
    
        # Draw UI elements
        # Money display
        money_text = font_small.render(f"MONEY: ${player_money}", True, WHITE)
        screen.blit(money_text, (10, 10))
    
        # Bet info
        bet_info_text = font_small.render(f"BET: ${current_bet_amount} on {horses[bet_horse_index].name}", True, horses[bet_horse_index].color)
        screen.blit(bet_info_text, (10, 40))
    
        # Boost meter
        boost_text = font_small.render("BOOST:", True, YELLOW)
        screen.blit(boost_text, (10, 70))
        # Draw boost meter bar
        meter_width = 100
        meter_height = 15
        meter_x = 10 + boost_text.get_width() + 5
        meter_y = 70
        pygame.draw.rect(screen, GRAY, (meter_x, meter_y, meter_width, meter_height), 2) # Meter outline
        fill_width = int((player_boost_meter / MAX_BOOST_METER) * meter_width)
        pygame.draw.rect(screen, YELLOW, (meter_x, meter_y, fill_width, meter_height)) # Meter fill
    
        # Boost prompt
        prompt_text = font_small.render("HOLD Z TO BOOST", True, WHITE)
        screen.blit(prompt_text, (10, 90))
    
    
        # Finishing order display (as horses finish)
        if results:
             order_text_y = TRACK_TOP_Y - 30 # Above the track
             order_text = font_small.render("ORDER:", True, WHITE)
             screen.blit(order_text, (TRACK_START_X, order_text_y))
             x_offset = TRACK_START_X + order_text.get_width() + 10
             for i, finished_horse in enumerate(results):
                 place_text = font_small.render(f"{i + 1}. {finished_horse.name}", True, finished_horse.color)
                 screen.blit(place_text, (x_offset, order_text_y))
                 x_offset += place_text.get_width() + 15
    
    
    def draw_results_screen():
        screen.fill(BLACK)
        title_text = font_large.render("RESULTS", True, YELLOW)
        title_rect = title_text.get_rect(center=(SCREEN_WIDTH // 2, 50))
        screen.blit(title_text, title_rect)
    
        money_text = font_medium.render(f"MONEY: ${player_money}", True, WHITE)
        money_rect = money_text.get_rect(topright=(SCREEN_WIDTH - 20, 20))
        screen.blit(money_text, money_rect)
    
        # Display finishing order
        results_y_start = 150
        if results:
            winner = results[0]
            winner_text = font_medium.render(f"WINNER: {winner.name}", True, winner.color)
            winner_rect = winner_text.get_rect(center=(SCREEN_WIDTH // 2, results_y_start))
            screen.blit(winner_text, winner_rect)
    
            # Did the player win?
            winnings = 0
            if bet_horse_index != -1 and results and results[0].index == bet_horse_index:
                winnings = current_bet_amount * horses[bet_horse_index].odds
                win_text = font_large.render(f"YOU WIN! +${winnings}", True, GREEN)
            else:
                 win_text = font_large.render("YOU LOSE!", True, RED)
                 winnings = -current_bet_amount # Represent loss
    
    
            win_rect = win_text.get_rect(center=(SCREEN_WIDTH // 2, results_y_start + 80))
            screen.blit(win_text, win_rect)
    
            # Show full results
            full_results_text = font_small.render("Finishing Order:", True, WHITE)
            screen.blit(full_results_text, (SCREEN_WIDTH//2 - full_results_text.get_width()//2, results_y_start + 150))
    
            order_y = results_y_start + 180
            for i, horse in enumerate(results):
                place_text = font_small.render(f"{i + 1}. {horse.name}", True, horse.color)
                place_rect = place_text.get_rect(center=(SCREEN_WIDTH // 2, order_y + i * 25))
                screen.blit(place_text, place_rect)
    
    
        # Prompt to continue
        prompt_text = font_medium.render("Press SPACE to Continue", True, CYAN)
        prompt_rect = prompt_text.get_rect(center=(SCREEN_WIDTH // 2, SCREEN_HEIGHT - 50))
        screen.blit(prompt_text, prompt_rect)
    
    
    def draw_game_over_screen():
        screen.fill(BLACK)
        title_text = font_large.render("GAME OVER", True, RED)
        subtitle_text = font_medium.render("You ran out of money!", True, WHITE)
        prompt_text = font_medium.render("Press SPACE to Restart", True, CYAN)
    
        title_rect = title_text.get_rect(center=(SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2 - 50))
        subtitle_rect = subtitle_text.get_rect(center=(SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2 + 20))
        prompt_rect = prompt_text.get_rect(center=(SCREEN_WIDTH // 2, SCREEN_HEIGHT - 50))
    
        screen.blit(title_text, title_rect)
        screen.blit(subtitle_text, subtitle_rect)
        screen.blit(prompt_text, prompt_rect)
    
    
    # --------------------
    # GAME LOGIC FUNCTIONS
    # --------------------
    
    def reset_game():
        global player_money, game_state, bet_horse_index, current_bet_amount, results, player_boost_meter
        player_money = INITIAL_MONEY
        reset_race()
        game_state = STATE_TITLE
    
    def reset_race():
        global bet_horse_index, current_bet_amount, results, player_boost_meter
        bet_horse_index = -1
        current_bet_amount = 0
        results = []
        player_boost_meter = 0
        for horse in horses:
            horse.reset()
    
    
    # --------------------
    # MAIN GAME LOOP
    # --------------------
    
    running = True
    while running:
        dt = clock.tick(60) / 1000.0 # Delta time in seconds, for frame-rate independent movement if needed, though less crucial with simple steps
    
        # --- Event Handling ---
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE:
                    running = False
    
                # State-specific input handling
                if game_state == STATE_TITLE:
                    if event.key == pygame.K_SPACE:
                        if player_money <= 0:
                            reset_game() # Restart if game over
                        else:
                            reset_race() # Prepare for a new race
                            game_state = STATE_BETTING_SELECT_HORSE
    
                elif game_state == STATE_BETTING_SELECT_HORSE:
                    if event.key in (pygame.K_1, pygame.K_2, pygame.K_3, pygame.K_4):
                        selected_index = event.key - pygame.K_1 # K_1 is ASCII for '1'
                        if 0 <= selected_index < NUM_HORSES:
                            bet_horse_index = selected_index
                            current_bet_amount = MIN_BET # Start with min bet
                            game_state = STATE_BETTING_SELECT_AMOUNT
                    elif event.key == pygame.K_BACKSPACE:
                        game_state = STATE_TITLE # Go back
    
                elif game_state == STATE_BETTING_SELECT_AMOUNT:
                    if event.key == pygame.K_UP:
                        current_bet_amount += MIN_BET
                        current_bet_amount = min(current_bet_amount, MAX_BET, player_money) # Don't bet more than max or money
                    elif event.key == pygame.K_DOWN:
                        current_bet_amount -= MIN_BET
                        current_bet_amount = max(current_bet_amount, MIN_BET) # Don't bet less than min
                    elif event.key == pygame.K_SPACE:
                        if current_bet_amount > 0: # Must bet something
                            game_state = STATE_RACING
                        else:
                             # Optional: give feedback that bet is too low
                             pass
                    elif event.key == pygame.K_BACKSPACE:
                        bet_horse_index = -1 # Deselect horse
                        current_bet_amount = 0
                        game_state = STATE_BETTING_SELECT_HORSE # Go back
    
                elif game_state == STATE_RACING:
                    # Player boost handling - Z key
                    if event.key == pygame.K_z:
                         # Simple boost meter increase on press (can be held down too, handled in event.type == pygame.KEYDOWN below)
                         # player_boost_meter = min(MAX_BOOST_METER, player_boost_meter + BOOST_PRESS_INCREMENT)
                         pass # Holding down is handled below
    
                elif game_state == STATE_RESULTS:
                     if event.key == pygame.K_SPACE:
                        if player_money <= 0:
                            game_state = STATE_GAME_OVER # Game Over if money is gone
                        else:
                            game_state = STATE_TITLE # Return to title for next race
    
                elif game_state == STATE_GAME_OVER:
                     if event.key == pygame.K_SPACE:
                         reset_game() # Start fresh
    
    
            # Check for boost key state *while pressed down*
            keys = pygame.key.get_pressed()
            boost_key_state = keys[pygame.K_z]
    
            if game_state == STATE_RACING and boost_key_state:
                 # Increase boost meter while key is held
                 player_boost_meter = min(MAX_BOOST_METER, player_boost_meter + BOOST_PRESS_INCREMENT)
    
    
        # --- Game State Updates ---
    
        if game_state == STATE_RACING:
            all_finished = True
            # Update horses
            for horse in horses:
                is_player_horse = (horse.index == bet_horse_index)
                horse.update(is_player_horse and boost_key_state) # Pass boost key state
    
                if not horse.is_finished:
                    all_finished = False
                    # Check for finish line crossing during the update
                    if horse.get_screen_pos()[0] >= FINISH_LINE_X and not horse.is_finished:
                         horse.is_finished = True
                         horse.finish_time = pygame.time.get_ticks() # Record finish time
    
            # Update player's global boost meter decay if not pressing (handled in horse update now)
            # if not boost_key_state and player_boost_meter > 0:
            #      player_boost_meter -= BOOST_DECREASE_RATE
            #      player_boost_meter = max(0, player_boost_meter)
    
    
            # Check for race completion
            if all_finished:
                # Determine finishing order (based on finish_time)
                results = sorted([h for h in horses if h.is_finished], key=lambda h: h.finish_time)
    
                # Calculate payout
                winnings = 0
                if results and results[0].index == bet_horse_index:
                    winnings = current_bet_amount * horses[bet_horse_index].odds
                    player_money += winnings
                else:
                     player_money -= current_bet_amount
    
                # Ensure money doesn't go below zero (or handle game over state)
                player_money = max(0, player_money)
    
    
                game_state = STATE_RESULTS
    
    
        # --- Drawing ---
        if game_state == STATE_TITLE:
            draw_title_screen()
        elif game_state == STATE_BETTING_SELECT_HORSE:
            draw_betting_select_horse()
        elif game_state == STATE_BETTING_SELECT_AMOUNT:
            draw_betting_select_amount()
        elif game_state == STATE_RACING:
            draw_racing_screen()
        elif game_state == STATE_RESULTS:
            draw_results_screen()
        elif game_state == STATE_GAME_OVER:
            draw_game_over_screen()
    
    
        # --- Update Display ---
        pygame.display.flip()
    
    # Quit Pygame
    pygame.quit()
    sys.exit()
    

    How to Run:

    1. Make sure you have Python installed.
    2. Make sure you have Pygame installed (pip install pygame).
    3. Save the code as a Python file (e.g., retro_race.py).
    4. Run it from your terminal: python retro_race.py

    Retro Elements Implemented:

    • Limited Color Palette: Uses a predefined list of vibrant colors often seen in 80s arcade games.
    • Simple Graphics: Horses are represented by text characters (or simple blocks if you uncomment the drawing code), track is just lines.
    • Blocky Text: Uses Pygame's default font, which renders text in a simple, blocky style.
    • Simple UI: Basic text prompts and displays for betting, money, and results.
    • Jittery Movement: Random speed variation makes the horses move in a somewhat unpredictable, non-smooth arcade fashion.
    • Direct Control: The player boost mechanic adds a direct, button-mashing interaction common in arcade games.
    • State Machine: The game progresses through distinct, simple states (Title, Betting, Racing, Results, Game Over).
    • No External Assets: All visual elements are drawn using Pygame primitives and font rendering.

    This code provides a functional, minimal retro horse racing experience that adheres to the "no external files" and "80s arcade" aesthetic requests. You could expand it with sound, more complex betting, different horse stats, etc., but this is a solid foundation.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.