def addOrganismByName(self, name, posX, posY):
     temp = Grass(posX, posY, self)
     if name == "Antelope":
         temp = Antelope(posX, posY, self)
     elif name == "CSheep":
         temp = CSheep(posX, posY, self)
     elif name == "Fox":
         temp = Fox(posX, posY, self)
     elif name == "Human":
         temp = Human(posX, posY, self)
     elif name == "Sheep":
         temp = Sheep(posX, posY, self)
     elif name == "Turtle":
         temp = Turtle(posX, posY, self)
     elif name == "Wolf":
         temp = Wolf(posX, posY, self)
     elif name == "Dandelion":
         temp = Dandelion(posX, posY, self)
     elif name == "DeadlyNightshade":
         temp = DeadlyNightshade(posX, posY, self)
     elif name == "Grass":
         temp = Grass(posX, posY, self)
     elif name == "Guarana":
         temp = Guarana(posX, posY, self)
     elif name == "Hogweed":
         temp = Hogweed(posX, posY, self)
     self.organisms.append(temp)
    def loadOrganism(self, name, posX, posY, strn, mvd, age):
        temp = Grass(posX, posY, self)
        if name == "Antelope":
            temp = Antelope(posX, posY, self)
        elif name == "CSheep":
            temp = CSheep(posX, posY, self)
        elif name == "Fox":
            temp = Fox(posX, posY, self)
        elif name == "Human":
            temp = Human(posX, posY, self)
        elif name == "Sheep":
            temp = Sheep(posX, posY, self)
        elif name == "Turtle":
            temp = Turtle(posX, posY, self)
        elif name == "Wolf":
            temp = Wolf(posX, posY, self)
        elif name == "Dandelion":
            temp = Dandelion(posX, posY, self)
        elif name == "DeadlyNightshade":
            temp = DeadlyNightshade(posX, posY, self)
        elif name == "Grass":
            temp = Grass(posX, posY, self)
        elif name == "Guarana":
            temp = Guarana(posX, posY, self)
        elif name == "Hogweed":
            temp = Hogweed(posX, posY, self)

        temp.age = age
        temp.strength = strn
        temp.movedTo = mvd
        self.organisms.append(temp)
Exemple #3
0
    def generate_organism(self, point: Point, species):
        if (species == df.const.ANTELOPE_SIGN):
            self._organisms.append(Antelope(self, point))

        elif (species == df.const.HUMAN_SIGN):
            self._organisms.append(Human(self, point))

        elif (species == df.const.GUARANA_SIGN):
            self._organisms.append(Guarana(self, point))

        elif (species == df.const.FOX_SIGN):
            self._organisms.append(Fox(self, point))

        elif (species == df.const.DANDELION_SIGN):
            self._organisms.append(Dandelion(self, point))

        elif (species == df.const.SHEEP_SIGN):
            self._organisms.append(Sheep(self, point))

        elif (species == df.const.CYBER_SHEEP_SIGN):
            self._organisms.append(CyberSheep(self, point))

        elif (species == df.const.GRASS_SIGN):
            self._organisms.append(Grass(self, point))

        elif (species == df.const.BELLADONNA_SIGN):
            self._organisms.append(Belladonna(self, point))

        elif (species == df.const.WOLF_SIGN):
            self._organisms.append(Wolf(self, point))

        elif (species == df.const.TORTOISE_SIGN):
            self._organisms.append(Tortoise(self, point))
        elif (species == df.const.SOSNOWSKIS_HOGWEED_SIGN):
            self._organisms.append(SosnowskisHogweed(self, point))
Exemple #4
0
 def randomOrganisms(self):
     self.addNewOrganism(
         Human(random.randint(0, self.width),
               random.randint(0, self.height), self, self.graphic_engine))
     for t in self.types:
         n = random.randint(1, int(min(self.width, self.height) / 6))
         for _ in range(n):
             x = random.randint(0, self.width)
             y = random.randint(0, self.height)
             if self.isEmptyPosition(x, y):
                 self.addNewOrganism(t(x, y, self, self.graphic_engine))
