Exemple #1
0
def test_total_non_loop():
    with open('input.txt') as f:
        initial_state = f.read()
    area = day18.Area(initial_state)
    assert area.get_total_resources(10) == 536370
Exemple #2
0
def test_part2():
    with open('input.txt') as f:
        initial_state = f.read()
    area = day18.Area(initial_state)
    n = 1000000000
    assert area.get_total_resources(n) == 190512
Exemple #3
0
def test_part1():
    with open('input.txt') as f:
        initial_state = f.read()
    area = day18.Area(initial_state)
    area.evolve(10)
    assert area.total_resources == 536370
Exemple #4
0
def test_resources():
    area = day18.Area(states[0])
    area.evolve(n=10)
    assert area.total_resources == 1147
Exemple #5
0
def check_centre_of_single_step(initial_state, expected_in_centre):
    area = day18.Area(initial_state)
    area.evolve()
    assert day18.LandType(area.layout[1, 1]) == expected_in_centre
Exemple #6
0
def test_evolution():
    area = day18.Area(states[0])
    for state in states[1:]:
        area.evolve()
        yield check_state, area, state
Exemple #7
0
def test_initial_render():
    area = day18.Area(states[0])
    assert area.render() == states[0]