Example #1
0
def play_demo():
    """
    Plays demo of Game of Life over 20 turns to stdout.
    """
    world = World.random(min_location=Location(0, 0),
                         max_location=Location(20, 20),
                         cell_count=50)

    for rendering in turn_renderings(world, turns=20):
        clear_stdout()
        print(rendering)
Example #2
0
    def test_can_get_a_random_world(self):
        world = World.random(min_location=Location(0, 0),
                             max_location=Location(3, 3),
                             cell_count=12)

        self.assertEqual(world.living_cell_count, 12)