Advertisement
brilliant_moves

GameFramework.py

Feb 29th, 2016
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. #This could form part of a game
  2.  
  3. def transitions(place):
  4.     place = place.lower()
  5.     if place == "rooftop": return ("diningroom")
  6.     elif place == "diningroom": return ("hallway", "rooftop")
  7.     elif place == "bedroom": return ("hallway")
  8.     elif place == "hallway": return ("diningroom", "bedroom")
  9.     else: return ("Place Error, please try again")
  10.  
  11. def main():
  12.     place = ""
  13.     while place.lower() != "x":
  14.         if place == "":
  15.             place = input("Where are you? (Enter \"X\" to exit) : ")
  16.         else:
  17.             place = input("Where do you want to go? (Enter \"X\" to exit) : ")
  18.         if place == "x":
  19.             print ("Bye for now!")
  20.         else:
  21.             print ("You can go to ... " + str (transitions (place)))
  22.  
  23. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement