def test_adj_diag(): simple_board = Board(10, 10, class_adjacency=AdjacencyEvaluatorCrossDiag) p1 = Pos(5, 5) p2 = Pos(6, 5) p3 = Pos(4, 4) # same : assert simple_board.is_adjacent(p1, p1) == False # cross : assert simple_board.is_adjacent(p1, p2) == True # diag : assert simple_board.is_adjacent(p1, p3) == True # none : assert simple_board.is_adjacent(p2, p3) == False
def test_adj_default(): board_adj_default_cross = Board(10, 10) p1 = Pos(5, 5) p2 = Pos(6, 5) p3 = Pos(4, 4) # cross: assert board_adj_default_cross.is_adjacent(p1, p2) == True # diag : assert board_adj_default_cross.is_adjacent(p1, p3) == False set_default_adjacency(AdjacencyEvaluatorCross) board_adj_default_cross_2 = Board(10, 10) # cross: assert board_adj_default_cross_2.is_adjacent(p1, p2) == True # diag : assert board_adj_default_cross_2.is_adjacent(p1, p3) == False set_default_adjacency(AdjacencyEvaluatorCrossDiag) board_adj_default_cross_diag = Board(10, 10) # cross: assert board_adj_default_cross_diag.is_adjacent(p1, p2) == True # diag : assert board_adj_default_cross_diag.is_adjacent(p1, p3) == True