示例#1
0
def test_analyse_board():
    tiles = []
    for _ in range(9):
        tiles.append(Tile())
    board = Board(tiles)
    board.add_entangl_tile(1)
    board.add_entangl_tile(2)
    board.tiles()[1].set_move_on_tile('x1')
    board.tiles()[2].set_move_on_tile('x1')
    board.tiles()[1].set_move_on_tile('y2')
    board.tiles()[2].set_move_on_tile('y2')
    board.collapse(1, 'x1')
    assert board.analyse_board() == ['-', 'x1', 'y2', '-', '-', '-', '-', '-', '-']
示例#2
0
def test_collapse_error():
    tiles = []
    for _ in range(9):
        tiles.append(Tile())
    board = Board(tiles)
    board.add_entangl_tile(1)
    board.add_entangl_tile(2)
    board.tiles()[1].set_move_on_tile('x1')
    board.tiles()[1].set_move_on_tile('x3')
    board.tiles()[2].set_move_on_tile('x1')
    board.tiles()[1].set_move_on_tile('y2')
    board.tiles()[2].set_move_on_tile('y2')
    with pytest.raises(InvalidCollapseError):
        board.collapse(1, 'x3')
示例#3
0
def test_collapse():
    tiles = []
    for _ in range(9):
        tiles.append(Tile())
    board = Board(tiles)
    board.add_entangl_tile(1)
    board.add_entangl_tile(2)
    board.tiles()[1].set_move_on_tile('x1')
    board.tiles()[2].set_move_on_tile('x1')
    board.tiles()[1].set_move_on_tile('y2')
    board.tiles()[2].set_move_on_tile('y2')
    board.collapse(1, 'x1')
    assert board.tiles()[1].is_collapsed() is True
    assert board.tiles()[2].is_collapsed() is True