Exemple #5
0
    def load_organism(self, line):
        text = line.split()
        age = int(text[3])
        id1 = int(text[4])
        strength = int(text[5])
        point = Point(int(text[1]), int(text[2]))
        species = text[0]

        if (species == df.const.ANTELOPE_SIGN):
            self._organisms.append(Antelope(self, point, age, id1, strength))

        elif (species == df.const.SOSNOWSKIS_HOGWEED_SIGN):
            self._organisms.append(SosnowskisHogweed(self, point, age, id1, strength))

        elif (species == df.const.HUMAN_SIGN):
            self._organisms.append(Human(self, point, age, id1, strength, int(text[6])))

        elif (species == df.const.GUARANA_SIGN):
            self._organisms.append(Guarana(self, point, age, id1, strength))

        elif (species == df.const.FOX_SIGN):
            self._organisms.append(Fox(self, point, age, id1, strength))

        elif (species == df.const.DANDELION_SIGN):
            self._organisms.append(Dandelion(self, point, age, id1, strength))

        elif (species == df.const.SHEEP_SIGN):
            self._organisms.append(Sheep(self, point, age, id1, strength))

        elif (species == df.const.CYBER_SHEEP_SIGN):
            self._organisms.append(CyberSheep(self, point, age, id1, strength))

        elif (species == df.const.GRASS_SIGN):
            self._organisms.append(Grass(self, point, age, id1, strength))

        elif (species == df.const.BELLADONNA_SIGN):
            self._organisms.append(Belladonna(self, point, age, id1, strength))

        elif (species == df.const.WOLF_SIGN):
            self._organisms.append(Wolf(self, point, age, id1, strength))

        elif (species == df.const.TORTOISE_SIGN):
            self._organisms.append(Tortoise(self, point, age, id1, strength))
    def createOrganisms(self):
        a = self.generateXandY()
        count = 0
        typ = 0
        num = 0
        self.addOrganism(Human(a[0], a[1], self))
        while count < self.fill():
            a = self.generateXandY()
            if num >= 22:
                typ = randint(0, 10)

            if typ == 0:
                self.addOrganism(Antelope(a[0], a[1], self))
            elif typ == 1:
                self.addOrganism(CSheep(a[0], a[1], self))
            elif typ == 2:
                self.addOrganism(Fox(a[0], a[1], self))
            elif typ == 3:
                self.addOrganism(Sheep(a[0], a[1], self))
            elif typ == 4:
                self.addOrganism(Turtle(a[0], a[1], self))
            elif typ == 5:
                self.addOrganism(Wolf(a[0], a[0], self))
            elif typ == 6:
                self.addOrganism(Dandelion(a[0], a[1], self))
            elif typ == 7:
                self.addOrganism(DeadlyNightshade(a[0], a[1], self))
            elif typ == 8:
                self.addOrganism(Grass(a[0], a[1], self))
            elif typ == 9:
                self.addOrganism(Guarana(a[0], a[1], self))
            elif typ == 10:
                self.addOrganism(Hogweed(a[0], a[1], self))

            count += 1
            if num < 22:
                typ = (typ + 1) % 11
                num += 1
        for i in range(len(self.organisms) - 1):
            self.organisms[i].increaseAge()
Exemple #7
0
    def load(self):
        self.organisms = []
        file = open("savedWorld.txt", "r")
        index = 2
        self.string = file.readline(index)
        self.string = self.string.strip()
        count = int(self.string)

        #  for a in range(0, count):
        #    print(file.readline(index))
        #

        for a in range(0, count):
            index = 2
            self.string = file.readline(index)
            self.string = self.string.strip()
            type_ = self.string
            index = 3
            self.string = file.readline(index)
            print(self.string)

            self.string = self.string.strip()
            poz_x = int(self.string)

            self.string = file.readline(index)

            self.string = self.string.strip()
            poz_y = int(self.string)

            self.string = file.readline(index)
            index = 2
            self.string = self.string.strip()
            force_ = int(self.string)

            self.string = file.readline(index)

            self.string = self.string.strip()
            ini = int(self.string)
            if type_ == 'H':
                index = 3
                self.organisms.append(Human(self, poz_x, poz_y))
                self.string = file.readline(index)

                self.string = self.string.strip()
                coll = int(self.string)
                self.get_organism_by_xy(poz_x, poz_y).coldown = coll
            elif type_ == 'A':
                self.organisms.append(Antilope(self, poz_x, poz_y))
            elif type_ == 'W':
                self.organisms.append(Wolf(self, poz_x, poz_y))
            elif type_ == 'B':
                self.organisms.append(WolfBerry(self, poz_x, poz_y))
            elif type_ == 'L':
                self.organisms.append(Fox(self, poz_x, poz_y))
            elif type_ == 's':
                self.organisms.append(Sheep(self, poz_x, poz_y))
            elif type_ == 'Z':
                self.organisms.append(Turtle(self, poz_x, poz_y))
            elif type_ == 'K':
                self.organisms.append(BarszczSosnowksiego(self, poz_x, poz_y))
            elif type_ == 'U':
                self.organisms.append(Guarana(self, poz_x, poz_y))
            elif type_ == 'O':
                self.organisms.append(SowThistle(self, poz_x, poz_y))
            elif type_ == 'C':
                self.organisms.append(CyberSheep(self, poz_x, poz_y))
            if self.get_organism_by_xy(poz_x, poz_y) != None:
                self.get_organism_by_xy(poz_x, poz_y).force = force_
                self.get_organism_by_xy(poz_x, poz_y).initiative = ini
Exemple #8
0
from Plants.Grass import Grass
from Plants.Guarana import Guarana
from Plants.SowThistle import SowThistle
from Plants.BarszczSosnowskiego import BarszczSosnowksiego

print("ok")

#y= Animal()
#x=World()
#
#s.createMe(x ,4 ,4);

WORLD = World()
s = CyberSheep(WORLD, 3, 4)
WORLD.organisms.append(s)
s = Human(WORLD, 13, 14)
WORLD.organisms.append(s)
s = BarszczSosnowksiego(WORLD, 10, 10)
WORLD.organisms.append(s)
#WORLD.save()

s = Fox(WORLD, 3, 4)
WORLD.organisms.append(s)
s = Sheep(WORLD, 11, 4)
#WORLD.organisms.append(s)
s = Turtle(WORLD, 13, 4)
WORLD.organisms.append(s)
s = Wolf(WORLD, 7, 4)
WORLD.organisms.append(s)

s = SowThistle(WORLD, 14, 4)