Side by Side: NES vs. Ralph

The 1986 NES original alongside what Ralph produced in TypeScript. See where it lands and where it diverges.

Ralph is an AI coding loop that takes a high-level description and iterates on the code until it works. For this experiment, it was pointed at the original Legend of Zelda and told to rebuild it as a browser game in TypeScript.

Over 4 prompts and fewer than 70 iterations, Ralph produced a playable game with overworld exploration, screen-by-screen room transitions, sword combat, enemy AI, dungeon crawling, boss fights, NPC interactions, a shop system, item pickups, and the top-down camera — all rendered on HTML5 Canvas. It's not a perfect replica, but the breadth of what it generated is genuinely interesting to dig into.

Below are some side-by-side comparisons between the NES original and Ralph's TypeScript output. Have a look and draw your own conclusions.

Original NES (1986)
Ralph's TypeScript
01

"It's Dangerous to Go Alone!"

The iconic opening scene where the old man hands Link his first sword. Ralph produced a cave interior, the old man NPC, a dialog system, and the item acquisition flow. Compare the layouts and see how the moment reads in each version.

NES Original
Original NES — Old man gives Link the wooden sword
Ralph's TypeScript
Ralph's TypeScript version — Old man gives Link the wooden sword
02

"Buy Somethin' Will Ya!"

One of gaming's most quotable lines. Ralph produced a working shop system with item selection, rupee-based purchasing, and the merchant NPC. The feel isn't identical, but the structure is recognizably there.

NES Original
Original NES — Shopkeeper with items for sale
Ralph's TypeScript
Ralph's TypeScript version — Shopkeeper with items for sale
03

The Old Woman

Hidden throughout Hyrule, the old woman NPCs offer potions and cryptic advice. Ralph generated an interior cave layout, NPC rendering, and dialog interactions for these side characters — a good example of the kind of secondary content it picked up beyond the main quest line.

NES Original
Original NES — Old woman NPC in a cave
Ralph's TypeScript
Ralph's TypeScript version — Old woman NPC in a cave
04

Boss Encounter

Dungeon bosses are the heart of Zelda's challenge. Ralph generated boss AI with attack patterns, health systems, hit detection, and room-locking mechanics. The encounter plays differently than the original, but the pieces — arena, behavior, combat loop — are all present.

NES Original
Original NES — Dungeon boss fight
Ralph's TypeScript
Ralph's TypeScript version — Dungeon boss fight
05

User menu with elimination feature

The select user menu lets players choose, create, or delete save profiles before starting the game. Ralph produced a user account screen with slot selection, name entry, and a delete confirmation flow — one of the more surprising details to see it attempt on its own.

NES Original
Original NES — User account select screen
Ralph's TypeScript
Ralph's TypeScript version — User account select screen with add and delete options

The Overworld

Beyond individual scenes, Ralph generated a connected overworld with screen-by-screen transitions, terrain rendering, and navigable pathways. Walk in any direction and there's another screen to see.

Ralph's TypeScript — Overworld
Ralph's TypeScript version — Overworld exploration

What Came Out of 4 Ralph Loops

A closer look at the content Ralph generated, pulled from the actual game source.

1

The Overworld

The overworld is a 16×8 grid — 128 screens of explorable terrain. The map features grass plains, forests, mountains, lakes, and rocky passages, rendered at the NES-native 256×240 resolution.

12 cave entrances are scattered across the map, hiding shops, NPCs, a fairy fountain, and secret item givers.

50 hidden items are buried throughout the overworld, revealed by pushing rocks (18), burning bushes with the candle (19), or bombing walls (13).

2

Items & Equipment

3 Sword Tiers

Wooden Sword (free, starting cave), White Sword (requires 5 hearts), and Magical Sword (requires 12 hearts). Damage scales at 1×, 2×, and 4× respectively. At full health, the sword fires a beam projectile.

8 B-Button Items

  • Boomerang — stuns enemies
  • Bombs — area damage, required for Dodongo
  • Bow & Arrow — costs 1 rupee per shot
  • Blue Candle — once per screen
  • Food / Bait
  • Letter — unlocks the potion shop
  • Blue Potion
  • Red Potion

Passive Equipment

Standard Shield, Magic Shield, Blue Ring (half damage), Red Ring (quarter damage), Power Bracelet, Ladder, Raft, and Magic Key.

Collectibles

Hearts, green rupees (1), blue rupees (5), bombs, keys, fairies (full heal), heart containers (+1 max heart), and clock. Max rupees: 255. Max heart containers: 16. Starting bomb capacity: 8, upgradeable to 12 then 16.

3

Shops & NPCs

4 shops with 3 NPC types (Old Man, Old Woman, Merchant):

General Shop

Shield (90), Blue Candle (60), Bombs (20)

