Difference between revisions of "Lemonade Stand"
Line 82: | Line 82: | ||
#Generisize the names of supplys to make it easily editable | #Generisize the names of supplys to make it easily editable | ||
− | name = 'Lemonade Stand' | + | #[0] = name of the stand, [1] = first supply, [2] = second supply, [3] = third supply, [4] = the object that is being sold |
− | + | variables = ['Lemonade Stand','cups','lemons','sugar','cups'] | |
− | |||
− | |||
− | |||
− | print 'Welcome to ' + | + | print 'Welcome to ' + variables[0] |
Line 125: | Line 122: | ||
print "" | print "" | ||
+ | |||
+ | #Decreases currently the supplys by 10% each day | ||
def supply_Decay(): | def supply_Decay(): | ||
global stored_sugar, stored_lemons, stored_cups | global stored_sugar, stored_lemons, stored_cups | ||
Line 167: | Line 166: | ||
− | print "You have "+`stored_cups`+ " " + | + | print "You have "+`stored_cups`+ " " + variables[1] + ", " +`stored_lemons`+ " " + variables[2] + ", and "+`stored_sugar`+ " " + variables[3] + " left." |
− | print | + | print variables[1] + " price: $" + `cup_price` + " " + variables[2] + " price: $"+ "%.2f" % lemon_price + " " + variables[3] + " price: $"+ "%.2f" % sugar_price |
expenses = 0 | expenses = 0 | ||
Line 181: | Line 180: | ||
potential_expense = 0 | potential_expense = 0 | ||
− | in_num = take_input("How many " + | + | in_num = take_input("How many " + variables[1]) |
potential_expense = expenses + (in_num * cup_price) | potential_expense = expenses + (in_num * cup_price) | ||
Line 189: | Line 188: | ||
stored_cups += in_num | stored_cups += in_num | ||
else: | else: | ||
− | print 'You cant afford that many ' + | + | print 'You cant afford that many ' + variables[1] |
cost_over = 1 | cost_over = 1 | ||
Line 196: | Line 195: | ||
potential_expense = 0 | potential_expense = 0 | ||
− | in_num = take_input("How many " + | + | in_num = take_input("How many " + variables[2]) |
potential_expense = expenses + (in_num * cup_price) | potential_expense = expenses + (in_num * cup_price) | ||
Line 204: | Line 203: | ||
stored_lemons += in_num | stored_lemons += in_num | ||
else: | else: | ||
− | print 'You cant afford that many ' + | + | print 'You cant afford that many ' + variables[2] |
cost_over = 1 | cost_over = 1 | ||
Line 211: | Line 210: | ||
potential_expense = 0 | potential_expense = 0 | ||
− | in_num = take_input("How much " + | + | in_num = take_input("How much " + variables[3]) |
potential_expense = expenses + (in_num * cup_price) | potential_expense = expenses + (in_num * cup_price) | ||
Line 220: | Line 219: | ||
else: | else: | ||
− | print 'You cant afford that many ' + | + | print 'You cant afford that many ' + variables[3] |
today = min(stored_cups, stored_lemons, stored_sugar) | today = min(stored_cups, stored_lemons, stored_sugar) | ||
Line 238: | Line 237: | ||
stored_lemons -= sales | stored_lemons -= sales | ||
stored_sugar -= sales | stored_sugar -= sales | ||
− | print `sales`+" | + | print `sales`+ ' ' + variables[4]+ " made for $"+ "%.2f" % expenses |
profit = sales * product_price | profit = sales * product_price | ||
− | print `sales`+ " " + | + | print `sales`+ " " + variables[4] +" were sold today for $"+ "%.2f" % profit |
print "You made $"+ "%.2f" % (profit - expenses)+" today." | print "You made $"+ "%.2f" % (profit - expenses)+" today." | ||
bank += profit - expenses | bank += profit - expenses |
Revision as of 10:28, 1 May 2009
Description
This is your basic "Lemonade Stand" style game, where the player manages a lemonade stand (or similar such store) and tries to make as much money as possible. The game is designed to incorporate money and fractional math skills to teach basic operations.
We plan to begin with a basic framework, e.g. text based command line, and work up based on free time. Ideally, the game will consist of graphics and a refined GUI front end, similar in look to the currently available flash implementations of Lemonade Stand (although more simplistic, being based in Python).
Localization will be implemented in the final phase, with the stand being written to use more regional ingredients and products.
Goals
We're looking to create a workable prototype with the ability to buy materials and sell a product.However, the most important goal is to have a working game. While possibly not feature complete, the game should have basic functions working.
Extra Features
Based on available time:
- Creating a GUI based game
- Incorporating counting of money (bills and coins) to make change
- Creating seasons to vary prices and product demand
- Possibly making materials perishable to increase difficulty
- Making an intuitive program that can be easily learned, and which has replay value
- Weather patterns impacting sales
- Advanced mode: changing the recipe for your "lemonade"
- Bargaining/haggling
- Random events that may influence supplies and/or cost and/or customers
- Potential use of network, competitive or cooperative modes
- Choosing location of Lemonade Stand within the town, would influence sales, cost of supplies, etc.
- Cool Random Events:
Ants steal your supplies
-10% sugar
A lemon truck crashes in front of your stand
+10 lemons
Potential Problems
Localization is likely to be a big problem in this game. Not simply translating the words, but also translating the idea, ie. finding out what kind of shop would be reasonable to open in a country, what it might stock, etc.
Updates and Milestones
Updates:
4/28: Wiki reorganized, content added
Milestones:
4/24: Have everyone look at the current implementations.
5/1: produce a basic 'sugarized' build to work from. Implement price fluctuations.
5/8: Move to a 'graphical interface' based off of pyGTK or pygame. Add any art we have managed to collect where it seems appropriate.
Design Decisions
Is lemonade made at the beginning of the day (make all available lemonade at once) or on the fly (a customer asks for lemonade and it is made for them)? This is important as it impacts the resources from day to day. In the former, normally non-perishable objects like cups will be used if they can make another drink (even beyond demand), however in the latter, it makes the game easy if you stock up on resources and slowly sell them each day. This is usually mitigated by having perishable resources (lemons, etc) and variable prices.
Educational Standards
4.N.4 Select, use, and explain models to relate common fractions and mixed numbers (1/2, 1/3, 1/4, 1/5, 1/6, 1/8, 1/10, 1/12, and 11/2), find equivalent fractions, mixed numbers, and decimals, and order fractions
4.N.6 Exhibit an understanding of the base ten number system by reading, naming, and writing decimals between 0 and 1 up to the hundredths.
4.N.10 Select and use appropriate operations (addition, subtraction, multiplication, and division) to solve problems, including those involving money.
4.D.3 Construct, draw conclusions, and make predictions from various representations of data sets, including tables, bar graphs, pictographs, line graphs, line plots, and tallies
Contacts
Links and Resources
Coming soon!
Code so far
#!/usr/env python # -*- coding: cp1252 -*- import random #Generisize the names of supplys to make it easily editable #[0] = name of the stand, [1] = first supply, [2] = second supply, [3] = third supply, [4] = the object that is being sold variables = ['Lemonade Stand','cups','lemons','sugar','cups'] print 'Welcome to ' + variables[0] def take_input(text, default = 0): try: in_text = input(text+" ["+`default`+"]: ") except: return default if in_text < 0: in_text = 0 return in_text def random_Event(): global stored_sugar, stored_lemons, stored_cups event = random.randint(0, 10) if event == 0: if stored_sugar > 10: stored_sugar -= 10 print 'Ants steal your supplies!' else: stored_sugar = 0 elif event == 1: print 'A lemon truck crashes in front of your stand!' stored_lemons += 10 elif event == 2: print 'It starts raining cups!' stored_cups += 10 print "" #Decreases currently the supplys by 10% each day def supply_Decay(): global stored_sugar, stored_lemons, stored_cups if stored_sugar > 0: stored_sugar -= 10 % stored_sugar if stored_lemons > 0: stored_lemons -= 10 % stored_lemons if stored_cups > 0: stored_cups -= 10% stored_cups return -1 # default values cup_price = .25 lemon_price = 1.00 sugar_price = .05 product_price = 1.50 #starting resources bank = 100 stored_cups = 0 stored_lemons = 0 stored_sugar = 0 # take in input num_days = take_input("How many days would you like to play for?", 30) for day in range(1, num_days + 1): print "" print "____________________" print " Day number " + `day` print "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯" print "" random_Event() print "You have "+`stored_cups`+ " " + variables[1] + ", " +`stored_lemons`+ " " + variables[2] + ", and "+`stored_sugar`+ " " + variables[3] + " left." print variables[1] + " price: $" + `cup_price` + " " + variables[2] + " price: $"+ "%.2f" % lemon_price + " " + variables[3] + " price: $"+ "%.2f" % sugar_price expenses = 0 cost_over = 1 #Checks to make sure you dont go over your bank amount while buying. while cost_over == 1: potential_expense = 0 in_num = take_input("How many " + variables[1]) potential_expense = expenses + (in_num * cup_price) if potential_expense < bank: cost_over = -1 expenses += in_num * cup_price stored_cups += in_num else: print 'You cant afford that many ' + variables[1] cost_over = 1 while cost_over == 1: potential_expense = 0 in_num = take_input("How many " + variables[2]) potential_expense = expenses + (in_num * cup_price) if potential_expense < bank: cost_over = -1 expenses += in_num * lemon_price stored_lemons += in_num else: print 'You cant afford that many ' + variables[2] cost_over = 1 while cost_over == 1: potential_expense = 0 in_num = take_input("How much " + variables[3]) potential_expense = expenses + (in_num * cup_price) if potential_expense < bank: cost_over = -1 expenses += in_num * sugar_price stored_sugar += in_num else: print 'You cant afford that many ' + variables[3] today = min(stored_cups, stored_lemons, stored_sugar) # Option 1: make maximum available #stored_cups -= today #stored_lemons -= today #stored_sugar -= today #print `today`+" cups made for $"+`expenses` #default value requested_sales = 5 sales = max(min(today, requested_sales),0) # Option 2: make as many as requested stored_cups -= sales stored_lemons -= sales stored_sugar -= sales print `sales`+ ' ' + variables[4]+ " made for $"+ "%.2f" % expenses profit = sales * product_price print `sales`+ " " + variables[4] +" were sold today for $"+ "%.2f" % profit print "You made $"+ "%.2f" % (profit - expenses)+" today." bank += profit - expenses print "Current funds: $"+ "%.2f" % bank supply_Decay() print print "Done!"