Ejemplo n.º 1
0
def test_nonogram_init():
    string_box = ['.ooo.', '.....', '.....', '.....', '.....']

    nonogram = Nonogram()
    nonogram.init_from_solution_string(string_box)

    assert len(nonogram.rows_constraints) == 5
    assert len(nonogram.cols_constraints) == 5
    assert nonogram.rows_constraints[0] == [3]
    assert nonogram.rows_constraints[1:] == [[], [], [], []]
    assert nonogram.cols_constraints[0] == []
    assert nonogram.cols_constraints[1:4] == [[1], [1], [1]]
    assert nonogram.cols_constraints[4] == []
    assert sorted(nonogram.solution_list) == [(0, 1), (0, 2), (0, 3)]
Ejemplo n.º 2
0
def simple_nonogram_from_string_box():
    string_box = ['o..o.', '..o.o', '..oo.', '.o..o', 'o...o']

    nonogram = Nonogram()
    nonogram.init_from_solution_string(string_box)
    return nonogram