Exemplo n.º 1
0
 def test_example_long(self):
     grid = Grid('..# #.. ...'.split())
     virus = Virus(grid, (1, 1))
     for _ in range(10000):
         virus._burst()
     assert virus._infect_count == 5587
Exemplo n.º 2
0
 def test_is_current_node_is_infected(self):
     grid = Grid('... .#. ...'.split())
     virus = Virus(grid, (1, 1))
     assert virus._is_current_node_infected()
     virus = Virus(grid, (0, 0))
     assert not virus._is_current_node_infected()
Exemplo n.º 3
0
 def test_move_forward(self):
     virus = Virus(None, (0, 0))
     virus._move_forward()
     assert virus._position == (0, -1)
Exemplo n.º 4
0
 def test_turn_right(self):
     virus = Virus(None, (0, 0))
     for _ in range(4):
         virus._move_forward()
         virus._turn_right()
     assert virus._position == (0, 0)
Exemplo n.º 5
0
def virus():
    grid = build_grid(['.'])
    return Virus(grid)