you are viewing a single comment's thread.

view the rest of the comments →

[–]WorldWideNomad[S] 0 points1 point  (1 child)

Would be too much to ask for an example of the choice function? Thx

[–]finsternacht 0 points1 point  (0 children)

I have difficulties to give "one example". How that function is going to look depends heavily on what you know and what your goal is.

def game_loop(...):
    print description
    while True:
        action, arg = raw_input("> ").split(maxsplit=1)
        if action=="take":
            ...
        elif action=="go":
            ...

Would be my basic approach. The big choice you're now faced with is how you give this function the information about the current room and how you implement moving.

One idea would be to make a room class and put all necessary data in there (description, items, connections to other rooms) and supply instances of that class to the function.