예제 #1
0
def test_part1():
    with open('input.txt', 'r') as file:
        map = file.readlines()
    map = [line.strip() for line in map]
    vmap = VirusMap(map)
    vmap.do_bursts(10000)
    assert vmap.infection_counter == 5305
예제 #2
0
def test_burst(n, string):
    with open('test_input.txt', 'r') as file:
        map = file.readlines()
    map = [line.strip() for line in map]
    vmap = VirusMap(map)
    vmap.do_bursts(n)
    assert string_to_pattern(string) == vmap
예제 #3
0
def test_evolved_10million():
    with open('test_input.txt', 'r') as file:
        map = file.readlines()
    map = [line.strip() for line in map]
    vmap = VirusMap(map, evolved=True)
    vmap.do_bursts(10000000)
    assert vmap.infection_counter == 2511944
예제 #4
0
def string_to_pattern(string):
    return VirusMap(string.split('\n'))