Skip to content
TheChatArchiveThe Chat Archive
o3-2025-04-16· OpenAIHugging Face LMArena Human Preference 140K

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

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Qwenqwen3-235b-a22b-no-thinking’s answer.
  1. User

    Create a retro-themed, frog 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. Assistant

    Below is a single-file, self-contained Python program that builds a tiny “Froggy ’84” arcade game with nothing but pygame (no external assets).

    • 100 % of the graphics are drawn on-the-fly with chunky rectangles to mimic an 8-bit cabinet look.
    • A micro 5×7 pixel font is embedded as a Python dict, so even the text is retro.
    • Simple “beeps” are synthesised in code (square waves) – no WAV files needed.

    Copy the code into froggy84.py, install pygame, and run!

    pip install pygame
    python froggy84.py
    

    Have fun – and watch out for traffic! 🐸🎮

    """
    Froggy '84 – a tiny retro frog-crossing arcade game.
    Author: ChatGPT
    Requirements: pygame (pip install pygame)
    
    Controls
    --------
    ← ↑ ↓ → : Move frog one grid cell
    P       : Pause
    ESC     : Quit
    
    Goal
    ----
    Reach the lilypads at the top without losing all lives.
    """
    
    import sys, math, random, time, itertools
    import pygame as pg
    import numpy as np
    
    # --------------  BASIC CONSTANTS  -----------------
    CELL   = 32               # grid size
    COLS   = 15               # number of columns
    ROWS   = 20               # number of rows
    W, H   = COLS * CELL, ROWS * CELL
    FPS    = 60
    TITLE  = "Froggy '84"
    
    # Retro palette (CGArish)
    BLACK  = (  0,   0,   0)
    WHITE  = (255, 255, 255)
    GREEN  = (  0, 230,  64)
    DKGREEN= (  0, 150,   0)
    YELLOW = (255, 239,  70)
    RED    = (222,  39,  35)
    BROWN  = (158,  77,  34)
    BLUE   = ( 36, 122, 228)
    CYAN   = ( 52, 180, 201)
    MAG    = (217,  54, 174)
    
    # ---------------  TINY 5×7 FONT  ------------------
    _font_bits = {
        'A':["  #  ",
             " # # ",
             "#   #",
             "#####",
             "#   #",
             "#   #",
             "#   #"],
        'B':["#### ",
             "#   #",
             "#   #",
             "#### ",
             "#   #",
             "#   #",
             "#### "],
        'C':[" ####",
             "#    ",
             "#    ",
             "#    ",
             "#    ",
             "#    ",
             " ####"],
        'D':["###  ",
             "#  # ",
             "#   #",
             "#   #",
             "#   #",
             "#  # ",
             "###  "],
        'E':["#####",
             "#    ",
             "#    ",
             "#####",
             "#    ",
             "#    ",
             "#####"],
        'F':["#####",
             "#    ",
             "#    ",
             "#####",
             "#    ",
             "#    ",
             "#    "],
        'G':[" ####",
             "#    ",
             "#    ",
             "#  ##",
             "#   #",
             "#   #",
             " ####"],
        'H':["#   #",
             "#   #",
             "#   #",
             "#####",
             "#   #",
             "#   #",
             "#   #"],
        'I':["#####",
             "  #  ",
             "  #  ",
             "  #  ",
             "  #  ",
             "  #  ",
             "#####"],
        'L':["#    ",
             "#    ",
             "#    ",
             "#    ",
             "#    ",
             "#    ",
             "#####"],
        'O':[" ### ",
             "#   #",
             "#   #",
             "#   #",
             "#   #",
             "#   #",
             " ### "],
        'R':["#### ",
             "#   #",
             "#   #",
             "#### ",
             "# #  ",
             "#  # ",
             "#   #"],
        'S':[" ####",
             "#    ",
             "#    ",
             " ### ",
             "    #",
             "    #",
             "#### "],
        'U':["#   #",
             "#   #",
             "#   #",
             "#   #",
             "#   #",
             "#   #",
             " ### "],
        'Y':["#   #",
             "#   #",
             " # # ",
             "  #  ",
             "  #  ",
             "  #  ",
             "  #  "],
        '0':[" ### ",
             "#  ##",
             "# # #",
             "##  #",
             "#   #",
             "#   #",
             " ### "],
        '1':["  #  ",
             " ##  ",
             "# #  ",
             "  #  ",
             "  #  ",
             "  #  ",
             "#####"],
        '2':[" ### ",
             "#   #",
             "    #",
             "   # ",
             "  #  ",
             " #   ",
             "#####"],
        '3':[" ### ",
             "#   #",
             "    #",
             "  ## ",
             "    #",
             "#   #",
             " ### "],
        '4':["   # ",
             "  ## ",
             " # # ",
             "#  # ",
             "#####",
             "   # ",
             "   # "],
        '5':["#####",
             "#    ",
             "#    ",
             "#### ",
             "    #",
             "#   #",
             " ### "],
        '6':[" ### ",
             "#   #",
             "#    ",
             "#### ",
             "#   #",
             "#   #",
             " ### "],
        '7':["#####",
             "    #",
             "   # ",
             "  #  ",
             " #   ",
             " #   ",
             " #   "],
        '8':[" ### ",
             "#   #",
             "#   #",
             " ### ",
             "#   #",
             "#   #",
             " ### "],
        '9':[" ### ",
             "#   #",
             "#   #",
             " ####",
             "    #",
             "#   #",
             " ### "],
        '!':["  #  ",
             "  #  ",
             "  #  ",
             "  #  ",
             "  #  ",
             "     ",
             "  #  "],
    }
    def text_surf(text, fg=WHITE, bg=None, scale=2):
        text = text.upper()
        w = 6 * len(text) * scale
        h = 7 * scale
        surf = pg.Surface((w, h), pg.SRCALPHA)
        if bg: surf.fill(bg)
        for i,ch in enumerate(text):
            ch = _font_bits.get(ch,' ')
            for y,row in enumerate(ch):
                for x,c in enumerate(row):
                    if c == '#':
                        pg.draw.rect(surf, fg, ( (i*6 + x)*scale, y*scale, scale, scale))
        return surf
    
    # ---------------  SIMPLE SOUND  -------------------
    def make_beep(freq=440, duration=0.1, volume=0.3):
        """Return a pygame Sound of a square wave."""
        samples = int(duration * 44100)
        t = np.arange(samples)
        wave = (np.sign(np.sin(2*np.pi*freq*t/44100)) * 32767).astype(np.int16)
        sound = pg.mixer.Sound(wave)
        sound.set_volume(volume)
        return sound
    
    # pre-generate sounds
    SND_HOP   = None
    SND_CRASH = None
    SND_GOAL  = None
    
    # ---------------  GAME OBJECTS  -------------------
    class Frog:
        def __init__(self):
            self.reset()
    
        def reset(self):
            self.x = COLS//2
            self.y = ROWS-1
            self.alive = True
    
        def move(self, dx, dy):
            self.x = max(0, min(COLS-1, self.x+dx))
            self.y = max(0, min(ROWS-1, self.y+dy))
            if SND_HOP: SND_HOP.play()
    
        def rect(self):
            return pg.Rect(self.x*CELL, self.y*CELL, CELL, CELL)
    
        def draw(self, screen):
            # Retro frog (simple 8×8 blocks)
            base = self.rect()
            px = base.x; py = base.y
            segment = CELL//4
            body = [
                (1,0),(2,0),
                (0,1),(1,1),(2,1),(3,1),
                (0,2),(1,2),(2,2),(3,2),
                (1,3),(2,3)
            ]
            for gx,gy in body:
                pg.draw.rect(screen, GREEN, (px+gx*segment, py+gy*segment, segment, segment))
    
    class Car:
        def __init__(self, lane, speed, length, direction):
            self.lane = lane        # row on grid
            self.speed = speed      # cells/sec (can be negative)
            self.length = length    # car length in cells
            self.dir = direction    # -1 for left, 1 for right
            if self.dir == 1:
                self.x = -length
            else:
                self.x = COLS
            self.color = random.choice([RED, YELLOW, MAG, CYAN])
    
        def update(self, dt):
            self.x += self.speed * self.dir * dt
            # recycle
            if self.dir == 1 and self.x > COLS:
                self.x = -self.length
            elif self.dir == -1 and self.x < -self.length:
                self.x = COLS
    
        def rects(self):
            for i in range(self.length):
                cx = int(self.x + i)
                yield pg.Rect(cx*CELL, self.lane*CELL, CELL, CELL)
    
        def draw(self, screen):
            for r in self.rects():
                pg.draw.rect(screen, self.color, r)
    
    class Log:
        def __init__(self, lane, speed, length, direction):
            self.lane = lane
            self.speed = speed
            self.length = length
            self.dir = direction
            self.x = -length if direction==1 else COLS
            self.color = BROWN
    
        def update(self, dt):
            self.x += self.speed * self.dir * dt
            if self.dir == 1 and self.x > COLS:
                self.x = -self.length
            elif self.dir == -1 and self.x < -self.length:
                self.x = COLS
    
        def rects(self):
            for i in range(self.length):
                cx = int(self.x + i)
                yield pg.Rect(cx*CELL, self.lane*CELL, CELL, CELL)
        def draw(self, screen):
            for r in self.rects():
                pg.draw.rect(screen, self.color, r)
    
    # ---------------  MAIN GAME CLASS  ----------------
    class Game:
        def __init__(self):
            pg.init()
            pg.display.set_caption(TITLE)
            self.screen = pg.display.set_mode((W, H))
            self.clock  = pg.time.Clock()
            pg.mixer.init(frequency=44100, size=-16, channels=1)
            global SND_HOP, SND_CRASH, SND_GOAL
            SND_HOP   = make_beep(523,0.05,0.2)
            SND_CRASH = make_beep(110,0.3,0.4)
            SND_GOAL  = make_beep(784,0.3,0.4)
            self.reset()
    
        def reset(self):
            self.frog  = Frog()
            self.score = 0
            self.lives = 3
            self.goals = [False]*5
            # build lanes
            self.cars = []
            self.logs = []
            # road lanes (rows 13-17)
            road_rows = list(range(ROWS-7, ROWS-2))
            for r in road_rows:
                speed = random.uniform(2,4)
                dir   = random.choice([-1,1])
                length= random.randint(2,3)
                for offset in range(0,COLS, length+random.randint(3,5)):
                    car = Car(lane=r, speed=speed, length=length, direction=dir)
                    car.x = offset
                    car.dir = dir
                    self.cars.append(car)
            # water lanes (rows 6-10)
            for r in range(6,11):
                speed = random.uniform(1.5,3)
                dir   = random.choice([-1,1])
                length= random.randint(3,4)
                for offset in range(0,COLS, length+random.randint(4,6)):
                    log = Log(lane=r, speed=speed, length=length, direction=dir)
                    log.x = offset
                    self.logs.append(log)
            self.state = "PLAY"  # could be PLAY, DEAD, GAMEOVER
    
        def run(self):
            while True:
                dt = self.clock.tick(FPS)/1000.0
                self.handle_events()
                if self.state=="PLAY":
                    self.update(dt)
                self.draw()
                pg.display.flip()
    
        def handle_events(self):
            for ev in pg.event.get():
                if ev.type == pg.QUIT:
                    pg.quit(); sys.exit()
                elif ev.type == pg.KEYDOWN:
                    if ev.key == pg.K_ESCAPE:
                        pg.quit(); sys.exit()
                    if self.state=="PLAY":
                        if ev.key==pg.K_LEFT:  self.frog.move(-1,0)
                        if ev.key==pg.K_RIGHT: self.frog.move(1,0)
                        if ev.key==pg.K_UP:    self.frog.move(0,-1)
                        if ev.key==pg.K_DOWN:  self.frog.move(0,1)
                        if ev.key==pg.K_p:     self.state="PAUSE"
                    elif self.state=="PAUSE" and ev.key==pg.K_p:
                        self.state="PLAY"
                    elif self.state in ("DEAD","GAMEOVER") and ev.key==pg.K_RETURN:
                        self.reset()
    
        def update(self, dt):
            # move obstacles
            for car in self.cars: car.update(dt)
            for log in self.logs: log.update(dt)
    
            frog_rect = self.frog.rect()
    
            # check road collisions
            if  ROWS-7 <= self.frog.y <= ROWS-2:
                for car in self.cars:
                    if any(frog_rect.colliderect(r) for r in car.rects()):
                        self.die()
                        return
    
            # water region
            if 6 <= self.frog.y <= 10:
                on_log = None
                for log in self.logs:
                    if any(frog_rect.colliderect(r) for r in log.rects()):
                        on_log = log
                        break
                if on_log:
                    # ride with log
                    self.frog.x += on_log.speed * on_log.dir * dt
                    # fall if out of bounds
                    if self.frog.x <0 or self.frog.x>COLS-1:
                        self.die()
                        return
                else:
                    self.die()
                    return
    
            # reached home?
            if self.frog.y==0:
                slot = self.frog.x*5//COLS
                if not self.goals[slot]:
                    self.goals[slot]=True
                    self.score += 50
                    if SND_GOAL: SND_GOAL.play()
                self.frog.reset()
                if all(self.goals):
                    self.state="GAMEOVER"
    
        def die(self):
            if SND_CRASH: SND_CRASH.play()
            self.lives -=1
            if self.lives<0:
                self.state="GAMEOVER"
            else:
                self.state="DEAD"
                pg.time.set_timer(pg.USEREVENT+1, 1000)
    
        def draw_grid(self):
            for x in range(COLS):
                pg.draw.line(self.screen, DKGREEN, (x*CELL,0),(x*CELL,H))
            for y in range(ROWS):
                pg.draw.line(self.screen, DKGREEN, (0,y*CELL),(W,y*CELL))
    
        def draw_background(self):
            self.screen.fill(BLACK)
            # water
            pg.draw.rect(self.screen, BLUE, (0,6*CELL,W,5*CELL))
            # road
            pg.draw.rect(self.screen, MAG, (0,(ROWS-7)*CELL,W,5*CELL))
            # home
            pg.draw.rect(self.screen, DKGREEN, (0,0,W, CELL))
            # lilypads
            pad_w = CELL*3
            for i in range(5):
                pad_x = int(i* (W/5) + CELL)
                pg.draw.rect(self.screen, GREEN , (pad_x,0,pad_w,CELL))
    
        def draw_hud(self):
            score_txt = text_surf(f"SCORE {self.score:05d}", WHITE, scale=2)
            lives_txt = text_surf(f"LIVES {self.lives}", WHITE, scale=2)
            self.screen.blit(score_txt, (4, H- score_txt.get_height()-4))
            self.screen.blit(lives_txt, (W-lives_txt.get_width()-4, H-lives_txt.get_height()-4))
            if self.state=="PAUSE":
                t = text_surf("PAUSED", YELLOW, scale=4)
                self.screen.blit(t, ((W-t.get_width())//2, (H-t.get_height())//2))
            elif self.state=="GAMEOVER":
                t1 = text_surf("GAME OVER", RED, scale=4)
                t2 = text_surf("PRESS ENTER", WHITE, scale=2)
                self.screen.blit(t1, ((W-t1.get_width())//2, H//2- t1.get_height()))
                self.screen.blit(t2, ((W-t2.get_width())//2, H//2+10))
            elif self.state=="DEAD":
                t = text_surf("OOPS!", RED, scale=4)
                self.screen.blit(t, ((W-t.get_width())//2, (H-t.get_height())//2))
    
        def draw(self):
            self.draw_background()
            # obstacles
            for log in self.logs: log.draw(self.screen)
            for car in self.cars: car.draw(self.screen)
            # frog
            if self.state in ("PLAY","PAUSE"):
                self.frog.draw(self.screen)
            # HUD
            self.draw_hud()
            # grid (optional)
            # self.draw_grid()
    
    # ---------------  RUN THE GAME  -------------------
    if __name__ == "__main__":
        Game().run()
    

    Tips & Tweaks
    • Press P anytime to pause (great for screenshots).
    • Want hard-core 80 s difficulty? Increase each speed range by 1 or 2 in the Game.reset method.
    • If the micro font feels too small, bump the scale argument inside text_surf when the HUD is drawn.

    Enjoy the nostalgia trip! 🐸🕹️

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