Created
January 23, 2024 16:23
-
-
Save msterhuj/bbf503d0cdb0360f5669f2f256aae025 to your computer and use it in GitHub Desktop.
calculate the number of block to reduce based on days and required size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start_day = 5 | |
finish_day = 10 | |
start_radius = 6100 | |
finish_radius = 250 | |
def calculate_radius(day): | |
blocks_to_reduce_per_day = (start_radius - finish_radius) / (finish_day - start_day) | |
if day < start_day: | |
return start_radius | |
reduse = start_radius - blocks_to_reduce_per_day * (day - start_day) | |
print("Calculating radius for day", day, ":", reduse) | |
if reduse < finish_radius: | |
reduse = finish_radius | |
return reduse | |
for day in range(0, 20 + 1): | |
radius = calculate_radius(day) | |
print(f"day {day}: raduis {radius}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment