Пример #1
0
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)))
Пример #2
0
def test_board_from_string():
    assert_equals(example, board.from_string("""
        ============
        |    xxx   |
        |      x   |
        |  xx  x   |
        |  xx      |
        |  xx      |
        |   xxxxx  |
        |          |
        ============
    """))
Пример #3
0
def test_board_to_from_string():
    assert_equals(example, 
        board.from_string(board.to_string(example)))