Changes

Jump to navigation Jump to search
1,212 bytes removed ,  10:35, 24 April 2009
Line 139: Line 139:       −
</pre>
  −
  −
Alternate Implementation:
  −
<pre>
  −
def supplyReduce():
  −
    global cups, lemons, ice
  −
    if cups != 0:
  −
        cups -= 1
  −
    if lemons != 0:
  −
        lemons -= 1
  −
    if ice != 0:
  −
        ice -= 1
  −
  −
    print "some of your supplys was stolen by ants!"
  −
  −
def makeStuff():
  −
    global cups, lemons, ice
  −
    made = min(cups, lemons, ice )
  −
    cups -= made
  −
    lemons -= made
  −
    ice -= made
  −
  −
    print "You made " + str(made) + " cups of lemonade"
  −
  −
  −
  −
name = 'lemonade stand'
  −
cups = 0
  −
lemons = 0
  −
ice = 0
  −
today = 0
  −
daysToPlay = 0
  −
  −
print "Welcome to " + name
  −
  −
daysToPlay = input("How many days would you like to play for: ")
  −
  −
  −
while today <= daysToPlay:
  −
  −
    print "        "
  −
    print "You have"
  −
    print "cups: " + str(cups)
  −
    print "lemons: " + str(lemons)
  −
    print "ice: " + str(ice)
  −
    print "        "
  −
  −
    try:
  −
  −
        cupsToAdd = input("How many cups do you want to buy? ")
  −
        cups += cupsToAdd
  −
        lemonsToAdd = input("How many lemons do you want to buy? ")
  −
        lemons += lemonsToAdd
  −
        iceToAdd = input("How much ice do you want to buy? ")
  −
        ice += iceToAdd
  −
  −
    except:
  −
        print "dont break my program"
  −
  −
  −
    print "  "
  −
    makeStuff()
  −
    supplyReduce()
  −
    today += 1
   
</pre>
 
</pre>
    
==Design Decisions==
 
==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.
 
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.
27

edits

Navigation menu