On 12/02/14 02:06, R. Alan Monroe wrote:

Based on a very quick look, its 2:36am!!

(pseudo code)
-----
playing=True
while playing:
     #phase 1 - fly every turn, you might die
     if dead:
         playing=false
         break
     if you make it home intact:
         playing=false
         break
     #phase 2 - stuff shoots at you every turn, you might die
     if playing:
         try:

You don;t need if playing since the false conditions both break.
So you don;t need the try either...


             for each thing that shoots at you:
                 if dead:
                     raise deaderror #this in particular seems horrible
         except deaderror:         #since you can't nest "break"s
            playing=false
            break

And you don;t need the error, just make playing false and break


     #phase 3 - may or may not get an event card, with certain cards you might 
die
     if playing:
         #stuff

Again no need to check playing, you keep breaking...

         if dead:
             playing=false
             break

Not sure if you need this or not...


     #phase 4 - you drop bombs if you're over a target, you can't die here
game over, print score
-----

HTH,


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to