def test_originate_from_block(self):
        original_universe = ClosedUniverse.from_data([[0, 0, 0,
                                                       0], [0, 1, 1, 0],
                                                      [0, 1, 1, 0],
                                                      [0, 0, 0, 0]])

        generation = originate_from(original_universe, lambda: 1)
        actual_universe = next(generation)

        self.assertEqual(actual_universe, original_universe)
def main(screen):
    """Simulates 'The Game of Life' in a terminal using curses."""
    curses.curs_set(0)
    curses.start_color()
    curses.init_pair(1, curses.COLOR_GREEN, curses.COLOR_BLACK)

    height, width = screen.getmaxyx()[0], screen.getmaxyx()[1] // 2

    universe = WrappedUniverse.random(width, height, Cell.likely)
    life = originate_from(universe, regenerate=Cell)

    for universe in life:
        screen.addstr(0, 0, str(universe), curses.color_pair(1))
        screen.refresh()
        time.sleep(.25)