mirror of
https://github.com/neogeek23/evo_fun.git
synced 2026-02-06 11:58:17 +00:00
Update evo.py
This commit is contained in:
parent
b98d53f723
commit
049f47c29d
15
evo.py
15
evo.py
@ -197,10 +197,8 @@ class LifeForm:
|
|||||||
stingy_roll = random.randrange(0, roll_max)
|
stingy_roll = random.randrange(0, roll_max)
|
||||||
if stingy_roll < self.stingy:
|
if stingy_roll < self.stingy:
|
||||||
self.stingy = self.stingy - 1
|
self.stingy = self.stingy - 1
|
||||||
global gifts
|
global gifts; gifts = gifts + 1
|
||||||
gifts = gifts + 1
|
global begs; begs = begs + 1
|
||||||
global begs
|
|
||||||
begs = begs + 1
|
|
||||||
|
|
||||||
def take(self, target, ammount):
|
def take(self, target, ammount):
|
||||||
if self.health + self.luck > target.health + target.luck:
|
if self.health + self.luck > target.health + target.luck:
|
||||||
@ -232,8 +230,7 @@ class LifeForm:
|
|||||||
if self.food > 0:
|
if self.food > 0:
|
||||||
target.food = target.food + round(self.food/2)
|
target.food = target.food + round(self.food/2)
|
||||||
self.food = round(self.food/2)
|
self.food = round(self.food/2)
|
||||||
global thefts
|
global thefts; thefts = thefts + 1
|
||||||
thefts = thefts + 1
|
|
||||||
|
|
||||||
def forage(self):
|
def forage(self):
|
||||||
if self.mature and self.food < self.greed*self.eat_rate:
|
if self.mature and self.food < self.greed*self.eat_rate:
|
||||||
@ -248,8 +245,7 @@ class LifeForm:
|
|||||||
luck_imapct = random.randrange(0, self.luck)
|
luck_imapct = random.randrange(0, self.luck)
|
||||||
found_ammount_found = luck_imapct*(self.skill - attempts - 1)
|
found_ammount_found = luck_imapct*(self.skill - attempts - 1)
|
||||||
self.food = self.food + found_ammount_found
|
self.food = self.food + found_ammount_found
|
||||||
global finds
|
global finds; finds = finds + 1
|
||||||
finds = finds + 1
|
|
||||||
|
|
||||||
def age(self):
|
def age(self):
|
||||||
self.lifetime = self.lifetime + 1
|
self.lifetime = self.lifetime + 1
|
||||||
@ -363,8 +359,7 @@ class LifeForm:
|
|||||||
while world[local_x][local_y] is not None:
|
while world[local_x][local_y] is not None:
|
||||||
local_x = random.randrange(0, world_size)
|
local_x = random.randrange(0, world_size)
|
||||||
local_y = random.randrange(0, world_size)
|
local_y = random.randrange(0, world_size)
|
||||||
global last_id
|
global last_id; last_id = last_id + 1
|
||||||
last_id = last_id + 1
|
|
||||||
child = LifeForm()
|
child = LifeForm()
|
||||||
child.birth(
|
child.birth(
|
||||||
x=local_x,
|
x=local_x,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user