In the process of learning Python, I have given myself a programming exercise to do. This is a standard thing I do whenever learning a new programming language and I have used this same exercise several times before with other programming languages. It is a simple text based game that simply lets a user explore a maze of rooms. If fully fleshed out, it would be a Zork or D&D type game. It demonstrates some basic programming tasks such as reading data into an array from a file, getting and responding to user input, looping, control structures, system calls and function definitions. I share it here as example code for others also learning Python and I welcome comments. The code is for Python 3.x, but the comments explain how to easily convert it for use in Python 2.x. It is far from perfect and is for learning purposes only – something to tinker with. It is based on concepts from Creating Adventure Games on Your Computer by Tim Hartnell <http://www.atariarchives.org/adventure/>, which used the BASIC programming language. You are welcome to take this code and use and modify for any purpose you like. The current version of this code will always be at this location: mazegame-current<http://wa5pb.sdf.org/mazegame-current.py>. You can create an appropriate data file by making a text file with contents similar to the following, the current code requires a fixed number of columns (7 at the time of this writing and subject to change) and an unlimited number of rows. 0 0 0 0 0 0 0 0 0 4 2 0 0 0 0 0 0 1 3 6 0 0 0 5 0 2 0 0 0 1 0 5 0 0 0 0 3 0 0 4 0 7 0 0 0 0 0 0 2 0 0 0 0 0 5 0
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor