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.
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.


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.


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.


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.


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.


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.

A closer look at the content Ralph generated, pulled from the actual game source.
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).
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
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.
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
Other Caves
Hint cave ("EASTMOST PENNINSULA IS THE SECRET."), Fairy Fountain (heals), Money Making Game (costs 10 rupees to play).
10 Overworld Enemies
Walk randomly, shoot rocks. Blue: 2 HP vs red's 1.
Hop around. Blue homes toward the player.
Walk and shoot arrows. Blue: 3 HP, moves faster.
Emerges from the ground. 2 HP, 2 contact damage.
Flies in a wobble pattern, only vulnerable when stopped.
Emerges from water, shoots fireballs.
The deadliest overworld enemy: 4 HP, 4 contact damage, shoots sword beams.
12 Dungeon Enemies
Flying bats, 1 HP, can't be knocked back.
Tiny 8×8 enemies, 1 HP.
Standard skeleton, 2 HP.
Throws a returning boomerang, 3 HP.
Sits idle then dashes when in line of sight (64px trigger, 3× speed).
2 HP, splits into 2 Green Gels on death.
Completely invulnerable, disables your sword on contact.
Invulnerable, charges at speed 3 when aligned, returns at half speed.
3 HP, can't be stunned, only vulnerable from certain directions.
3 HP, teleports near player, shoots magic beams, phases through walls.
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).
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.
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.