[Tutor] exercise with classes 2nd attempt

Tonu Mikk tmikk at umn.edu
Sun Feb 12 04:19:50 CET 2012

I am learning Python using the "Learn Python the Hard Way" book by Zed
 I reached exercise 42 where we learn about Python
 The exercise shows a game with one class that includes all the definitions
for playing the game.  For extra credit we are asked to create another
version of this game where we use two classes - one for the room
definitions and the other for the playing the game.

May attempt at creating two classes is here http://codepad.org/963vUgSt .
 I get the following error which I have been un-able to resolve.  Any
suggestions are welcome.

Traceback (most recent call last):
  File "ex42_3.py", line 233, in <module>
  File "ex42_3.py", line 231, in run
    room1.doIt()          # plays the game
  File "ex42_3.py", line 32, in doIt
    self.obj.play() # use object
  File "ex42_3.py", line 20, in play
    room = getattr(self, next)
AttributeError: 'Engine' object has no attribute 'central_corridor'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120211/08c758c2/attachment.html>

More information about the Tutor mailing list