def test_1(self): board = _init_test_board() pf = ChainPathfinder(board) path = pf.find_path(PLAYER_ONE, 6, 0, 6, 6) assert compare_paths(path, [(6, 0), (3, 3), (4, 2), (5, 1), (3, 4), (6, 6)])
def test_2(self): board = _init_test_board() board.set_cell(4, 0, PLAYER_ONE) board.set_cell(1, 2, PLAYER_NONE) pf = ChainPathfinder(board) path = pf.find_path(PLAYER_ONE, 6, 0, 6, 6) assert compare_paths(path, [(6, 0), (5, 0), (1, 2), (3, 4), (6, 6)])
def test_5(self): board = Board(7, 7) board.set_cell(5, 3, PLAYER_ONE) board.set_cell(6, 3, PLAYER_ONE) board.set_cell(6, 4, PLAYER_ONE) pf = ChainPathfinder(board) path = pf.find_path(PLAYER_ONE, 6, 0, 6, 6) assert compare_paths(path, [(6, 0), (6, 2), (6, 1), (6, 5), (6, 6)])
def test_3(self): board = Board(3, 3) board.set_cell(0, 1, PLAYER_TWO) board.set_cell(1, 1, PLAYER_TWO) board.set_cell(2, 1, PLAYER_TWO) pf = ChainPathfinder(board) path = pf.find_path(PLAYER_ONE, 0, 0, 2, 2) assert len(path) == 0
def test_6(self): board = Board(7, 7) board.set_cell(3, 0, PLAYER_ONE) board.set_cell(4, 0, PLAYER_ONE) board.set_cell(5, 1, PLAYER_ONE) board.set_cell(5, 2, PLAYER_ONE) board.set_cell(6, 3, PLAYER_ONE) board.set_cell(6, 4, PLAYER_ONE) pf = ChainPathfinder(board) path = pf.find_path(PLAYER_ONE, 0, 0, 6, 6) assert compare_paths(path, [(0, 0), (2, 0), (1, 0), (5, 0), (6, 2), (6, 5), (6, 6)])
def test_8(self): board = Board(7, 7) board.set_cell(1, 4, PLAYER_ONE) board.set_cell(2, 4, PLAYER_ONE) board.set_cell(3, 4, PLAYER_ONE) board.set_cell(4, 4, PLAYER_ONE) board.set_cell(1, 5, PLAYER_ONE) board.set_cell(1, 6, PLAYER_ONE) board.set_cell(2, 6, PLAYER_ONE) pf = ChainPathfinder(board) path = pf.find_path(PLAYER_ONE, 6, 6, 0, 6) assert compare_paths(path, [(0, 6), (3, 6), (4, 6), (5, 6), (6, 6)])
def test_4(self): board = Board(7, 7) board.set_cell(5, 1, PLAYER_ONE) board.set_cell(4, 2, PLAYER_ONE) board.set_cell(6, 5, PLAYER_ONE) board.set_cell(5, 5, PLAYER_ONE) board.set_cell(4, 5, PLAYER_ONE) board.set_cell(3, 5, PLAYER_ONE) board.set_cell(2, 5, PLAYER_ONE) board.set_cell(1, 5, PLAYER_ONE) pf = ChainPathfinder(board) path = pf.find_path(PLAYER_ONE, 6, 0, 6, 6) assert compare_paths(path, [(6, 0), (4, 4), (4, 3), (6, 6)])
def test_9(self): board = Board(7, 7) board.set_cell(1, 4, PLAYER_ONE) board.set_cell(1, 5, PLAYER_ONE) board.set_cell(1, 6, PLAYER_ONE) board.set_cell(2, 6, PLAYER_ONE) board.set_cell(5, 3, PLAYER_ONE) board.set_cell(6, 2, PLAYER_ONE) board.set_cell(6, 1, PLAYER_ONE) board.set_cell(5, 1, PLAYER_ONE) board.set_cell(3, 1, PLAYER_ONE) board.set_cell(2, 1, PLAYER_ONE) board.set_cell(1, 2, PLAYER_ONE) pf = ChainPathfinder(board) path = pf.find_path(PLAYER_ONE, 5, 5, 0, 3) assert compare_paths(path, [(5, 5), (5, 4), (4, 1), (0, 3)])