def test_diehard_generations(): diehard = from_string(""" ======================================== | | | | | | | | | | | | | x | | xx | | x xxx | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ======================================== """) gens = rules.generations(diehard) gens = islice(gens, 200) gens = rules.take_while_changing(gens) assert_equals(131, len(list(gens)))
def test_board_from_string(): assert_equals(example, board.from_string(""" ============ | xxx | | x | | xx x | | xx | | xx | | xxxxx | | | ============ """))
def test_board_to_from_string(): assert_equals(example, board.from_string(board.to_string(example)))