Merge pull request #1 from Huy-Ngo/fix-floating-point

fix precision to first decimal place
This commit is contained in:
~creme 2022-06-14 23:11:08 +02:00 committed by GitHub
commit 30b0dd9316
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -354,7 +354,7 @@ class Plant(object):
# Do something else
pass
# 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)
time.sleep(adjusted_sleep_time)
@ -455,7 +455,7 @@ class DataManager(object):
self.last_water_gain = time.time()
else:
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
def plant_age_convert(self,this_plant):