def test_is_alive_at_not_dependent_on_location_instance(self): coordinates = (0, 0) self.location = Location(*coordinates) world = World() world.set_living_at(self.location) location = Location(*coordinates) self.assertTrue(world.is_alive_at(location))
def _get_stable_world(): world = World() stable_location_cluster = _get_location_cluster( Cell.STABLE_NEIGHBOR_RANGE[0] + 1) for location in stable_location_cluster: world.set_living_at(location) return world
def test_can_get_cell_at_location(self): world = World() world.set_living_at(self.location) self.assertIsInstance(world.get_cell_at(self.location), Cell)
def test_a_cell_can_be_set_dead_at_location_if_already_dead(self): world = World() world.set_living_at(self.location) world.set_dead_at(self.location) world.set_dead_at(self.location) self.assertFalse(world.is_alive_at(self.location))
def test_a_cell_can_be_added_to_the_world(self): world = World() world.set_living_at(self.location) self.assertTrue(world.is_alive_at(self.location))
def test_a_world_with_a_living_cell_is_not_empty(self): world = World() world.set_living_at(self.location) self.assertFalse(world.is_empty)