Virus

an anonymous user · January 26, 2023
generation_time = 60
max_ticks = 879
geration_count = max_ticks // generation_time

# start with a single baby virus
virus_ages = [0]

for _ in range(geration_count):
    ## Age each virus by a generation
    virus_ages = [v+1 for v in virus_ages]

    ## viruses older than one spawn a new virus
    virus_ages.extend([0 for v in virus_ages if v != 1])

print(len(virus_ages))


Output
(Run the program to view its output)

Comments

Please sign up or log in to contribute to the discussion.