Skip to content
TheChatArchiveThe Chat Archive
Amazon Novaamazon-nova-experimental-chat-05-14· AmazonHugging 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 grok-3-mini-high’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. Amazon Nova Assistant

    Certainly! Below is a simple retro-themed horse-racing arcade game created in Python using the pygame library. This game captures the aesthetic of 80's arcade games with pixel art and simple mechanics.

    First, ensure you have pygame installed. You can install it using pip if you haven't already:

    pip install pygame
    

    Here is the complete code for the retro-themed horse-racing arcade game:

    import pygame
    import random
    
    # Initialise pygame
    pygame.init()
    
    # Constants
    SCREEN_WIDTH = 640
    SCREEN_HEIGHT = 480
    horse_width = 30
    horse_height = 40
    track_width = SCREEN_WIDTH - 40
    FPS = 60
    WHITE = (255, 255, 255)
    BLACK = (0, 0, 0)
    GREEN = (0, 255, 0)
    
    # Set up the screen
    screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
    pygame.display.set_caption("Retro Horse Racing")
    
    # Load fonts
    font = pygame.font.SysFont("monospace", 16)
    
    # Horse class
    class Horse(pygame.sprite.Sprite):
        def __init__(self, color, lane):
            super().__init__()
            self.image = pygame.Surface((horse_width, horse_height))
            self.image.fill(color)
            self.rect = self.image.get_rect()
            self.rect.x = 20
            self.rect.y = lane
            self.speed = random.randint(3, 6)
    
        def update(self):
            self.rect.x += self.speed
            if self.rect.x > SCREEN_WIDTH:
                self.rect.x = -horse_width
                self.speed = random.randint(3, 6)
    
    
    # Track class
    class Track(pygame.sprite.Sprite):
        def __init__(self):
            super().__init__()
            self.image = pygame.Surface((track_width, SCREEN_HEIGHT))
            self.image.fill(GREEN)
            self.rect = self.image.get_rect()
            self.rect.x = 20
            self.rect.y = 0
            # Draw lanes
            for i in range(5):
                pygame.draw.line(self.image, WHITE, (0, i * 80), (track_width, i * 80), 2)
    
    
    # Create sprite groups
    all_sprites = pygame.sprite.Group()
    horses = pygame.sprite.Group()
    
    # Create the track
    track = Track()
    all_sprites.add(track)
    
    # Create horses
    lanes = [40, 120, 200, 280, 360]
    horse_colours = [(255,0,0), (0,0,255), (0,255,0), (255,255,0), (255,0,255)]
    
    for i, lane in enumerate(lanes):
        horse = Horse(horse_colours[i], lane)
        all_sprites.add(horse)
        horses.add(horse)
       
    
    # Game loop
    clock = pygame.time.Clock()
    running = True
    while running:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
    
        # Update
        all_sprites.update()
    
        # Check for winner
        for horse in horses:
            if horse.rect.x >= SCREEN_WIDTH - horse_width:
                winner_text = font.render(f"Winner: Horse {horses.sprites().index(horse) + 1}", 1, WHITE)
                screen.blit(winner_text, (SCREEN_WIDTH // 2 - winner_text.get_width() // 2, SCREEN_HEIGHT // 2 - winner_text.get_height() // 2))
                pygame.display.flip()
                pygame.time.wait(2000)  # Show winner for 2 seconds
                horse.rect.x = -horse_width  # Reset horse position
                break
    
        # Draw
        screen.fill(BLACK)
        all_sprites.draw(screen)
        pygame.display.flip()
    
        clock.tick(FPS)
    
    pygame.quit()
    

    Explanation:

    1. Initialization:

      • Pygame is initialized, and constants for screen size, horse dimensions, and colours are defined.
      • The screen is set up, and a font is loaded for rendering text.
    2. Horse Class:

      • Each horse is a sprite with a coloured rectangle.
      • Horses move at a random speed between 3 and 6 pixels per frame.
      • When a horse goes off-screen, it resets to the start with a new random speed.
    3. Track Class:

      • The track is a green rectangle with white lanes drawn at regular intervals.
    4. Sprite Groups:

      • all_sprites includes both the track and the horses.
      • horses includes only the horse sprites.
    5. Horse Creation

      • Horses are created with different colours and placed in different lanes.
    6. Game Loop:

      • The game loop handles events, updates sprite positions, and redraws the screen.
      • If a horse reaches the end of the track, a winner message is displayed for 2 seconds before resetting the horse's position

    This game captures the simple, pixelated aesthetic of 80's arcade games and provides a basic but fun horse-racing experience.

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