Re: New to Python...feedback?
Been busy, I see... you asked for comments, so here they are:
1) You've put all your data right inside the program - this is a "BAD THING"
(tm). You ought to either a) put it into a list or similar structure at the
beginning, or b) even better, into a file of some sort - even just a simple
text file, then read it into your program. What if, for example, you wanted
to do a French or German version ? Even M$ don't rewrite their apps for each
2) Your program is just one long list of ifs and elses. Maybe you should
think about putting more of the logic into your data-structure (after
covering point 1). Draw your little adventure out as a diagram, eg. a tree,
or network, showing how each part inter-relates.
3) Think about storing the player's 'state', such as current location, what
they're carrying, how healthy or otherwise they are and using that to affect
the outcome of the game.
example (not thouroughly thought through, just enough to give you a start).
You will still need to think about your data structures tho', but later on...
global quit # global so we can change it from here
for choice in choices:
while resp not in valid_choices:
if resp == "q":
print "you hear the alarm go off at roughly 6am..."
print "you feel groggy and tired still. for some reason..."
print "YOU CAN'T REMEMBER WHO YOU ARE, WHERE YOU",
print "ARE OR WHAT YOU'RE DONIG THERE!!!"
print "[que cheesy mystery music] Dun dun DUN!"
"what shall it be, O ye of no name?",
["get up, in spite of the fact that you feel dead",
"just hit the snooze alarm...c'mon, just five more minutes...",
""" ignore it. sleep through it. it's not so bad. it's quite soothing,
if choice == "1": return fryingpan
elif choice == "2": return snooze
elif choice == "3": return sleepthru
# add your stuff about frying pan here...
# stuff about snooze
# stuff about sleepthru...
currentroom=bedroom # note the lack of brackets
#this means copy bedroom into currentroom
while not quit: # the next indented bit will be done until quit == 1
move=currentroom() # do the thing for this room. the brackets mean "do it"
really=raw_input("Are you really sure yu want to quit? [Y/n]")
if really.upper() != "Y":
print "Oh, well - if you must. You'll pay. You know you will..."
|All times are GMT. The time now is 04:13 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.