예제 #1
0
def test_pin(fen, pv, expected_contains_tactic, expected_is_first_move_tactic):
    assert (Tactic.PIN in features.BestMove(
        fen, pv[0])._tactics()) == expected_is_first_move_tactic
    assert (Tactic.PIN in features.BestPV(
        fen, pv)._best_pv_tactics()) == expected_contains_tactic
예제 #2
0
def test_best_pv_moved_piece_types(fen, pv, our_expected, their_expected):
    f = features.BestPV(fen, pv)
    assert f.features()["best_pv_our_moved_piece_types"] == our_expected
    assert f.features()["best_pv_their_moved_piece_types"] == their_expected
예제 #3
0
def test_discovered_attack(fen, pv, expected_contains_tactic,
                           expected_is_first_move_tactic):
    assert (Tactic.DISCOVERED_ATTACK in features.BestMove(
        fen, pv[0])._tactics()) == expected_is_first_move_tactic
    assert (Tactic.DISCOVERED_ATTACK in features.BestPV(
        fen, pv)._best_pv_tactics()) == expected_contains_tactic
예제 #4
0
def test_sacrifice(fen, pv, expected_contains_tactic,
                   expected_is_first_move_tactic):
    assert (Tactic.SACRIFICE in features.BestMove(
        fen, pv[0])._tactics()) == expected_is_first_move_tactic
    assert (Tactic.SACRIFICE in features.BestPV(
        fen, pv)._best_pv_tactics()) == expected_contains_tactic