Example #1
0
    def test_conway_neumann_versus_old(self):
        uni = make_universe(size=100, edge_ratio=1, init='random')
        uni2 = make_universe(size=100, edge_ratio=1, init='random')
        uni2.data = uni.data.copy()
        uni2.back = uni2.data.copy()
        testing.assert_array_equal(uni.data, uni2.data)

        conway(uni)
        testing.assert_equal(np.any(np.not_equal(uni.data, uni2.data)), True)
        conway_old(uni2)
        testing.assert_array_equal(uni.data, uni2.data)
Example #2
0
    def test_conway_wraps(self):
        uni = make_universe(size=5, edge_ratio=1, init='none')
        uni.data[0:3, 0:3] = 1
        arr2 = uni.back.copy()
        conway(uni)

        arr2[:, :] = 0
        arr2[0, 0] = 1
        arr2[2, 0] = 1
        arr2[2, 2] = 1
        arr2[0, 2] = 1
        arr2[1, 3:5] = 1
        arr2[3:5, 1] = 1

        testing.assert_array_equal(arr2, uni.data)
Example #3
0
 def setUp(self):
     self.uni = make_universe(size=100, edge_ratio=1, init='none')
Example #4
0
 def setUp(self):
     self.uni = make_universe(size=10, edge_ratio=1, init='none')
     self.uni.data[1:3, 1:3] = 1
     self.uni.back = self.uni.data
Example #5
0
 def test_make_universe_center(self):
     uni = make_universe(init='center')
     self.assertTrue(uni.data[uni.size // 2, uni.width // 2] > 0)
Example #6
0
 def test_make_universe(self):
     uni = make_universe(100, 5, 3, 5, 1, 2, 'random')