Пример #1
0
 def testWorld_ThreeCells_OneLives(self):
     world = World()
     world.activate(2, 1)
     world.activate(2, 2)
     world.activate(1, 2)
     world.nextGeneration()
     self.assertEqual(world.get(1, 1), Alive)
Пример #2
0
 def testWorld_nextGenUpdatesWorldAllTogether(self):
     world = World()
     world.activate(1, 1)
     world.activate(3, 1)
     world.activate(2, 2)
     world.nextGeneration()
     self.assertEqual(world.get(2, 1), Alive)
Пример #3
0
 def testWorld_2Neighbour(self):
     world = World()
     world.activate(1,1)
     world.activate(1, 2)
     world.activate(2, 1)
     self.assertEqual(world.neighbours(1, 1), 2)
     self.assertEqual(world.neighbours(2, 1), 2)
     self.assertEqual(world.neighbours(1, 2), 2)
Пример #4
0
 def testWorld_Test(self):
     world = World()
     world.activate(1, 1)
     world.nextGeneration()
     self.assertEqual(world.get(1, 1), Dead)
Пример #5
0
 def testWorld_getMethod(self):
     world = World()
     self.assertEqual(world.get(1, 1), Dead)
Пример #6
0
def start():
    world = World()
    randomCells(world)
    return world
Пример #7
0
 def __init__(self, size=256):
     super().__init__(size)
     self.world = World()
     self.camera = Camera()
     self.sprites = Sprites