User Tools

Site Tools


wiki:coffeemakerpro

Coffee Maker Pro This is my newest Python project. Run your own coffee shop for 7 days and see if you can turn a profit!

It's still in the build process, but should be fully running within a few days.

# coffeeshop game
# use random for interacting with various lists
# lists include:
# time of day = morning has higher volume
# customer preference for coffee = more want average brew
# customer preference for cream, sugar, and flavorings = can charge for flavorings but cream & sugar adds to cost
# fixed expenses like rent, utilities, salary not included
# calculate the cost of each cup and setup price to sell
# selling old coffee, or over-charging for coffee, or running out of coffee, creates unhappy customers - which lowers traffic
# tally sales and expenses for the week to determine profitability
# get a grade on your performance: INC Magazine's Rising Star, Forbes Best New Startups

from random import randint
import datetime


# each turn advances time 30 minutes
# "brew medium" brews 1 pot of medium coffee, available next turn
# no action required per turn, just press enter
# each coffee maker has 2 drip-through style glass pots, like a basic Bunn coffee maker
# all cups same size, 12 oz
# each cup sold gets a lid
# a bag of coffee makes 60 12 oz cups
# a bag of cups has 50 cups
# a bag of cup lids has 50 cup lids
# a box of hot wrappers has 50 hot wrappers
# a box of stir stix has 500 stir stix
# assumption = if cream and sugar are ordered, it's at a 1:2 ratio, 1 serving cream to 2 servings sugar, and stir stix included
# a can of powdered non-dairy creamer has 200 servings
# a can of sugar has 100 servings
# flavorings are 50 servings per bottle

# set the variables
account = 200.00
day = 0
# timeOfDay = datetime.time(5,0,0)
cheapCoffeeBagCost = 3.75
cheapCoffeeServingInventory = 0

averageCoffeeBagCost = 5.50
averageCoffeeServingInventory = 0

premiumCoffeeBagCost = 8.25
premiumCoffeeServingInventory = 0

extraCoffeeMaker = 125.00
coffeeMakers = 1
coffeeMaker1 = [1, 1]
coffeeMaker2 = [0, 0]
coffeeMaker3 = [0, 0]

cupsBag = 7.00
cupsInventory = 0

cupLidsBag = 3.50
cupLidsInventory = 0

hotWrappersBox = 2.00
hotWrappersInventory = 0

stirStixBox = 3.00
stirStixInventory = 0

creamerCan = 3.00
creamerInventory = 0

sugarCan = 3.00
sugarInventory = 0

chocolateFlavorBottle = 12.75
chocolateInventory = 0

almondFlavorBottle = 12.75
almondInventory = 0

hazelnutFlavorBottle = 12.75
hazelnutInventory = 0

# setup the showRules() function
def showRules():
    print("\nYou have a great location, but there are two competing coffeeshops nearby.\nStarco focuses on premium coffee at high prices.\nCoffeeCommander goes for low quality gas station coffee at average prices.")
    print("Your hours of operation are from 5am to 10pm, so becareful not to serve old coffee if business gets slow.")
    print("You have a paid-for store, a volunteer employee, and a 2 pot drip coffeemaker.")
    print("You start off with $200.00 from your own savings for inventory and equipment.")
    print("Each turn in the game is 30 minutes of game time.")
    print("At the beginning of each turn, you'll see the orders made in the last half hour and current inventory.")
    print("At the end of the day you have the option of placing an inventory order.")
    print("Selling old coffee, running out of coffee, or selling over-priced coffee\nwill create unhappy customers and lowers traffic.")
    print("If you run out of money for inventory, you are out of business.")
    return



# setup getInventory() function
def showInventory():
    print("\nCurrent inventory. Amount of coffee available is shown as numbers of cups.\nCream, sugar and flavorings are by serving.")
    print(f"You have {coffeeMakers} coffee makers and {coffeeMakers * 2} pots.")
    print(f"Cheap Coffee   = {cheapCoffeeServingInventory} cups\t| 12 oz cups   = {cupsInventory}\t| Chocolate flavoring = {chocolateInventory}\t| Creamer = {creamerInventory}")
    print(f"Average Coffee = {averageCoffeeServingInventory} cups\t| Lids         = {cupLidsInventory}\t| Almond flavoring    = {almondInventory}\t| Sugar   = {sugarInventory}")
    print(f"Premium Coffee = {premiumCoffeeServingInventory} cups\t| Hot Wrappers = {hotWrappersInventory}\t| Hazelnut Flavoring  = {hazelnutInventory}")
    print(f"\t\t\t| Stir Stix    = {stirStixInventory}\t|\n\n")
    return



# setup the showPriceList function
def showPriceList():
    print("Price List")
    print(f"Additional coffee maker (with 2 pots) = {extraCoffeeMaker:.2f}")
    print(f"Bag of Cheap Coffee (60 serving)      = {cheapCoffeeBagCost:.2f}")
    print(f"Bag of Average Coffee (60 serving)    = {averageCoffeeBagCost:.2f}")
    print(f"Bag of Premium Coffee (60 serving)    = {premiumCoffeeBagCost:.2f}")
    print(f"Bag of 12 oz Cups (50 count)          = {cupsBag:.2f}")
    print(f"Bag of 12 oz Cup Lids (50 count)      = {cupLidsBag:.2f}")
    print(f"Box of Hot Cup Wrappers (50 count)    = {hotWrappersBox:.2f}")
    print(f"Box of Stir Stix (500 count)          = {stirStixBox:.2f}")
    print(f"Can of Sugar (100 servings)           = {sugarCan:.2f}")
    print(f"Can of Non-Dairy Creamer              = {creamerCan:.2f}")
    print(f"Bottle of Chocolate Flavoring (50 serving) = {chocolateFlavorBottle:.2f}")
    print(f"Bottle of Almond Flavoring (50 serving)    = {almondFlavorBottle:.2f}")
    print(f"Bottle of Hazelnut Flavoring (50 serving)  = {hazelnutFlavorBottle:.2f}")
    return

def orderCoffeeMaker():
    global account
    global extraCoffeeMaker
    global coffeeMakers
    if account >= extraCoffeeMaker:
        coffeeMakers += 1
        account -= extraCoffeeMaker
        print(f"You now have {coffeeMakers} coffee makers and {coffeeMakers * 2} pots. Your new balance is ${account:.2f}")
    else:
        print("You don't have enough in your account. Item not ordered.")
    return

def orderCheapCoffee(bags):
    global account
    global cheapCoffeeBagCost
    global cheapCoffeeServingInventory
    if account >= (cheapCoffeeBagCost * bags):
        cheapCoffeeServingInventory += (bags * 60)
        account -= (cheapCoffeeBagCost * bags)
        print(f"You now have {cheapCoffeeServingInventory} servings of Cheap Coffee. Your new balance is ${account:.2f}")
    else:
        print("You don't have enough in your account.  Item not ordered.")
    return
    
def orderAverageCoffee(bags):
    global account
    global averageCoffeeBagCost
    global averageCoffeeServingInventory
    if account >= (averageCoffeeBagCost * bags):
        averageCoffeeServingInventory += (bags * 60)
        account -= (averageCoffeeBagCost * bags)
        print(f"You now have {averageCoffeeServingInventory} servings of Average Coffee. Your new balance is ${account:.2f}")
    else:
        print("You don't have enough in your account.  Item not ordered.")
    return

def orderPremiumCoffee(bags):
    global account
    global premiumCoffeeBagCost
    global premiumCoffeeServingInventory
    if account >= (premiumCoffeeBagCost * bags):
        premiumCoffeeServingInventory += (bags * 60)
        account -= (premiumCoffeeBagCost * bags)
        print(f"You now have {premiumCoffeeServingInventory} servings of Premium Coffee. Your new balance is ${account:.2f}")
    else:
        print("You don't have enough in your account.  Item not ordered.")
    return

def orderCups(bags):
    global account
    global cupsBag
    global cupsInventory
    if account >= (cupsBag * bags):
        cupsInventory += (bags * 50)
        account -= (cupsBag * bags)
        print(f"You now have {cupsInventory} servings of 12 oz Cups. Your new balance is ${account:.2f}")
    else:
        print("You don't have enough in your account.  Item not ordered.")
    return

