[Tutor] Hands-on beginner's project?
nathan virgil
sdragon1984 at gmail.com
Fri Oct 3 15:50:55 CEST 2008
On Fri, Oct 3, 2008 at 9:19 AM, David <david at abbottdavid.com> wrote:
> > Okay, I'm resurrecting this project.
> Where is this project code? <http://www.linuxcrazy.com>
>
Right here. The content is going to eventually go through some drastic
changes, but what's here should be good enough for testing.
# Content
# retrieve data for current room
room = 1
if room == 1:
desc = "Ahead of you, you see a chasm."
ques = "Do you wish to try jumping over it? Y/N"
destYes = 2
destNo = 3
elif room == 2:
desc = "Ahead of you, you see a warty green ogre."
ques = "Do you wish to eat it? Y/N"
destYes = 4
destNo = 5
# etc for the rest of the rooms
# Engine
# ask current question and move to next room
print desc
ans = raw_input(ques).upper() # allow for lower case input
if ans == "Y":
room = destYes
elif ans == "N":
room = destNo
elif ans == "north":
room = destN
elif ans == "south":
room = destS
elif ans == "east":
room = destE
elif ans == "west":
room = destW
elif ans == "Q": # give us a way out.
Break
else:
print "I don't understand. Can you give a clearer answer?"
It seems like good code, but for some reason, it's not letting me go into
Room 2 (the ogre). I remember last time I tried this, the problem had
something to do with redirecting back into the same room, but I don't
remember exactly what that issue was.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081003/189c1416/attachment.htm>
More information about the Tutor
mailing list