Using an LLM to port Lemonade Stand
I used Claude to port the classic Apple II game - Lemonade Stand - to the browser.
Back in primary/grade school, I was fortunate enough to have a teacher with an Apple II computer that she would setup for us in class. A couple of times each week we would split into teams and play the classic Apple II business simulation - Lemonade Stand.
A couple of weeks ago my son asked what technology was like the “old days” so I showed him Lemonade Stand (you can play an emulated version on the Internet Archive site as well as see the original AppleSoft Basic source code). The emulator is quite good but it’s a bit resource hungry after playing a few rounds.
I’ve had some fun lately - as we all have - using LLMs for various coding tasks. I thought “maybe I can use Anthropic’s Claude to port the game to the browser”. I found the source code on GitHub and the game logic itself looked reasonably straightforward to port. What I wasn’t sure of was how well it would handle porting the graphics and sound. The graphics used AppleSoft Basic’s Low-Resolution Graphics Commands and the sound effects and background music seemed to be machine code subroutines programmed using the POKE command.
Anyway, I set off with this prompt:
The code for the classic Apple II game - “Lemonade Stand”, written in AppleSoft Basic is here: https://gist.githubusercontent.com/badvision/16b74ade3a8b2fa2e87d/raw/d8afde0522db3a06f169f3bc50503bb2fc7e961f/lemonade_stand.bas
Can you convert the game to run in a web browser using TypeScript and Node.js?
Note that some of the data in the program is used for sound effects and background music. The AppleSoft Basic POKE command is used to write data to a memory location that will result in a sound being played.
It uses various AppleSoft Basic low-resolution graphics commands such as HLIN and VLIN to draw cut-scenes on an Apple II monitor.
An Apple II monitor was designed to display 80 characters by 24 lines.
Good, I have enough context about the game mechanics. Now let me fetch the actual source code from the gist. I now have the full source code. Let me build this as a faithful web port. This is a substantial project — I’ll create a complete single HTML file with all game logic, pixel-art graphics rendered on canvas (mimicking the Apple II lo-res 40×40 grid), Web Audio API for sound, and the classic green-phosphor terminal aesthetic.
Here’s your browser port of Lemonade Stand! It’s a self-contained HTML file — just open it in any modern browser. Here’s what was faithfully recreated and how each Apple II feature was handled:
Graphics (GR mode) The Apple II’s 40×40 lo-res graphics grid is emulated on an HTML5 Canvas using the exact 16-color Apple II palette. HLIN/VLIN/PLOT commands are all implemented. Weather scenes are drawn procedurally: sunny (yellow sun with rays), hot & dry (orange sun + heat shimmer), cloudy (white cloud blobs), and thunderstorm (dark clouds + animated lightning bolt flashes).
Sound & Music The POKE 768 / POKE 769 / CALL 770 sound engine is approximated using the Web Audio API. The Apple II speaker worked by toggling at a frequency derived from the byte value — this is mapped to square-wave oscillators at equivalent pitches. All four weather theme songs (sunny, hot/dry, cloudy, storm) play as the scenes appear. The financial report chime and thunderclap (using noise buffer + lowpass filter) are also included.
Game Mechanics — fully ported:
12-day game loop with 1–30 players
Lemonade cost increases on day 3 (4¢) and day 7 (5¢)
Demand formula from the original: price elasticity × sign advertising effect × weather multiplier
All random events: street crew (cuts traffic or buys everything), heat wave (doubles sales), light rain (reduces demand proportionally), thunderstorm (wipes out profits)
Bankruptcy detection and “play again” loop
New game / continue old game paths
Terminal aesthetic Green phosphor CRT with scanline overlay, vignette, and the monitor bezel — styled to look like an actual Apple II monitor.
I was particularly impressed by how it was able to convert the sound routines and how cleanly it had arranged the various JavaScript functions used during gameplay.
You can check out the port of Lemonade Stand in my repo on GitHub or play it hosted on GitHub Pages.
Enjoy!!


