-2

I've tried to design a small (3 rooms) "adventure-like" mini-game, and when i run it i get:

if answer == "restaurant":

IndentationError: unindent does not match any outer indentation level

# TRUMANIA v. 0.0.2

def Square():
    print "You exit from there, and you appear in Central Square. Do you want to walk to the Library or to the Restaurant?" 
    answer = raw_input("Type 'Restaurant' or 'Library' and hit 'Enter'.").lower()
    if answer == "restaurant":
        Restaurant()
    elif answer == "library":
        Library()
    else:
        print "You didn't pick Restaurant or Library! You can't just stand there like a rock; you need to make a decision!"
        Square()

def Trumania():
    print "You've just entered Trumania!"
    print "Do you want to go to the Restaurant or visit the Library?"
    answer = raw_input("Type 'Restaurant' or 'Library' and hit 'Enter'.").lower()
    if answer == "restaurant":
        Restaurant()
    elif answer == "library":
        Library()
    else:
        print "You didn't pick Restaurant or Library! You can't just stand in the entrance like a scarecrow; you need to make a decision!"
        Trumania()

def Restaurant():
    print "You've just entered the Restaurant!"
    print "Do you want to eat Inside or Outside?"
    answer = raw_input("Type 'Inside' or 'Outside' and hit 'Enter'.").lower()
    if answer == "inside":
        print "You need to bribe the waiter, but you get a cozy table and have a wonderful meal!"
    elif answer == "outside":
        print "You get a cheap (and cold) table in the outside and manage to eat some apetizers"
    else:
        print "You didn't selected Inside or Outside. The Waiter euh... Waits... "
        Restaurant()

def Library():
    print "You arrive at the Library!"
    print "Do you want to get some books or you prefer to study?"
    answer = raw_input("Type 'Books' or 'Study' and hit 'Enter'.").lower()
    if answer == "books":
        print "You get some books that you can sell later. However, thats bad karma!"
    elif answer == "study":
        print "You learn a lot!However, you feel tired after so much effort"
    else:
        print "You didn't pick Books or Study! Try again."
        Library()

Trumania()
Square()

The idea is to start in Trumannia, then be able to choose Restaurant or Library, and then exit to Square and be able to choose again Restaurant or Library. So I'm not sure a) how to fix the error and b) how to format the different variables so the program can "load" all the info first and then "go" to each place when needed. I hope i explained myself. Thanks again!

Top8
  • 27
  • 4
  • 3
    Also include your goals with the game, a simple "my code is not working" is not enough to get good pieces of advice. – codingEnthusiast Feb 04 '15 at 23:11
  • Please read http://stackoverflow.com/help/mcve – jonrsharpe Feb 04 '15 at 23:14
  • @MrE *"I'm unable to make it work"* suggests otherwise... – jonrsharpe Feb 04 '15 at 23:14
  • What is "fencing" a variable?! – jonrsharpe Feb 04 '15 at 23:16
  • @Top8 that's correct, or you can click the `{}` button at the top of the editor window. – jonrsharpe Feb 04 '15 at 23:23
  • Ok thanks everyone, error fixed and some "stackoverflownetiquette" learned ;-) Its ok if i delete this post completely and make a new one with the cleaned code, a short problem and i try not to make @jonrsharpe work again? (He deleted seventy something words form my first post lol) OR I edit this post myself as well so i avoid more noise? – Top8 Feb 04 '15 at 23:45
  • No worries, and no need to start over. Your attitude is great! Welcome to the site. Editing is a normal part of the asking process. Your question looks good now, and you got an answer. Hopefully the question will be reopened shortly now that it's been fixed up. If you want you could delete your older comments that have been addressed. Cheers! – John Kugelman Feb 04 '15 at 23:56

1 Answers1

1

Your code is broken because there is no colon after def Square().

200_success
  • 7,286
  • 1
  • 43
  • 74