Esempio n. 1
0
 def describe(self, verbose=True):
     description = Result("\n------ " + self.name + " ------", success=True)
     if verbose or not self.visited:
         description.append("\n\n" + self.description)
     self.append_compelling_items(description)
     self.append_evident_items(description)
     self.append_exit_description(description)
     return description
Esempio n. 2
0
 def attack(self, game, player):
     r = Result("The {} attacks ... ".format(self.name))
     attack_difficulty = random.randint(0, 100)
     if self.dexterity < attack_difficulty:
         r.append("luckily, its blow fails to connect")
     else:
         r.append("and hits you!  You stagger back in pain ... ")
         player.health -= self.strength
     return r
Esempio n. 3
0
 def play(self):
     pop = Population.makePopulation(self._initial_contagion)
     result = Result()
     result.init(pop.get_state())
     for contagion in self._days:
         contagion_matrix = ContagionMatrix.make_contagion(contagion)
         pop.set_contagion_matrix(contagion_matrix.get_matrix())
         pop.advance()
         result.append(pop.get_state())
     self._result = result
Esempio n. 4
0
    def openBackup(self):  # WARNING -> obsolete, use targets and performance
        result = Result()
        tarTemp = Target(0)
        with open("backup.txt") as f:
            temp = f.readlines()
        f.close()
        # open("backup.txt", "w").close()  # TODO uncomment to activate backup refresh
        for index, line in enumerate(temp):  # on parcourt toutes les lignes du fichier
            if line.__len__() > 10 and line[:1] == "|":  # la ligne ne contient pas qu'un |
                if index < temp.__len__() - 1 and temp[index + 1][:13] != line[:13]: # on est pas sur une ligne partielle
                    line = line.split(",")
                    tarTemp = Target(line[0][1:])
                    lineb = line[1].split("/")
                    print(lineb.__len__())
                    for p in lineb:
                        tempPoint = Point(line[0][1:], p)
                        tarTemp.addPoint(tempPoint)
                        del tempPoint
                    result.append(tarTemp)
        return result

    # def targets(self):
    #     result = Result()
    #     return 0