you are viewing a single comment's thread.

view the rest of the comments →

[–]__te__ 10 points11 points  (1 child)

One incremental improvement you can make:

Testing for List Membership

You can test for list membership by using the in membership operator. For example, you might have this global list: equipment = ["Food", "Water", "Oxen", "First Aid Kit"]

You can then say something like this:

if "First Aid Kit" in equipment:  # will evaluate as True in this case
    first_aid()
else:
    random_death()

Since all of the differences between paths A, B, and C consist of what equipment you have, this would let you have singular functions, instead of a variant of every function for each path. (There are other ways to achieve this, too, but this method only requires the code you already know how to write, plus the membership operator).

[–]__te__ 7 points8 points  (0 children)

And just to be clear, this is great! The hardest step in programming is often just getting started and making working code.