def __init__(self, fishManager, myData, index):
     Fish.__init__(self, fishManager, myData, index)
     self.fsm = LegendaryFishFSM(self)
     self.actor.setScale(self.myData['scaleRange'][0])
     self.staminaValue = self.myData['stamina']
     self.aboutToBitingInterval = None
     self.fishChaseLureSequence = Sequence()
     self.lfStruggleSequence = Sequence()
     self.initFishStaminaBar()
     self.lurePosition = None
 def replaceFish(self, fish):
     depth = fish.myData["depth"]
     index = fish.index
     self.fishHistogram[fish.myData["id"]][0] -= 1
     self.uncaughtFish.remove(fish)
     fish.destroy()
     fishData = FishingGlobals.giveMeAFish(self.location, depth, self.fishHistogram)
     f = Fish(self, fishData, index)
     f.fsm.request("Offscreen")
     self.fishHistogram[f.myData["id"]][0] += 1
     f.pickPositionAndSwim()
     self.uncaughtFish.append(f)
Exemple #3
0
def main():
  res    = taskMain()
  aux1   = [] 
  cont   = 0
  setS = [10.0,12.0,19.0,2.0,22.0,29.0]
  setR = [39.0,30.0,42.0,43.0,48.0,49.0]
  
  for i in filterSet(res, setR, setS):
    j = Fish()
    j.createFish(i.name, i.light, i.length, i.descr)
    aux1.append(j)
  
  fishes  = filterSet(res, setR, setS)
  fishes1 = finalCalc(fishes)
  
  cont = diff(aux1, fishes1)
  print("%d diferencas" % cont)
Exemple #4
0
def getFishesFromXLS():
  lines = 132

  workbook  = xlrd.open_workbook('Task001.xls')
  worksheet = workbook.sheet_by_name('IA')

  for i in range(1, lines):
    fish = Fish() 
    fish.createFish(worksheet.cell(i,0).value, worksheet.cell(i, 1).value, worksheet.cell(i, 2).value, worksheet.cell(i,3).value, 0, 0)

    #fish.createFish(worksheet.cell(i,0).value, worksheet.cell(i, 1).value, worksheet.cell(i, 2).value)
    
    if 'robalo' in fish.descr:
      robalo.append(fish)
    else:
      salmao.append(fish)
    fishes.append(fish)
def make_generation(fish=None):
    global oid, instances
    if fish:
        networks = [copy.deepcopy(x.network) for x in fish]
    instances = [x for x in instances if isinstance(x, Food)]
    if not fish:
        for i in range(80):
            instances.append(Fish(clock, screen, instances, to_delete, oid))
            oid += 1
    else:
        for i in range(80):
            instances.append(
                Fish(clock, screen, instances, to_delete, oid,
                     networks[i % 35]))
            oid += 1

    for i in range(200):
        instances.append(
            Food(screen_size[0] * random.random(),
                 screen_size[1] * random.random(), screen, oid))
        oid += 1
def mainSimulation():
    numberOfBears = 10
    numberOfFish = 25
    numberOfBerries = 50
    numberOfTurns = 1000
    worldWidth = 50
    worldHeight = 25
    
    myWorld = World(worldWidth, worldHeight)
    myWorld.draw()

    for i in range(numberOfFish):
        newfish = Fish()
        x = random.randrange(myWorld.getMaxX())
        y = random.randrange(myWorld.getMaxY())
        while not myWorld.emptyLocation(x, y):
            x = random.randrange(myWorld.getMaxX())
            y = random.randrange(myWorld.getMaxY())
            
        myWorld.addThing(newfish, x, y)

    for i in range(numberOfBerries):
        newBerry = Berry()
        x = random.randrange(myWorld.getMaxX())
        y = random.randrange(myWorld.getMaxY())
        while not myWorld.emptyLocation(x, y):
            x = random.randrange(myWorld.getMaxX())
            y = random.randrange(myWorld.getMaxY())

        myWorld.addThing(newBerry, x, y)
        
    for i in range(numberOfBears):
        newbear = Bear()
        x = random.randrange(myWorld.getMaxX())
        y = random.randrange(myWorld.getMaxY())
        while not myWorld.emptyLocation(x, y):
            x = random.randrange(myWorld.getMaxX())
            y = random.randrange(myWorld.getMaxY())
            
        myWorld.addThing(newbear, x, y)
    
    for i in range(numberOfTurns):
        myWorld.liveALittle()

    #while True:
        #myWorld.liveALittle()

    myWorld.freezeWorld()
Exemple #7
0
 def __init__(self, rect=None, color=None, deathSound=None):
     Fish.__init__(self, rect, color, deathSound)
     Prey.count += 1
     self.preyID = Prey.count
     self.MAX_SPEED_X = 9.0
     self.MAX_SPEED_Y = 9.0
 def destroy(self):
     self.fishUINodePath.removeNode()
     Fish.destroy(self)
Exemple #9
0
from Bird import Bird
from Fish import Fish
from Mammal import Mammal
from Reptile import Reptile
from OfficialPrice import OfficialPrice
from BlackMarketPrice import BlackMarketPrice
from VetDiagnosis import VetDiagnosis


if __name__ == '__main__':
    bird = Bird('Ptak', 100, True, 150)
    fish = Fish('Ryba', 10, False)
    mammal = Mammal('Ssak', 1000, False)
    raptile = Reptile('Gad', 999, True)
    bird2 = Bird('Ptak', 100, False, 110)

    animals = [bird, fish, mammal, raptile, bird2]

    for animal in animals:
        print(animal)

    officialPrice = OfficialPrice()
    blackMarketPrice = BlackMarketPrice()
    vetDiagnosis = VetDiagnosis()

    for animal in animals:
        animal.Accept(officialPrice)
        animal.Accept(blackMarketPrice)

    print('\n\n\t\tCeny odwiedzonych zwierzat')