Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %%%Don't expect me to know who I am%%%
- %%%%%%%%%%%%JAMES SAMPSON%%%%%%%%%%%%
- %%%%%%Code by The Man Downstairs%%%%%%
- var weather : int %The weather in actuality
- var events : int %This runs probability through a random number generator
- var money : real %Obvy
- var weatherForecast : int %The weather according to the forecast, 60% of the time, its right every time
- var cupsPrice : real %preset value; cups
- var sugarPrice : real %preset value; sugar
- var lemonsPrice : real %preset value; lemons
- var cups : int %num of cups
- var sugar : int %vol of sugar
- var lemons : int %num of lemons
- var itemPurchase : int %confirms purchase of an item
- var buy : string %a pseudoboolean string variable
- var averageTemp : int %average temperature, off of which warm/cold is based
- var enter : string %...the enter key...
- var lemonadeCost : real %don't make me explain this
- var dieSix : int %randint from 1 to 6
- var customers : real %rough number of customers
- var days : int %what day the program is on.
- var materialsGet : string %do we have enough materials?
- var didWeWin : string %did we win?
- % Beginning sequence %
- put "Welcome to the lemonade stand game!"
- drawfillbox (12, 0, 32, 150, 186)
- drawfillbox (593, 0, 613, 150, 186)
- drawfillbox (27, 0, 47, 45, 114)
- drawfillbox (578, 0, 598, 45, 114)
- drawline (25, 45, 10, 150, 114)
- drawline (10, 150, 615, 150, 114)
- drawline (615, 150, 600, 45, 114)
- drawline (600, 45, 25, 45, 114)
- drawfill (140, 140, 114, 114)
- drawfilloval (110, 90, 45, 35, 44)
- drawfilloval (65, 90, 7, 6, 44)
- drawfilloval (155, 90, 7, 6, 44)
- put "How much money do you want to start with?"
- get money
- put "Just kidding!"
- money := 30
- put "You will start with 30 dollars."
- delay (1500)
- cls
- cups := 0
- sugar := 0
- lemons := 0
- put "Here's how this whole operation breaks down, chief."
- put "You'll use the enter button to progress through "
- put "these instructions."
- get enter
- put "Good! Now, this starts out with you buying supplies."
- put "You need 1 paper cup, 1 cup of sugar, and 1 lemon for"
- put "1 cup of lemonade."
- get enter
- put "Next, you'll receive the weather forecast, to help "
- put "you get an idea of how warm it'll be. However, the "
- put "forecast may be wrong."
- get enter
- put "At this point, you set the day's lemonade price."
- get enter
- put "After this, the true weather will be revealed like "
- put "my work ethic at 4am after a good cry following the"
- put ".txt file writeup I did failed to save and the computer"
- put "then crashed. Unfortunately, much like how the best-"
- put "laid text files of mice and men often go unsaved, the"
- put "true weather dictates how many customers you will get."
- get enter
- loop
- %%% Begin buy dialogues %%%
- loop
- cls
- %%%%% Buy display %%%%%
- delay (10)
- drawfillbox (0, 0, 680, 170, 118)
- drawfillbox (12, 0, 32, 150, 186)
- drawfillbox (593, 0, 613, 150, 186)
- drawfillbox (27, 0, 47, 45, 114)
- drawfillbox (578, 0, 598, 45, 114)
- drawline (25, 45, 10, 150, 114)
- drawline (10, 150, 615, 150, 114)
- drawline (615, 150, 600, 45, 114)
- drawline (600, 45, 25, 45, 114)
- drawfill (140, 140, 114, 114)
- drawfilloval (110, 90, 45, 35, 44)
- drawfilloval (65, 90, 7, 6, 44)
- drawfilloval (155, 90, 7, 6, 44)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- put "Buy? y/n?"
- get buy
- if buy = "y" then
- put "okay"
- delay (1500)
- cls
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- put "What do you want to purchase?"
- put "You need at least one cup, one lemon, and one cup of sugar to make a cup of lemonade."
- put "Cups: code 1; sugar: code 2; lemons: code 3."
- get itemPurchase
- if itemPurchase = 1 then
- if money < 5
- put "Sorry, you don't have enough money to buy that!"
- else
- put "Okay, you're purchasing cups."
- delay (500)
- put "100 cups........$5.00"
- delay (500)
- money := (money - 5)
- cups := (cups + 100)
- end if
- elsif itemPurchase = 2 then
- if money < 8 then
- put "Sorry, you don't have enough money to buy that!"
- else
- put "Okay, you're purchasing sugar."
- delay (500)
- put "60 cups sugar...$8.00"
- delay (500)
- money := (money - 8)
- sugar := (sugar + 60)
- end if
- elsif itemPurchase = 3 then
- if money < 4 then
- put "Sorry, you don't have enough money to buy that!"
- else
- put "Okay, you're purchasing lemons."
- delay (500)
- put "30 lemons.......$4.00"
- delay (500)
- money := (money - 4)
- lemons := (lemons + 30)
- end if
- else
- put "I didn't understand that. 1, 2, or 3?"
- end if
- elsif buy = "n" then
- put "darn"
- delay (500)
- else
- put "I didn't understand that. y/n?"
- delay (1000)
- end if
- exit when buy = "n"
- end loop
- %%% The absolute POWER of this lad %%%
- cls
- %%%%% Dashboard %%%%%
- delay (10)
- drawfillbox (0, 0, 680, 170, 118)
- drawfillbox (12, 0, 32, 150, 186)
- drawfillbox (593, 0, 613, 150, 186)
- drawfillbox (27, 0, 47, 45, 114)
- drawfillbox (578, 0, 598, 45, 114)
- drawline (25, 45, 10, 150, 114)
- drawline (10, 150, 615, 150, 114)
- drawline (615, 150, 600, 45, 114)
- drawline (600, 45, 25, 45, 114)
- drawfill (140, 140, 114, 114)
- drawfilloval (110, 90, 45, 35, 44)
- drawfilloval (65, 90, 7, 6, 44)
- drawfilloval (155, 90, 7, 6, 44)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- put "The weather forecast is here."
- %%%% Weather event %%%%
- randint (weather, 1, 25)
- randint (weatherForecast, 1, 6)
- if weather <= 6 then
- weather := weather + weatherForecast
- elsif weather >= 20 then
- weather := weather - weatherForecast
- else
- if weatherForecast <= 2 then
- weatherForecast := weather - weatherForecast
- elsif weatherForecast >= 5 then
- weatherForecast := weather - weatherForecast
- else
- weatherForecast := weather
- end if
- end if
- %%%%% Set average temperature %%%%%
- randint (averageTemp, 19, 24)
- days := 1
- %%%% Specific days' predictions %%%%
- if weatherForecast = 1 then
- put "The forecast calls for ", averageTemp, " degree weather and clear skies."
- elsif weatherForecast = 2 then
- put "The forecast calls for ", (averageTemp - 1), " degree weather and broken clouds."
- elsif weatherForecast = 3 then
- put "The forecast calls for ", (averageTemp + 1), " degree weather and clear skies."
- elsif weatherForecast = 4 then
- put "The forecast calls for ", (averageTemp - 2), " degree weather and occasional clouds."
- elsif weatherForecast = 5 then
- put "The forecast calls for ", averageTemp, " degree weather and clear skies."
- elsif weatherForecast = 6 then
- put "The forecast calls for ", (averageTemp + 2), " degree weather and broken clouds."
- elsif weatherForecast = 7 then
- put "The forecast calls for ", averageTemp, " degree weather and clear skies."
- elsif weatherForecast = 8 then
- put "The forecast calls for ", (averageTemp - 3), " degree weather and clear skies."
- elsif weatherForecast = 9 then
- put "The forecast calls for ", (averageTemp + 3), " degree weather and occasional clouds."
- elsif weatherForecast = 10 then
- put "The forecast calls for ", (averageTemp - 4), " degree weather and broken clouds."
- elsif weatherForecast = 11 then
- put "The forecast calls for ", (averageTemp + 7), " degree weather, a bright sun, and humid air."
- elsif weatherForecast = 12 then
- put "The forecast calls for ", (averageTemp + 4), " degree weather and clear skies."
- elsif weatherForecast = 13 then
- put "The forecast calls for ", averageTemp, " degree weather and clear skies."
- elsif weatherForecast = 14 then
- put "The forecast calls for ", (averageTemp - 3), " degree weather and rain."
- elsif weatherForecast = 15 then
- put "The forecast calls for ", (averageTemp + 3), " degree weather and heavy clouds."
- elsif weatherForecast = 16 then
- put "The forecast calls for ", (averageTemp - 2), " degree weather and broken clouds."
- elsif weatherForecast = 17 then
- put "The forecast calls for ", averageTemp, " degree weather and clear skies."
- elsif weatherForecast = 18 then
- put "The forecast calls for ", (averageTemp + 2), " degree weather and clear skies."
- elsif weatherForecast = 19 then
- put "The forecast calls for ", averageTemp, " degree weather and clear skies."
- elsif weatherForecast = 20 then
- put "The forecast calls for ", (averageTemp - 1), " degree weather and cloudy."
- elsif weatherForecast = 21 then
- put "The forecast calls for ", (averageTemp + 1), " degree weather and rainy weather."
- elsif weatherForecast = 22 then
- put "The forecast calls for ", (averageTemp + 7), " degree weather, a bright sun, and humid air."
- elsif weatherForecast = 23 then
- put "The forecast calls for ", averageTemp, " degree weather and clear skies."
- elsif weatherForecast = 24 then
- put "The forecast calls for ", (averageTemp + 3), " degree weather."
- elsif weatherForecast = 25 then
- put "We are anticipating a tornado. Please remain inside."
- else
- put "An error occurred. Please reload this run window."
- end if
- %%%%% Set lemonade price %%%%%
- put "Now that you know the weather forecast, "
- put "it's time to set your lemonade price."
- get lemonadePrice
- cls
- %%%%%% Specific days' outcomes %%%%%%
- if weather = 1 then
- put "Today will be ", averageTemp, " degrees and clear skies."
- put "But that doesn't matter; your stand was bought by Mr. Moneybags."
- money := 1000000
- lemons := 0
- cups := 0
- sugar := 0
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- days := 30
- elsif weather = 2 then
- put "Today will be ", (averageTemp - 1), " degrees and broken clouds."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.30 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 3 then
- put "Today will be ", (averageTemp + 1), " degrees and clear skies."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.20 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 4 then
- put "Today will be ", (averageTemp - 2), " degrees and occasional clouds."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.35 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 5 then
- put "Today will be ", averageTemp, " degrees and clear skies."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.25 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 6 then
- put "Today will be ", (averageTemp + 2), " degrees and broken clouds."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.15 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 7 then
- put "Today will be ", averageTemp, " degrees and clear skies."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.25 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 8 then
- put "Today will be ", (averageTemp - 3), " degrees and clear skies."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.39 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 9 then
- put "Today will be ", (averageTemp + 3), " degrees and occasional clouds."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.11 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 10 then
- put "Today will be ", (averageTemp - 4), " degrees and broken clouds."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.41 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 11 then
- put "Today will be ", (averageTemp + 7), " degrees, a bright sun, and humid air."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.06 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 12 then
- put "Today will be ", (averageTemp + 4), " degrees and clear skies."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.09 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 13 then
- put "Today will be ", averageTemp, " degrees and clear skies."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.25 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 14 then
- put "Today will be ", (averageTemp - 3), " degrees and rain."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.39 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 15 then
- put "Today will be ", (averageTemp + 3), " degrees and heavy clouds."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.11 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 16 then
- put "Today will be ", (averageTemp - 2), " degrees and broken clouds."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.35 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 17 then
- put "Today will be ", averageTemp, " degrees and clear skies."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.25 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 18 then
- put "Today will be ", (averageTemp + 2), " degrees and clear skies."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.15 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- exit when customers = 0
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- end loop
- elsif weather = 19 then
- put "Today will be ", averageTemp, " degrees and clear skies."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.25 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 20 then
- put "Today will be ", (averageTemp - 1), " degrees and cloudy."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.30 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 21 then
- put "Today will be ", (averageTemp + 1), " degrees and rainy weather."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.20 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 22 then
- put "Today will be ", (averageTemp + 7), " degrees, a bright sun, and humid air."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.06 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 23 then
- put "Today will be ", averageTemp, " degrees and clear skies."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.25 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 24 then
- put "Today will be ", (averageTemp + 3), " degrees."
- randint (dieSix, 1, 6)
- customers := dieSix div (0.15 / lemonadePrice)
- loop
- cls
- customers := customers - 1
- money := money + lemonadePrice
- cups := cups - 1
- lemons := lemons - 1
- sugar := sugar - 1
- delay (250)
- put "Money = ", money, "; cups = ", cups, "; sugar = ", sugar, "; lemons = ", lemons, "."
- exit when customers = 0
- end loop
- elsif weather = 25 then
- cls
- put "Today, a tornado struck. You lost the stand and all your supplies."
- put " _______ _______ __ __ _______ "
- put "| _____| | ___ | | \/ | | _____|"
- put "| | ___ | |___| | | |\ /| | | |___ "
- put "| | |__ | | ___ | | | \/ | | | ___| "
- put "| |___| | | | | | | | | | | |_____ "
- put "|_______| |_| |_| |_| |_| |_______|"
- put " _______ _ _ _______ _______ "
- put "| ___ | | | | | | _____| | ___ | "
- put "| | | | | | | | | |___ | |___| | "
- put "| | | | | | | | | ___| | ___ | "
- put "| |___| | | |_| | | |_____ | | | | "
- put "|_______| |___| |_______| |_| |_|"
- days := 30
- didWeWin := "n"
- else
- put "An error occurred. Please reload this run window."
- end if
- if days = 30 then
- if didWeWin = "y" then
- put "Congratulations! You won!"
- elsif didWeWin = "n" then
- put "You lost."
- else
- if money = 0 then
- put "You went broke."
- else
- put "You finished day 30 with ", money, " dollars."
- end if
- end if
- else
- put "Another day dawns on the lemonade stand."
- end if
- exit when days = 30
- end loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement