Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.10 KB | None | 0 0
  1. import time
  2. __author__ = 'nikolojedison'
  3.  
  4. currentTime = "dawn"
  5. fire = False
  6. starttime = time.time()
  7.  
  8. def passTime():
  9.     while True:
  10.         dawn()
  11.         time.sleep(60.0 - ((time.time() - starttime) % 60.0))
  12.         day()
  13.         time.sleep(60.0 - ((time.time() - starttime) % 60.0))
  14.         dusk()
  15.         time.sleep(60.0 - ((time.time() - starttime) % 60.0))
  16.         night()
  17.         time.sleep(60.0 - ((time.time() - starttime) % 60.0))
  18.  
  19. def main():
  20.     intro()
  21.     passTime()
  22.  
  23. def decide(thingToDecide):
  24.  
  25.     global fire
  26.     global currentTime
  27.    
  28.     if thingToDecide == "help" or thingToDecide == "Help":
  29.         print("Commands you can use are help, fire, sleep, watch.")
  30.         print("The current time is ", currentTime)
  31.         decideIn = input(">>")
  32.         decide(decideIn)
  33.        
  34.     elif thingToDecide == "fire" or thingToDecide == "Fire":
  35.         if fire == True:
  36.             decideIn = input("You already started a fire. >>")
  37.             decide(decideIn)
  38.         else:
  39.             decideIn = input("You start a fire. >>")
  40.             fire = True
  41.             decide(decideIn)
  42.        
  43.     elif thingToDecide == "sleep" or thingToDecide == "Sleep":
  44.         if currentTime == "day" or currentTime == "dawn":
  45.             decideIn = input("It's too bright to sleep. >>")
  46.             decide(decideIn)
  47.         else:
  48.             print("You go to sleep.")
  49.             currentTime == "dawn"
  50.            
  51.     elif thingToDecide == "watch" or thingToDecide == "Watch":
  52.         if currentTime == "day":
  53.             decideIn = input("You sit and watch the landscape. >>")
  54.             decide(decideIn)
  55.         elif currentTime == "dusk":
  56.             decideIn = input("You watch the sunset. >>")
  57.             decide(decideIn)
  58.         elif currentTime == "dawn":
  59.             decideIn = input("You watch the sunrise. >>")
  60.             decide(decideIn)
  61.         elif currentTime == "night":
  62.             decideIn = input("You watch the stars. >>")
  63.             decide(decideIn)
  64.         else:
  65.             decideIn = input("You exist outside of spacetime. >>")
  66.             decide(decideIn)
  67.                  
  68.     else:
  69.         decideIn = input("I don't understand what you mean. Try again? >>")
  70.         decide(decideIn)
  71.  
  72. def intro():
  73.     print("Welcome to timePy, the simple time-based Python RPG.")
  74.     print("Days are about 4 minutes long.")
  75.     print("Commands you can use are help, fire, sleep, watch.")
  76.  
  77. def dawn():
  78.     global currentTime
  79.     currentTime = "dawn"
  80.     dawnIn = input("The sun is rising. >>")
  81.     decide(dawnIn)
  82.  
  83. def dusk():
  84.     global currentTime
  85.     currentTime = "dusk"
  86.     duskIn = input("The sun is setting. >>")
  87.     decide(duskIn)
  88.  
  89. def day():
  90.     global currentTime
  91.     currentTime = "day"
  92.     dayIn = input("The sun has risen. It's day now. >>")
  93.     decide(dayIn)
  94.  
  95. def night():
  96.     global currentTime
  97.     currentTime = "night"
  98.     if fire == False:
  99.         nightIn = input("It's dark, and you can barely see. >>")
  100.         decide(nightIn)
  101.     elif fire == True:
  102.         nightIn = input("You can see, but it's boring. >>")
  103.         decide(nightIn)
  104.  
  105. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement