Abdulg

Lobster Pots: Python Edition

Dec 23rd, 2013
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.08 KB | None | 0 0
  1. from random import randint #I did this for you, Jonas
  2. print"Lobster Pots: Python Edition"
  3. Days = 7
  4. Lobsters = 0
  5. Pots = 0
  6. Money = 100
  7.  
  8. while Days > 0:
  9.     Boundary = randint(6,11)
  10.     FirstRoll = randint(1,6)
  11.     LobsterPrice = randint(15,29)
  12.     PotPrice = randint(24,36)
  13.     print"You currently have", Days, "days left, $", Money, ",", Pots,"pots, and", Lobsters,"lobsters."
  14.     print"Weather report:"
  15.     print"The weatherman has rolled a", FirstRoll, ". A", Boundary, "is needed for a storm today."
  16.     print"Market report:"
  17.     print"Today, lobsters are selling for $", LobsterPrice, "and pots are selling for $", PotPrice, "."
  18.    
  19.     if Lobsters > 0:
  20.         print"How many lobsters would you like to sell?"
  21.         LobstersSelling = int(raw_input("> "))
  22.         if LobstersSelling <= Lobsters:
  23.             print"You sell", LobstersSelling, "lobsters for $", LobstersSelling * LobsterPrice, "."
  24.             Money += LobsterPrice * LobstersSelling
  25.             Lobsters -= LobstersSelling
  26.         else:
  27.             print"Selling all of your lobsters..."
  28.             Money += LobsterPrice * Lobsters
  29.             Lobsters = 0
  30.    
  31.     if Money >= PotPrice:
  32.         print"How many pots would you like to buy? (You have $", Money, ", so you can afford ", Money / PotPrice, ")"
  33.         PotsBuying = int(raw_input("> "))
  34.         MoneySpent = PotsBuying * PotPrice
  35.         if MoneySpent <= Money:
  36.             print"You buy", PotsBuying, "pots for $", MoneySpent, "."
  37.             Money -= MoneySpent
  38.             Pots += PotsBuying
  39.         else:
  40.             print "You don't have enough money."
  41.  
  42.     if Money < 24 and Lobsters == 0 and Pots == 0:
  43.         Days = 0
  44.         continue
  45.  
  46.     if Pots > 0:
  47.         print"How many pots would you like to put inshore? (You have", Pots, "pots)"
  48.         Inshore = int(raw_input("> "))
  49.         if Inshore > Pots:
  50.             print"Putting all of your pots inshore..."
  51.             Inshore = Pots
  52.             Outshore = 0
  53.         else:
  54.             Outshore = Pots - Inshore
  55.             print"Putting ", Inshore, "pots inshore and ", Outshore, "pots outshore."
  56.  
  57.         SecondRoll = randint(1,6)
  58.         Total = FirstRoll + SecondRoll
  59.         print"The weatherman rolled a", SecondRoll, "! ",
  60.         if Total >= Boundary:
  61.             print"It was stormy!"
  62.             if Outshore > 0:
  63.                 print"You lost", Outshore, "pots, but you still gained", Inshore,"lobsters for your inshore pots."
  64.                 Pots -= Outshore
  65.                 Lobsters += Inshore
  66.             else:
  67.                 print"Luckily you put all of your pots inshore, and gained ", Inshore, " lobsters."
  68.                 Lobsters += Inshore
  69.            
  70.         else:
  71.             print"The weather was fine!"
  72.             LobstersGained = (Outshore * 2) + Inshore
  73.             print"You gained", LobstersGained, "lobsters!"
  74.             Lobsters += LobstersGained
  75.            
  76.     print " "
  77.     Days-=1
  78.    
  79. print"You sold all your pots for $10 and all your lobsters for $15."
  80. print"You finished with $", Money + (Pots * 10) + (Lobsters * 15), ". Thanks for playing!"
Advertisement
Add Comment
Please, Sign In to add comment