Premium Shop

Blue Ring (250), Heart Container (100), Food (60)

Archery Shop

Bow (80), Arrow (80), Key (100)

Potion Shop

Blue Potion (40), Red Potion (68) — requires delivering the Letter first

Free Item Caves

  • Wooden Sword — "IT'S DANGEROUS TO GO ALONE! TAKE THIS."
  • Boomerang — "TAKE ANY ROAD YOU WANT."
  • Letter — "TAKE THIS TO THE OLD WOMAN."
  • White Sword & Magical Sword — "MASTER USING IT AND YOU CAN HAVE THIS."

Other Caves

Hint cave ("EASTMOST PENNINSULA IS THE SECRET."), Fairy Fountain (heals), Money Making Game (costs 10 rupees to play).

4

Enemies — 22 Types

10 Overworld Enemies

Red & Blue Octorok

Walk randomly, shoot rocks. Blue: 2 HP vs red's 1.

Red & Blue Tektite

Hop around. Blue homes toward the player.

Red & Blue Moblin

Walk and shoot arrows. Blue: 3 HP, moves faster.

Red Leever

Emerges from the ground. 2 HP, 2 contact damage.

Peahat

Flies in a wobble pattern, only vulnerable when stopped.

Zora

Emerges from water, shoots fireballs.

Red Lynel

The deadliest overworld enemy: 4 HP, 4 contact damage, shoots sword beams.

12 Dungeon Enemies

Keese

Flying bats, 1 HP, can't be knocked back.

Green Gel

Tiny 8×8 enemies, 1 HP.

Green Stalfos

Standard skeleton, 2 HP.

Red Goriya

Throws a returning boomerang, 3 HP.

Rope

Sits idle then dashes when in line of sight (64px trigger, 3× speed).

Green Zol

2 HP, splits into 2 Green Gels on death.

Bubble

Completely invulnerable, disables your sword on contact.

Blade Trap

Invulnerable, charges at speed 3 when aligned, returns at half speed.

Red Darknut

3 HP, can't be stunned, only vulnerable from certain directions.

Blue Wizzrobe

3 HP, teleports near player, shoots magic beams, phases through walls.

5

Dungeons

Dungeon 1: “Eagle”

10 rooms. Enemies include Stalfos, Keese, Gels, and Zols. Contains a Map pickup. Boss room leads to the Triforce chamber.

Dungeon 2: “Moon”

14 rooms. More complex layout with locked doors, shutter doors (open when all enemies defeated), 2 dark rooms requiring the candle, and Blade Traps. Enemies include Goriyas, Ropes, Keese, Zols, and Bubbles. Contains Map, Compass, and multiple key drops.

Door Types

Open (always passable), Locked (requires a key), Shutter (kill all enemies to open), Wall (impassable).

6

Bosses

Aquamentus (Dungeon 1)

Dragon boss, 6 HP, 32×32 sprite. Fires 3 fireballs in a spread pattern (22.5° spread, up to 6 active at once). Takes 4× damage from bombs.

Dodongo (Dungeon 2)

4 HP, 32×32 sprite. ONLY vulnerable to bombs — all other weapons deal zero damage. Takes 2 damage per bomb, so exactly 2 bombs to kill.

The boss system is architected for 8 total bosses (Aquamentus, Dodongo, Manhandla, Gleeok, Digdogger, Gohma, Patra, Ganon). The framework for all 8 exists, but only 2 are fully playable so far.

7

Secrets & Hidden Mechanics

  • 50 hidden items across the overworld, found by pushing, burning, or bombing
  • Heart Containers hidden behind bombable walls
  • Rupee caches scattered across the map
  • Sword beam only fires at full health
  • Blue Candle limited to once per screen
  • Invincibility frames last 60 frames (1 second) after taking damage
  • 4 enemy drop tables cycle based on kill count (every 10 kills rotates the table)
  • Fairy Fountain provides full healing
8

Game Systems

Save System

3 save slots with localStorage. Tracks death count, inventory, dungeon progress, visited screens, and revealed secrets.

Progression

8 Triforce pieces tracked (1 per dungeon). Dungeon 9 requires all 8. Win condition: rescuing Zelda.

Sound

10 sound effects using Web Audio API with NES-style pulse and noise channels.

Combat

Tile-based collision, knockback on hit (16 frames), boomerang stuns for 60 frames.

HUD

Rupee count, key count, bomb count, heart display, minimap, current B-item, and sword level.

By the Numbers

Overworld screens128 (16×8 grid)
Dungeon rooms24 (10 + 14)
Caves12
Enemy types22
Bosses implemented2 (of 8 architected)
Items & equipment30+
Hidden overworld items50
Sword tiers3
Shops4
NPC types3
Sound effects10
Save slots3
Ralph loops4