Python Games

Here you’ll find the ongoing development of a ‘choose your own adventure’ game.  Enjoy!

These games were written in Python 2.7 and are purely designed to be run in the terminal/command window only.

Snowhold (Fantasy, v1.0) – link to download

Snowhold (Fantasy, v2.0) – link to download

Snowhold (Fantasy, v2.2.1) – link to download

12 thoughts on “Python Games

  1. After several attempts to get it going I gave up. First I had to rename to Then, after entering 1 twice, I got:
    File “C:\Python33\”, line 312, in start
    File “C:\Python33\”, line 11, in event1
    print(textwrap.fill((textwrap.dedent(module.event1_description).strip()), width=60))
    AttributeError: ‘module’ object has no attribute ‘event1_description’

    If you successfully ran this you must have run different code than what you posted.

    Reading your code I see a few more problems. One being some calls to event1() – no argument, but 1 is expected!

    • Wow, not sure how I got the files confused…..ugh. Thanks. I did a couple of quick edits and made sure the right variables were pointing to the right places now. So it should work fine. Seems I uploaded a partial edit for the next version I was working on.

  2. The best thing you can do is shift directions from brute-force coding of a game (which gets more and more difficult and unmanageable, to a separation of data from logic. Here is where classes are so helpful.

    • What I am doing is exactly that, separating the content from the context. The first version of this has all the flavour text in the same file and the logic. I have yet to find a good example of Classes to understand how they work. So far every example I have seen in any of the courses have either a:/ not been explained properly so they were frustrating(Coursera) or b/ looks just like functions moved to another location in the code(Learn Python The Hard Way).

      I would prefer to use the idea of having a ‘blueprint’ for a section and simply feeding it flavour text based on the genre chosen at the beginning of the game. With each successive version of the game, I am learning to distance content and context, while also learning to debug and properly track things, plus learn some new concepts along the way (i.e. the textwrap was an awesome find).

      So, if you know of a GOOD resource, and by that I mean one that walks you through examples and not just something that says RTFM, Classes will continue to elude me.

      I appreciate your time and effort. If you decide to take another swing at the code, I’d be greatly honoured.

  3. Wait patiently while I develop an OOP version of your game.

    Meanwhile learn to use functions to avoid duplicate code. Example:
    def printText(text):
    print(textwrap.fill((textwrap.dedent(text).strip()), width=60))
    and call it thus:
    similarly everywhere else you use textwrap.

    Study UML ( Before you write code you develop a model.

    • Thanks Bob! I am learning all the time! Step by step I am learning how to abstract the code to make it easier. Will immediately make that part of v3 update :)

      And yes, no rush to develop the OOP. You are doing me a HUGE favour! I appreciate it immensely!

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.