[Tutor] Python information

Guillermo Fernandez guillermo.fernandez@epfl.ch
Mon, 05 Aug 2002 16:39:05 +0930


> and finally, monsters.py (I forgot how I got it or who the author is,
> but it is very good start); it is attached.
Hi!

I tried to start monster.py but had some difficulties to make it work. I
made a few changes and now it seems to work.

I chaged the lines 55 to 57:

        self.needs.update(self.state, ext_factors) # max_need = 
        self.needs.get_max()

into:

        self.needs.update(self.state, ext_factors)
        max_need = self.needs.get_max()

and the lines to :

        choice = input("Which type of monster would you like to watch?")
        num = input("Specify the number of turns the monster should
take: ")
        monster = monsters[choice-1]

into:

        choice = input("Which type of monster would you like to
watch?")#-1
        num = input("Specify the number of turns the monster should
take: ")
        monster = monsters[choice]

By the way, it's quite funny how you can do that kind of simulations in
only 351 lines!

It still lack of interaction between characters (as for example the
spider will attack without knowing if there is someone to atack :-) and
a few remarks of the same style, but it seems to be a work in process
program and I'm waiting for the results.