def test_get_neighbors_corner(self): game = GameOfLife(xsize=3, ysize=3) neighbors = game.get_neighbors(0, 0) self.assertEqual(len(neighbors), 3) self.assertIn((0, 1), neighbors) self.assertIn((1, 0), neighbors) self.assertIn((1, 1), neighbors)
def main(): # Initialisation de pygame pygame.init() # Creation d'un window builder builder = WindowBuilder(1000) builder.makeWindow() builder.createGrid() # Creation d'un modifier modifier = WindowModifier(builder.fenetre, builder.rect_width, builder.rect_height, builder.margin) # Controleur de la boucle continuer = True gameOn = False while continuer: for event in pygame.event.get(): if event.type == QUIT: continuer = False if event.type == MOUSEBUTTONDOWN and event.button == 1: modifier.modifyColors(event.pos[0], event.pos[1]) if event.type == KEYDOWN and event.key == K_SPACE: game = GameOfLife(modifier) gameOn = not gameOn if gameOn: game.nextGen() modifier.colors = game.colors time.sleep(0.3) modifier.redrawGrid()
def __init__(self): self.survive_min = 5 # Cycle self.surival_record = 0 self.designer = CellDesigner() self.gene_bank = GeneBank() self.game = GameOfLife() self.sense = SenseHat()
def birth(gl: GameOfLife, value: int, index: Tuple[int, int]): neighbors = gl.get_neighbors(index) count = gl.count_neighbors(neighbors) if count == 3: return 1 return value
def test_step_rule_4(self): initial_state = [[0, 1, 0], [0, 1, 1], [0, 0, 0]] next_state = np.array([[0, 1, 1], [0, 1, 1], [0, 0, 0]]) game = GameOfLife(initial_state=initial_state) game.step() game_state = game.get_state() self.assertTrue(np.array_equal(game_state, next_state))
def test_run(self): initial_state = [[1, 1, 1], [1, 1, 1], [1, 1, 1]] final_state = np.array([[0, 0, 0], [0, 0, 0], [0, 0, 0]]) game = GameOfLife(initial_state=initial_state) game.run(generations=2) game_state = game.get_state() self.assertTrue(np.array_equal(game_state, final_state))
def test_gen_world(rules): gl = GameOfLife(rules) shape = (50, 50) w = gl.gen_world(shape) assert w.shape == shape shape = (20, 50) w = gl.gen_world(shape) assert w.shape == shape
def test_cell_with_less_than_two_neighbours_dies(self): expect = [[False, False, False], [False, False, False], [False, False, False]] board = [[False, False, False], [True, True, False], [False, False, False]] gameoflife = GameOfLife(board) gameoflife.nextGen() self.assertEqual(expect, gameoflife.board)
def test_cell_with_two_neighbours_lives(self): board = [[True, False, False], [False, True, False], [False, False, True]] expect = [[False, False, False], [False, True, False], [False, False, False]] gameoflife = GameOfLife(board) gameoflife.nextGen() self.assertEqual(expect, gameoflife.board)
def toad(): game = GameOfLife(6) game.add_living_cell(2, 2) game.add_living_cell(3, 2) game.add_living_cell(4, 2) game.add_living_cell(1, 3) game.add_living_cell(2, 3) game.add_living_cell(3, 3) return game
def test_get_neighbors_with_focal(self): game = GameOfLife(xsize=3, ysize=3) game.set_include_focal() neighbors = game.get_neighbors(1, 0) self.assertEqual(len(neighbors), 6) self.assertIn((0, 0), neighbors) self.assertIn((0, 1), neighbors) self.assertIn((1, 0), neighbors) self.assertIn((1, 1), neighbors) self.assertIn((2, 0), neighbors) self.assertIn((2, 1), neighbors)
def beacon(): game = GameOfLife(6) game.add_living_cell(1, 1) game.add_living_cell(2, 1) game.add_living_cell(1, 2) game.add_living_cell(4, 3) game.add_living_cell(3, 4) game.add_living_cell(4, 4) return game
def test_get_neighbors(self): game = GameOfLife(xsize=3, ysize=3) neighbors = game.get_neighbors(1, 1) self.assertEqual(len(neighbors), 8) self.assertIn((0, 0), neighbors) self.assertIn((0, 1), neighbors) self.assertIn((0, 2), neighbors) self.assertIn((1, 0), neighbors) self.assertIn((1, 2), neighbors) self.assertIn((2, 0), neighbors) self.assertIn((2, 1), neighbors) self.assertIn((2, 2), neighbors)
def initialise(self): self.title('Game Of Life') self.grid() # leave at defaults for a 2 dimensional game of life with # John Conway standard rules (3/23) self.gol = GameOfLife() self.create_widgets() self.bindings() self.reset() self.reset_colour()
def setUp(self): self.game = GameOfLife(10) self.game.add_living_cell(1, 1) self.game.add_living_cell(2, 1) self.game.add_living_cell(3, 1) self.game.add_living_cell(1, 2) self.game.add_living_cell(3, 2) self.game.add_living_cell(1, 3) self.game.add_living_cell(2, 3) self.game.add_living_cell(3, 3) self.game.add_living_cell(4, 4)
def test_tick_glider(): state_0 = [(0, 0), (2, 0), (1, 1), (2, 1), (1, 2)] state_1 = [(2, 0), (0, 1), (2, 1), (1, 2), (2, 2)] state_2 = [(1, 0), (2, 1), (3, 1), (1, 2), (2, 2)] state_3 = [(2, 0), (3, 1), (1, 2), (2, 2), (3, 2)] state_4 = [(1, 1), (3, 1), (2, 2), (3, 2), (2, 3)] gof = GameOfLife(seed=state_0) gof.tick() assert all(cell in gof.state for cell in state_1) gof.tick() assert all(cell in gof.state for cell in state_2) gof.tick() assert all(cell in gof.state for cell in state_3) gof.tick() assert all(cell in gof.state for cell in state_4)
def main(): game = GameOfLife() sense = SenseHat() # cells = [ (2, 4), (3, 5), (4, 3), (4, 4), (4, 5) ] cells = [(2, 4), (2, 5), (1, 5), (1, 6), (3, 5)] game.set_cells(cells) while True: try: canvas = [] for i in game.world: if not i: canvas.append(WHITE) else: canvas.append(RED) sense.set_pixels(canvas) game.run() if not game.everyone_alive(): sense.clear() print("everyone died") break time.sleep(0.1) except: sense.clear() break
def __init__(self): self.window = Tk() self.window.title = "Game of Life" self.window.geometry("1100x950") self.window.config(background='brown') # Init variables. self.variables() # Init frames. self.frame = Frame(self.window, bg='red') self.frame_sim = Frame(self.frame, bg='green', border=1) self.frame_time = Frame(self.frame_sim, bg="yellow", border=1) # Create all of widgets. self.create_widgets() # Pack. self.frame.pack(expand=YES) self.frame_sim.grid(pady=40, row=0, column=1, sticky=N) self.frame_time.pack(expand=YES) # Core. self.core = GameOfLife(113, 113)
def test_count_neighbors(rules, world, world_single): gl = GameOfLife(rules, world_single) neighbors = gl.get_neighbors((1, 1)) count = gl.count_neighbors(neighbors) assert count == 3 gl.world = world neighbors = gl.get_neighbors((0, 0)) count = gl.count_neighbors(neighbors) assert count == 2
class TestIsAlive(unittest.TestCase): def setUp(self): self.game = GameOfLife(5) self.game.add_living_cell(1, 2) self.game.add_living_cell(2, 2) self.game.add_living_cell(2, 1) def test_that_it_returns_false_if_cell_was_not_added(self): self.assertEqual(self.game.is_alive(2, 3), False) def test_that_it_returns_true_if_cell_was_not_added(self): self.assertEqual(self.game.is_alive(1, 2), True) def test_that_it_validates_coordinates(self): with self.assertRaises(ValueError): self.game.is_alive(- 1, 2)
def test_tick_blinker(): state_1 = [(1, 0), (1, 1), (1, 2)] state_2 = [(0, 1), (1, 1), (2, 1)] gof = GameOfLife(seed=state_1) gof.tick() assert all(cell in gof.state for cell in state_2) gof.tick() assert all(cell in gof.state for cell in state_1)
class TestIsAlive(unittest.TestCase): def setUp(self): self.game = GameOfLife(5) self.game.add_living_cell(1, 2) self.game.add_living_cell(2, 2) self.game.add_living_cell(2, 1) def test_that_it_returns_false_if_cell_was_not_added(self): self.assertEqual(self.game.is_alive(2, 3), False) def test_that_it_returns_true_if_cell_was_not_added(self): self.assertEqual(self.game.is_alive(1, 2), True) def test_that_it_validates_coordinates(self): with self.assertRaises(ValueError): self.game.is_alive(-1, 2)
def main(): game = GameOfLife() # cells = [ (2, 4), (3, 5), (4, 3), (4, 4), (4, 5) ] cells = [ (2, 4), (2, 5), (1,5 ), (1, 6), (3, 5)] game.set_cells(cells) while True: try: game.print_world() game.run() if not game.everyone_alive(): print("everyone died") break time.sleep(0.1) except: break
class TestAddLivingCellMethod(unittest.TestCase): def setUp(self): self.game = GameOfLife(5) def test_that_it_raises_value_error_when_x_is_not_in_range(self): with self.assertRaises(ValueError): self.game.add_living_cell(5, 0) def test_that_it_raises_value_error_when_y_is_not_in_range(self): with self.assertRaises(ValueError): self.game.add_living_cell(2, 5) def test_that_it_raises_value_error_when_both_are_not_in_range(self): with self.assertRaises(ValueError): self.game.add_living_cell(7, 5) def test_that_it_returns_true_when_both_are_good(self): self.assertEqual(self.game.add_living_cell(2, 3), True)
class TestGameOfLife(TestCase): def setUp(self): self.game = GameOfLife() def test_if_any_cell_with_less_than_two_neighbours_dies(self): self.evolve([(0,0)]) self.assert_dead((0,0)) self.evolve([(0,0),(1,0)]) self.assert_dead((1,0)) def test_if_any_cell_with_two_or_three_neighbours_survives(self): self.evolve([ (1,1),(2,1), (0,2),(1,2)]) self.assert_alive((0,2)) self.assert_alive((1,2)) def test_if_any_cell_with_more_than_three_neighbours_dies(self): self.evolve([(0,1),(1,1),(2,1), (0,2),(1,2),(2,2)]) self.assert_dead((1,1)) self.assert_dead((1,2)) def test_if_any_dead_cell_with_exactly_three_neighbours_becomes_alive(self): self.evolve([ (1,1),(2,1), (0,2),(1,2) ]) self.assert_alive((0,1)) self.assert_alive((2,2)) def evolve(self,cells): self.next_generation = self.game.evolve(cells) def assert_dead(self,cell): self.assertFalse(cell in self.next_generation) def assert_alive(self,cell): self.assertTrue(cell in self.next_generation)
def test_that_neighbours_count_is_0(self): self.game = GameOfLife(10) self.assertEqual(self.game.neighbours_count(1, 2), 0) self.assertEqual(self.game.neighbours_count(2, 2), 0) self.assertEqual(self.game.neighbours_count(3, 2), 0) self.assertEqual(self.game.neighbours_count(4, 2), 0)
class TestNeighboursCount(unittest.TestCase): def setUp(self): self.game = GameOfLife(5) self.game.add_living_cell(1, 2) self.game.add_living_cell(2, 2) self.game.add_living_cell(1, 2) def test_that_neighbours_count_is_0(self): self.game = GameOfLife(10) self.assertEqual(self.game.neighbours_count(1, 2), 0) self.assertEqual(self.game.neighbours_count(2, 2), 0) self.assertEqual(self.game.neighbours_count(3, 2), 0) self.assertEqual(self.game.neighbours_count(4, 2), 0) def test_that_neighbours_count_is_1(self): self.game = GameOfLife(10) self.assertEqual(self.game.neighbours_count(1, 2), 0) self.game.add_living_cell(0, 0) self.assertEqual(self.game.neighbours_count(1, 0), 1) def test_that_neighbours_count_is_2(self): self.game.add_living_cell(0, 2) self.assertEqual(self.game.neighbours_count(1, 2), 2) def test_that_neighbours_count_is_3(self): self.game.add_living_cell(0, 3) self.assertEqual(self.game.neighbours_count(1, 3), 3) def test_that_neighbours_count_is_8(self): self.game.add_living_cell(1, 1) self.game.add_living_cell(2, 1) self.game.add_living_cell(3, 1) self.game.add_living_cell(1, 2) self.game.add_living_cell(3, 2) self.game.add_living_cell(1, 3) self.game.add_living_cell(2, 3) self.game.add_living_cell(3, 3) self.assertEqual(self.game.neighbours_count(2, 2), 8)
def setUp(self): self.game = GameOfLife(5) self.game.add_living_cell(1, 2) self.game.add_living_cell(2, 2) self.game.add_living_cell(1, 2)
def setUp(self): self.game = GameOfLife(5)
from gameoflife import GameOfLife ##Blinker pattern gameblinker=GameOfLife(6,6) gameblinker.seeds([(0,1),(1,1),(2,1)]) input=raw_input('press enter to display next cycle, press q to exit! :') while input!='q': gameblinker.nextGenCheck() input=raw_input('press enter to display next cycle, press q to exit! :') ##block pattern gameblock=GameOfLife(6,6) gameblock.seeds([(0,0),(0,1),(1,0),(1,1)]) input=raw_input('press enter to display next cycle, press q to exit! :') while input!='q': gameblock.nextGenCheck() input=raw_input('press enter to display next cycle, press q to exit! :')
from gameoflife import GameOfLife def draw(cells): rows = [] for x in range(-60, 60): row = [] for y in range(-60, 60): if (y, x) in cells: row.append('##') else: row.append(' ') rows.append(''.join(row)) print '\n'.join(rows) if __name__ == "__main__": from time import sleep cells = [(1,1), (1,2), (3,2), (2,4), (1,5), (1,6), (1,7)] while True: game = GameOfLife(start=cells) game.tick() cells = game.cells draw(cells) sleep(0.03)
def test_die(): alive_cell = (1, 4) seed = [alive_cell, (6, 7)] gof = GameOfLife(seed=seed) gof.die(alive_cell) assert alive_cell not in gof.state
class TestReproduction(unittest.TestCase): def setUp(self): self.game = GameOfLife(10) self.game.add_living_cell(1, 1) self.game.add_living_cell(2, 1) self.game.add_living_cell(3, 1) self.game.add_living_cell(1, 2) self.game.add_living_cell(3, 2) self.game.add_living_cell(1, 3) self.game.add_living_cell(2, 3) self.game.add_living_cell(3, 3) self.game.add_living_cell(4, 4) def test_that_dead_cell_3_neighbours_becomes_alive(self): self.assertEqual(self.game.is_alive(4, 2), False) self.assertEqual(self.game.neighbours_count(4, 2), 3) self.game.evolve() self.assertEqual(self.game.is_alive(4, 2), True) def test_that_dead_cell_without_3_neighbours_stays_dead(self): self.game.add_living_cell(4, 3) self.assertEqual(self.game.is_alive(4, 2), False) self.assertEqual(self.game.neighbours_count(4, 2), 4) self.game.evolve() self.assertEqual(self.game.is_alive(4, 2), False)
class TestDrawMatrix(unittest.TestCase): def setUp(self): self.game = GameOfLife(10) self.game.add_living_cell(1, 1) self.game.add_living_cell(2, 1) self.game.add_living_cell(3, 1) self.game.add_living_cell(1, 2) self.game.add_living_cell(3, 2) self.game.add_living_cell(1, 3) self.game.add_living_cell(2, 3) self.game.add_living_cell(3, 3) self.game.add_living_cell(4, 4)
class TestLiveCellThatLivesForNextGeneration(unittest.TestCase): def setUp(self): self.game = GameOfLife(10) self.game.add_living_cell(1, 1) self.game.add_living_cell(2, 1) self.game.add_living_cell(3, 1) self.game.add_living_cell(1, 2) self.game.add_living_cell(3, 2) self.game.add_living_cell(1, 3) self.game.add_living_cell(2, 3) self.game.add_living_cell(3, 3) self.game.add_living_cell(4, 4) def test_that_live_cell_with_two_neighbour_dosent_die(self): self.game.add_living_cell(4, 5) self.assertEqual(self.game.neighbours_count(4, 4), 2) self.assertEqual(self.game.is_alive(4, 4), True) self.game.evolve() self.assertEqual(self.game.is_alive(4, 4), True) def test_that_live_cell_with_3_neighbour_dosent_die(self): self.game.add_living_cell(4, 5) self.game.add_living_cell(4, 3) self.assertEqual(self.game.neighbours_count(4, 4), 3) self.assertEqual(self.game.is_alive(4, 4), True) self.game.evolve() self.assertEqual(self.game.is_alive(4, 4), True)
class TestOverCrowding(unittest.TestCase): def setUp(self): self.game = GameOfLife(10) self.game.add_living_cell(1, 1) self.game.add_living_cell(2, 1) self.game.add_living_cell(3, 1) self.game.add_living_cell(1, 2) self.game.add_living_cell(3, 2) self.game.add_living_cell(1, 3) self.game.add_living_cell(2, 3) self.game.add_living_cell(3, 3) self.game.add_living_cell(4, 4) def test_that_live_cell_more_then_3_neighbours_dies(self): self.game.add_living_cell(2, 2) self.assertEqual(self.game.is_alive(2, 2), True) self.assertEqual(self.game.neighbours_count(2, 2), 8) self.game.evolve() self.assertEqual(self.game.is_alive(2, 2), False)
class TestUnderPopulation(unittest.TestCase): def setUp(self): self.game = GameOfLife(10) self.game.add_living_cell(1, 1) self.game.add_living_cell(2, 1) self.game.add_living_cell(3, 1) self.game.add_living_cell(1, 2) self.game.add_living_cell(3, 2) self.game.add_living_cell(1, 3) self.game.add_living_cell(2, 3) self.game.add_living_cell(3, 3) self.game.add_living_cell(4, 4) def test_that_live_cell_with_no_neighbour_dies(self): self.game.add_living_cell(9, 9) self.assertEqual(self.game.is_alive(9, 9), True) self.assertEqual(self.game.neighbours_count(9, 9), 0) self.game.evolve() self.assertEqual(self.game.is_alive(9, 9), False) def test_that_live_cell_with_one_neighbour_dies(self): self.assertEqual(self.game.is_alive(4, 4), True) self.assertEqual(self.game.neighbours_count(4, 4), 1) self.game.evolve() self.assertEqual(self.game.is_alive(4, 4), False)
#!/usr/bin/python from gameoflife import GameOfLife from time import sleep def print_grid(game): grid = game.grid for r in range(game.rows): for c in range(game.cols): print(grid[r][c], end='') print() if __name__ == '__main__': game = GameOfLife(rows=30, cols=40, live_cells_coords=[(2,3),(2,4),(2,5),(2,6),(2,7),(3,7),(4,6),(5,5),(6,4),(7,3)]) while game.num_live_cells() > 0: print_grid(game) sleep(0.3) game.tick()
class GameOfLifeTest(TestCase): def setUp(self): self.game = GameOfLife() def assertCellMarkedToLive(self, cell): self.assertIn(cell, self.game.marked_to_live) self.assertNotIn(cell, self.game.marked_to_die) def assertCellMarkedToDie(self, cell): self.assertIn(cell, self.game.marked_to_die) self.assertNotIn(cell, self.game.marked_to_live) @mock.patch.object(GameOfLife, 'set_initial') def test_new_sets_initial_containers(self, set_initial): game = GameOfLife() set_initial.assert_called_once_with() def test_set_initial(self): self.assertEqual(self.game.marked_to_live, []) self.assertEqual(self.game.marked_to_die, []) self.assertEqual(self.game.neighbor_counts, {}) def test_tick_fires_process_cell_on_each_cell(self): self.game.cells = [(1,1), (1,4), (44,54), (124,54)] self.game.process_cell = mock.Mock() calls = [mock.call(cell) for cell in self.game.cells] self.game.tick() self.game.process_cell.assert_has_calls(calls) def test_tick_makes_marked_cells_die(self): self.game.kill_marked_cells = mock.Mock() self.game.tick() self.game.kill_marked_cells.assert_called_once_with() def test_tick_spawns_correct_cells(self): self.game.spawn_cells= mock.Mock() self.game.tick() self.game.spawn_cells.assert_called_once_with() def test_tick_sets_initial(self): self.game.set_initial = mock.Mock() self.game.tick() self.game.set_initial.assert_called_once_with() def test_process_cell_increase_neighbor_counters(self): cell = (1, 1) self.game.cells = [cell] self.game.increase_neighbors_counts = mock.Mock(return_value=True) self.game.process_cell(cell) self.game.increase_neighbors_counts.assert_called_once_with(cell) def test_increase_neighbor_counts(self): self.game.neighbor_counts = { (0, 1): 1, (1, 1): 1, (2, 2): 0, } self.game.increase_neighbors_counts((2, 1)) expected = { (0, 1): 1, (1, 1): 2, (2, 2): 1, } self.assertDictContainsSubset(expected, self.game.neighbor_counts) def test_process_cell_marks_to_die_if_should_die(self): cell = (1, 1) self.game.cells = [cell] self.game.should_die = mock.Mock(return_value=True) self.game.process_cell(cell) self.assertCellMarkedToDie(cell) def test_should_die_true_if_lone(self): cell = (1, 1) self.game.cells = [cell] self.assertTrue(self.game.should_die(cell)) def test_should_die(self): cell = (1, 1) samples = { True: (0, 1, 4, 5, 6, 7, 8), False: (2, 3), } self.game.live_neighbors_count = mock.Mock() for expected, counts in samples.items(): for c in counts: self.game.live_neighbors_count.return_value = c self.assertEqual(expected, self.game.should_die(cell)) def test_should_die_true_if_one_neighbor(self): cell = (1, 1) self.game.cells = [cell, (2, 2), (50, 30)] self.game.should_die(cell) self.assertTrue(self.game.should_die(cell)) def test_should_die_false_if_2_neighbors(self): cell = (1, 1) self.game.cells = [cell, (1, 2), (2, 2), (50, 30)] self.assertFalse(self.game.should_die(cell)) def test_live_neighbors_count(self): cell = (1, 1) samples = { (cell,): 0, (cell, (2, 2), (50, 30)): 1, (cell, (2, 2), (0, 0), (50, 30)): 2, (cell, (0, 0), (0, 1), (2, 1), (2, 2), (1, 0), (50, 30)): 5, } for sample, expected in samples.items(): self.game.cells = sample result = self.game.live_neighbors_count(cell) self.assertEqual(result, expected) def test_get_neighbors_coordinates(self): result = self.game.get_neighbors_coordinates((1, 1)) expected = [ (0, 0), (0, 1), (0, 2), (1, 0), (1, 2), (2, 0), (2, 1), (2, 2), ] self.assertEqual(result, expected) def test_kill_marked_cells(self): self.game.cells = [(1, 1), (1, 2), (2, 2), (50, 30)] self.game.marked_to_die = [(1, 1), (2, 2)] self.game.kill_marked_cells() expected = [(1, 2), (50, 30)] self.assertItemsEqual(self.game.cells, expected) def test_spawn_cells(self): self.game.populate_marked_to_live = mock.Mock() self.game.give_birth = mock.Mock() self.game.spawn_cells() self.game.populate_marked_to_live.assert_called_once_with() self.game.give_birth.assert_called_once_with() def test_populate_marked_to_live(self): self.game.neighbor_counts = { (1, 1): 2, (1, 3): 3, (0, 2): 1, (4, 5): 8, (3, 12): 3, } self.game.populate_marked_to_live() expected = [(1,3), (3,12)] self.assertItemsEqual(self.game.marked_to_live, expected) def test_give_birth(self): self.game.cells = [(1, 1), (1, 2), (2, 2), (50, 30)] self.game.marked_to_live = [(2, 1), (4, 2)] expected = self.game.cells + self.game.marked_to_live self.game.give_birth() self.assertItemsEqual(self.game.cells, expected)
def test_that_neighbours_count_is_1(self): self.game = GameOfLife(10) self.assertEqual(self.game.neighbours_count(1, 2), 0) self.game.add_living_cell(0, 0) self.assertEqual(self.game.neighbours_count(1, 0), 1)
def test_init(): seed = [(1, 4), (6, 7)] gof = GameOfLife(seed=seed) assert seed == gof.state
def test_is_alive(): alive_cell = (1, 4) seed = [alive_cell, (6, 7)] gof = GameOfLife(seed=seed) assert gof.is_alive(alive_cell)
def blinker(): game = GameOfLife(6) game.add_living_cell(3, 2) game.add_living_cell(3, 3) game.add_living_cell(3, 4) return game
def test_live(): alive_cell = (1, 4) seed = [(6, 7)] gof = GameOfLife(seed=seed) gof.live(alive_cell) assert alive_cell in gof.state
def test_get_neighbors_count(neighbors, count): alive_cell = (3, 3) seed = [alive_cell] + neighbors gof = GameOfLife(seed=seed) assert gof.get_neighbors_count(alive_cell) == count