Q:

Why “bear_moved” needed?

I really don't get what the function bear_moved  is? 
def bear_room():
    print "There is a bear here."
    print "The bear has a bunch of honey."
    print "The fat bear is in front of another door."
    print "How are you going to move the bear?"
    bear_moved = False

    while True:
        choice = raw_input("> ")

        if choice == "take honey":
            dead("The bear looks at you then slaps your face off.")
        elif choice == "taunt bear" and not bear_moved:
            print "The bear has moved from the door. You can go through it now."
            bear_moved = True
        elif choice == "taunt bear" and bear_moved:
            dead("The bear gets pissed off and chews your leg off.")
        elif choice == "open door" and bear_moved:
            gold_room()
        else:
            print "I got no idea what that means."

This is from Learn Python the Hard Way, exercise 35. 

A:

The bear_moved boolean flag influences which one these three elif tests can be picked:
elif choice == "taunt bear" and not bear_moved:
    # ...
elif choice == "taunt bear" and bear_moved:
    # ...
elif choice == "open door" and bear_moved:
    # ...

Before you enter the while loop, the bear_moved flag is False, so typing in taunt bear can't pick the second option because and bear_moved is false. The same applies for the open door option; if you typed in open door at the start you'd get a I got no idea what that means message. So the flag makes sure that only the first option can be entered by Python.
So when you type in taunt bear the fist time, the matching elif block prints out a message (The bear has moved...) and sets bear_moved = True, after which you go back to the top of the while loop. After this, typing in taunt bear again takes Python to the second elif branch, because now and not bear_moved is false (not True is False).
In the game, this means you can only taunt the bear once. That'll let you get to the door; if you taunt the bear twice, you die.

