예제 #1
0
파일: human.py 프로젝트: Eragon666/ICS
    def humanStung(self, mosquito, config):
        """ Check what happens to the human and the mosquito if the mosquito 
            stung the human"""
        # the mosquito has eaten and isn't hungry anymore,
        # it's also immediatly making eggs
        mosquito.hungry = 0
        mosquito.oviposition += 1

        # If the human is immune, nothing happens
        if self.status == 2:
            return

        # Else if the mosquito is not infected, but the human is. Check if the 
        # human must become infected
        elif mosquito.infected == 0 and self.status == 1 and decision(config['prob-mosq-human']):
            mosquito.infected = 1
            return

        # If the mosquito is infected, check if the human becomes infected
        elif mosquito.infected == 1 and decision(config['prob-mosq-human']):
            self.status = 1
            #print "human infected"

            # Check if it's fatal and no access to good medicine
            if self.medicine ==  False and decision(config['death-rate']):
                self.fatalInfection = 1
                self.mother(1)

            return
예제 #2
0
파일: grid.py 프로젝트: Eragon666/ICS
    def devourHumans(self,mosquito):
        """ eat a human if there is one and the is mosquito hungry """
        config = self.config

        # check if there is a human to eat when hungry
        if self.human != None and mosquito.hungry == 1:
            # Check the consequences of the bite to the human and the mosquito
            self.human.humanStung(mosquito, self.config)
            #print "human stung"

        # if not hungry it is pregnant, check if its time to lay eggs
        elif mosquito.hungry == 0: 

            # increment oviposition if it is not yet time to lay eggs
            if mosquito.oviposition != config['mosq-oviposition']:
                mosquito.oviposition += 1

            # lay the eggs after x days
            else:
                append = self.mosquitos.append

                for x in xrange(0, config['mosq-eggs']):
                    # Check if the egg will survive
                    if decision(config['mosq-eggs-survive']) == True:
                        append(m.mosquito(self.x, self.y, mosquito.t, 0, 1, 1,
                            self.config))
                #print "I laid some eggs, now:", len(self.mosquitos)
                # it has digested the blood and dropped the eggs, now it is hungry
                mosquito.oviposition = 0
                mosquito.hungry = 1
예제 #3
0
파일: human.py 프로젝트: Eragon666/ICS
    def checkImmune(self):
        """ Check if the human becomes immune after malaria infection """

        if decision(float(self.config['immunity-chance'])):
            self.status = 2
            self.mother(2)