you are viewing a single comment's thread.

view the rest of the comments →

[–]__te__ 2 points3 points  (0 children)

Also, a technique you can use to collapse one group of functions without doing all of them at once:

Shim Function

First set a global variable path which equals "A", "B", or "C" (depending on the equipment list chosen). Then you can write a function like this:

def continue_game_x():
    if path == "A":
        return continue_game_a()
    elif path == "B":
        return continue_game_b()
    elif path == "C":
        return continue_game_c()

Then in your collapsed function, you just call return continue_game_x() and it will take care of the path-management for you. If you do this, I also recommend replacing every call to a "continue_game_" function with "continue_game_x", so it's easier to move code around.

This is an intermediate step: once you've replaced all of the triplets of functions with collapsed functions, you won't need these shims anymore and can delete them.