[Tutor] my newbie program
root
din22@cox.net
Mon Nov 18 09:12:02 2002
hello everyone! i am trying again to learn python
and i have broken my script here. right now i am
just trying to make rooms and move through them.
any comments or direction would be much appreciated
class room:
def __init__(self):
self.desc=""
self.exits=[]
room1=room()
room2=room()
room1.exits=[room2,0,0,0]
room1.desc="a big room"
room2.desc="an even bigger room"
class player:
def __init__(self):
self.location=room1
def act(self):
cmd = raw_input('>')
if cmd == 'look':
print self.location.desc
if cmd == 'n':
if self.location.exits[0] != 0:
self.location=self.location.exits[0]
else:
print "you can't go that way"
me=player()