def orderCupLids(bags):
    global account
    global cupLidsBag
    global cupLidsInventory
    if account >= (cupLidsBag * bags):
        cupLidsInventory += (bags * 60)
        account -= (cupLidsBag * bags)
        print(f"You now have {cupLidsInventory} 12oz Lids. Your new balance is ${account:.2f}")
    else:
        print("You don't have enough in your account.  Item not ordered.")
    return

def orderHotCupWrappers(boxes):
    global account
    global hotWrappersBox
    global hotWrappersInventory
    if account >= (hotWrappersBox * boxes):
        hotWrappersInventory += (boxes * 60)
        account -= (hotWrappersBox * boxes)
        print(f"You now have {hotWrappersInventory} hot wrappers for coffee cups. Your new balance is ${account:.2f}")
    else:
        print("You don't have enough in your account.  Item not ordered.")
    return


def orderStirStix(boxes):
    global account
    global stirStixBox
    global stirStixInventory
    if account >= (stirStixBox * boxes):
        stirStixInventory += (boxes * 60)
        account -= (stirStixBox * boxes)
        print(f"You now have {stirStixInventory} Stir Stixs. Your new balance is ${account:.2f}")
    else:
        print("You don't have enough in your account.  Item not ordered.")
    return

def orderSugarCans(cans):
    global account
    global sugarCan
    global sugarInventory
    if account >= (sugarCan * cans):
        sugarInventory += (cans * 100)
        account -= (sugarCan * cans)
        print(f"You now have {sugarInventory} servings of Sugar. Your new balance is ${account:.2f}")
    else:
        print("You don't have enough in your account.  Item not ordered.")
    return


def orderCreamerCan(cans):
    global account
    global creamerCan
    global creamerInventory
    if account >= (creamerCan * cans):
        creamerInventory += (cans * 100)
        account -= (creamerCan * cans)
        print(f"You now have {creamerInventory} servings of Creamer. Your new balance is ${account:.2f}")
    else:
        print("You don't have enough in your account.  Item not ordered.")
    return

def orderChocolateFlavor(bottles):
    global account
    global chocolateFlavorBottle
    global chocolateInventory
    if account >= (chocolateFlavorBottle * bottles):
        chocolateInventory += (bottles * 100)
        account -= (chocolateFlavorBottle * bottles)
        print(f"You now have {chocolateInventory} servings of Chocolate Flavor. Your new balance is ${account:.2f}")
    else:
        print("You don't have enough in your account.  Item not ordered.")
    return

def orderAlmondFlavor(bottles):
    global account
    global almondFlavorBottle
    global almondInventory
    if account >= (almondFlavorBottle * bottles):
        almondInventory += (bottles * 100)
        account -= (almondFlavorBottle * bottles)
        print(f"You now have {almondInventory} servings of Almond Flavor. Your new balance is ${account:.2f}")
    else:
        print("You don't have enough in your account.  Item not ordered.")
    return


def orderHazelnutFlavor(bottles):
    global account
    global hazelnutFlavorBottle
    global hazelnutInventory
    if account >= (hazelnutFlavorBottle * bottles):
        hazelnutInventory += (bottles * 100)
        account -= (almondFlavorBottle * bottles)
        print(f"You now have {hazelnutInventory} servings of Hazelnut Flavor. Your new balance is ${account:.2f}")
    else:
        print("You don't have enough in your account.  Item not ordered.")
    return


####################
# Start of program #
####################

print("Coffeeshop Pro")
print("Run your own shop for 7 days and see if you're profitable.")
yesNo = str(input("Enter 'yes' to see the rules, or anything else to get started."))
if yesNo == "yes" or yesNo == "Yes" or yesNo == "YES" or yesNo == "y" or yesNo == "Y":
    showRules()

# Print the name of the coffee shop with a box around it
i="-"
j="|"
k=" "
l = "Welcome to "

playerName = str(input("Now enter your name and we'll setup your shop."))
if playerName[-1] == "s":
    coffeeShopName = playerName + "' Coffee Bistro"
else:
    coffeeShopName = playerName + "'s Coffee Bistro"    

print()
print(i*((len(l) + len(coffeeShopName))+4))
print(j + k + l + coffeeShopName + k + j)
print(i*((len(l) + len(coffeeShopName))+4))

#print("\n\nWelcome to " + coffeeShopName)
# End of printing the name of the coffee shop

print("Your current account balance is:", account)


showInventory()

showPriceList()

print("\nOrder your inventory")
print(f"You have ${account:.2f}")

# Order a Coffee Maker
yesNo = str(input("Enter 'yes' if you would like to order another coffee maker, or anything else to continue."))
if yesNo == "yes" or yesNo == "Yes" or yesNo == "YES" or yesNo == "y" or yesNo == "Y":
    orderCoffeeMaker()

# Order Cheap Coffee
bags = int(input("How many bags of Cheap Coffee do you want to buy? "))
if bags > 0:
    orderCheapCoffee(bags)
else:
   pass


# Order Average Coffee
bags = int(input("How many bags of Average Coffee do you want to buy? "))
if bags > 0:
    orderAverageCoffee(bags)
else:
   pass

# Order Premium Coffee
bags = int(input("How many bags of Premium Coffee do you want to buy? "))
if bags > 0:
    orderPremiumCoffee(bags)
else:
   pass

# Order Cups
bags = int(input("How many bags of Cups do you want to buy? "))
if bags > 0:
    orderCups(bags)
else:
   pass

# Order Cup Lids
bags = int(input("How many bags of Cup Lids do you want to buy? "))
if bags > 0:
    orderCupLids(bags)
else:
   pass

# Order Hot Cup Wrappers
boxes = int(input("How many boxes of Hot Cup Wrappers do you want to buy? "))
if boxes > 0:
    orderHotCupWrappers(boxes)
else:
   pass

# Order Stir Stix
boxes = int(input("How many boxes of Stir Stix do you want to buy? "))
if boxes > 0:
    orderStirStix(boxes)
else:
   pass

# Order Sugar Canisters
cans = int(input("How many canisters of Sugar do you want to buy? "))
if cans > 0:
    orderSugarCans(cans)
else:
   pass

# Order Creamer Canisters
cans = int(input("How many canisters of Non-Dairy Creamer do you want to buy? "))
if cans > 0:
    orderCreamerCan(cans)
else:
   pass

# Order Chocolate Flavor Bottles
bottles = int(input("How many bottles of Chocolate Flavor do you want to buy? "))
if bottles > 0:
    orderChocolateFlavor(bottles)
else:
   pass

# Order Almond Flavor Bottles
bottles = int(input("How many bottles of Almond Flavor do you want to buy? "))
if bottles > 0:
    orderAlmondFlavor(bottles)
else:
   pass

# Order Hazelnut Flavor Bottles
bottles = int(input("How many bottles of Hazelnut Flavor do you want to buy? "))
if bottles > 0:
    orderHazelnutFlavor(bottles)
else:
   pass


showInventory()

# compute the cost of a cup of coffee
cupLidWrapperCost = (cupsBag / 50) + (cupLidsBag / 50) + (hotWrappersBox / 50)
creamSugarStirStixCost = (creamerCan / 200) + (sugarCan / 100) + (stirStixBox / 500)
chocolateFlavorCost = (chocolateFlavorBottle / 50)
almondFlavorCost = (almondFlavorBottle / 50)
hazelnutFlavorCost = (hazelnutFlavorBottle / 50)
basicCheapCup = ((cheapCoffeeBagCost / 60) + cupLidWrapperCost)
basicAverageCup = ((averageCoffeeBagCost / 60) + cupLidWrapperCost)
basicPremiumCup = ((premiumCoffeeBagCost / 60) + cupLidWrapperCost)
print(f"Your cost for a black cup of cheap coffee   = ${basicCheapCup:.2f}")
print(f"Your cost for a black cup of average coffee = ${basicAverageCup:.2f}")
print(f"Your cost for a black cup of premium coffee = ${basicPremiumCup:.2f}")
print(f"Cream, sugar and a stir stix will add       = ${creamSugarStirStixCost:.2f}")
print(f"Chocolate flavoring will add                = ${chocolateFlavorCost:.2f}")
print(f"Almond flavoring will add                   = ${almondFlavorCost:.2f}")
print(f"Hazelnut flavoring will add                 = ${hazelnutFlavorCost:.2f}")

day += 1
print(f"Day {day} open for business!")
wiki/coffeemakerpro.txt · Last modified: 2019/08/18 17:50 by paul