fix precision to first decimal place
fix precision to first decimal place to avoid floating-point errorpull/47/head
parent
38f7f17b66
commit
4ba1d6d46a
|
@ -354,7 +354,7 @@ class Plant(object):
|
||||||
# Do something else
|
# Do something else
|
||||||
pass
|
pass
|
||||||
# TODO: event check
|
# TODO: event check
|
||||||
generation_bonus = 0.2 * (self.generation - 1)
|
generation_bonus = round(0.2 * (self.generation - 1), 1)
|
||||||
adjusted_sleep_time = 1 / (1 + generation_bonus)
|
adjusted_sleep_time = 1 / (1 + generation_bonus)
|
||||||
time.sleep(adjusted_sleep_time)
|
time.sleep(adjusted_sleep_time)
|
||||||
|
|
||||||
|
@ -455,7 +455,7 @@ class DataManager(object):
|
||||||
self.last_water_gain = time.time()
|
self.last_water_gain = time.time()
|
||||||
else:
|
else:
|
||||||
ticks_to_add = 0
|
ticks_to_add = 0
|
||||||
this_plant.ticks += ticks_to_add * (0.2 * (this_plant.generation - 1) + 1)
|
this_plant.ticks += ticks_to_add * round(0.2 * (this_plant.generation - 1) + 1, 1)
|
||||||
return this_plant
|
return this_plant
|
||||||
|
|
||||||
def plant_age_convert(self,this_plant):
|
def plant_age_convert(self,this_plant):
|
||||||
|
|
Loading…
Reference in New Issue