Wednesday, April 4, 2012

Lemonade Stand Ported to the Replica 1


I was thinking of some old BASIC games and my wife mentioned one she always liked: Lemonade Stand.  I looked for a port to the Apple 1 / Replica 1 but couldn't find one. There are lots of versions of it around, including some that run in a web browser.

After some digging around I found a version for the Mac that included the original Apple ][ version from 1979 as comments in it's source code. The comments in the BASIC code say that the original program was written by Bob Jamison of the Minnesota educational computing consortium and modified for the Apple ][ by Charlie Kellner in February 1979.

I extracted the original source code from the Mac version and removed anything to do with POKEs, graphics, etc. that was not supported on the Replica 1. After an hour or two I had it up and running.

It needs Applesoft Lite (not the Apple Integer BASIC built into the Replica 1) because it uses a lot of floating point calculations. I suppose it could be ported to the Integer BASIC with some effort. If you want to try it, the code is here.

Below is a transcript of a sample run of the game. It supports multiple players and let's you play until you quit or go bankrupt.

HI! WELCOME TO LEMONSVILLE, CALIFORNIA!


IN THIS SMALL TOWN, YOU ARE IN CHARGE OF
RUNNING YOUR OWN LEMONADE STAND. YOU CAN
COMPETE WITH AS MANY OTHER PEOPLE AS YOU
WISH, BUT HOW MUCH PROFIT YOU MAKE IS UP
TO YOU (THE OTHER STANDS' SALES WILL NOT
AFFECT YOUR BUSINESS IN ANY WAY). IF YOU
MAKE THE MOST MONEY, YOU'RE THE WINNER!!


ARE YOU STARTING A NEW GAME? (YES OR NO)
TYPE YOUR ANSWER AND HIT RETURN ==> Y Y
HOW MANY PEOPLE WILL BE PLAYING ==> 1


TO MANAGE YOUR LEMONADE STAND, YOU WILL 
NEED TO MAKE THESE DECISIONS EVERY DAY: 


1. HOW MANY GLASSES OF LEMONADE TO MAKE (ONLY ONE BATCH IS MADE EACH MORNING)
2. HOW MANY ADVERTISING SIGNS TO MAKE (THE SIGNS COST FIFTEEN CENTS EACH) 
3. WHAT PRICE TO CHARGE FOR EACH GLASS 


YOU WILL BEGIN WITH $2.00 CASH (ASSETS).
BECAUSE YOUR MOTHER GAVE YOU SOME SUGAR,
YOUR COST TO MAKE LEMONADE IS TWO CENTS 
A GLASS (THIS MAY CHANGE IN THE FUTURE).


PRESS SPACE TO CONTINUE, ESC TO END...


YOUR EXPENSES ARE THE SUM OF THE COST OF
THE LEMONADE AND THE COST OF THE SIGNS. 


YOUR PROFITS ARE THE DIFFERENCE BETWEEN 
THE INCOME FROM SALES AND YOUR EXPENSES.


THE NUMBER OF GLASSES YOU SELL EACH DAY 
DEPENDS ON THE PRICE YOU CHARGE, AND ON 
THE NUMBER OF ADVERTISING SIGNS YOU USE.


KEEP TRACK OF YOUR ASSETS, BECAUSE YOU 
CAN'T SPEND MORE MONEY THAN YOU HAVE! 


PRESS SPACE TO CONTINUE, ESC TO END...


LEMONSVILLE WEATHER REPORT:
  SUNNY


PRESS SPACE TO CONTINUE, ESC TO END...


ON DAY 1, THE COST OF LEMONADE IS $.02


LEMONADE STAND 1 ASSETS: $2.00


HOW MANY GLASSES OF LEMONADE DO YOU
WISH TO MAKE ?30


HOW MANY ADVERTISING SIGNS (15 CENTS
EACH) DO YOU WANT TO MAKE ?1


WHAT PRICE (IN CENTS) DO YOU WISH TO
CHARGE FOR LEMONADE ?25
WOULD YOU LIKE TO CHANGE ANYTHING?N


** LEMONSVILLE DAILY FINANCIAL REPORT **


DAY 1  STAND 1


6 GLASSES SOLD


$.25 PER GLASS, INCOME $1.50


30 GLASSES MADE


1 SIGNS MADE, EXPENSES $.75


PROFIT: $.75
ASSETS: $2.75


PRESS SPACE TO CONTINUE, ESC TO END...


LEMONSVILLE WEATHER REPORT:
  SUNNY


PRESS SPACE TO CONTINUE, ESC TO END...


ON DAY 2, THE COST OF LEMONADE IS $.02


LEMONADE STAND 1 ASSETS: $2.75


HOW MANY GLASSES OF LEMONADE DO YOU
WISH TO MAKE ?20


HOW MANY ADVERTISING SIGNS (15 CENTS
EACH) DO YOU WANT TO MAKE ?1


WHAT PRICE (IN CENTS) DO YOU WISH TO
CHARGE FOR LEMONADE ?14
WOULD YOU LIKE TO CHANGE ANYTHING?N


** LEMONSVILLE DAILY FINANCIAL REPORT **


DAY 2  STAND 1


20 GLASSES SOLD


$.14 PER GLASS, INCOME $2.80


20 GLASSES MADE


1 SIGNS MADE, EXPENSES $.55


PROFIT: $2.25
ASSETS: $5.00


PRESS SPACE TO CONTINUE, ESC TO END...


LEMONSVILLE WEATHER REPORT:
  SUNNY


PRESS SPACE TO CONTINUE, ESC TO END...


WOULD YOU LIKE TO PLAY AGAIN?N

No comments:

Post a Comment