示例#1
0
 def get_score(self, adoption_center):
     base_score = Adopter.get_score(self,adoption_center)
     add_score = 1
     for animal in self.allergic_species:
         if( adoption_center.get_number_of_species(animal) > 0):
             add_score = 0.0
             break
     return (base_score * add_score)
示例#2
0
 def get_score(self, adoption_center):
     base_score = Adopter.get_score(self,adoption_center)
     add_score = 0
     for animal in self.feared_species:
         add_score += adoption_center.get_number_of_species(animal)
     base_score -= 0.3 * add_score
     if base_score < 0.0:
         base_score = 0.0
     return (base_score)
示例#3
0
 def get_score(self, adoption_center):
     import random as rand
     base_score = Adopter.get_score(self,adoption_center)
     distance = self.get_distance(adoption_center)
     if distance < 1.0:
         add_score = 1.0
     elif distance < 3.0 :
         add_score = rand.uniform(0.700,0.900)
     elif distance < 5.0 :
         add_score = rand.uniform(0.500,0.700)
     else:
         add_score = rand.uniform(0.100,0.500)
     return (base_score * add_score)
示例#4
0
 def get_score(self, adoption_center):
     base_score = Adopter.get_score(self,adoption_center)
     add_score = 1.0
     allergic_adoption = []
     for animal in self.allergic_species:
         if( adoption_center.get_number_of_species(animal) > 0):
             allergic_adoption.append(animal)
     for animal in  allergic_adoption:
         try :
             me_score = self.medicine_effectiveness[animal]
         except :
             me_score = 0
         if me_score < add_score :
             add_score = me_score
     return (base_score * add_score)
示例#5
0
 def __init__(self, name, desired_species, allergic_species):
     Adopter.__init__(self, name, desired_species)
     if str(type(allergic_species)) == "<type 'str'>" :
         self.allergic_species = [allergic_species]
     else:
         self.allergic_species = allergic_species
示例#6
0
 def __init__(self, name, desired_species, feared_species):
     Adopter.__init__(self, name, desired_species)
     if str(type(feared_species)) == "<type 'str'>" :
         self.feared_species = [feared_species]
     else:
         self.feared_species = feared_species
示例#7
0
 def get_score(self, adoption_center):
     base_score = Adopter.get_score(self,adoption_center)
     add_score = 0
     for animal in self.considered_species:
         add_score += adoption_center.get_number_of_species(animal)
     return (base_score + (0.3 * add_score))
示例#8
0
 def __init__(self, name, desired_species, considered_species):
     Adopter.__init__(self, name, desired_species)
     if str(type(considered_species)) == "<type 'str'>" :
         self.considered_species = [considered_species]
     else:
         self.considered_species = considered_species
示例#9
0
 def __init__(self, name, desired_species, location):
     Adopter.__init__(self, name, desired_species)
     self.adopter_location = (float(location[0]),
                              float(location[1]))