diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-05 11:38:10 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-05 11:42:24 +0100 |
| commit | 9afb1a31f456b82f87539569055a76d23d0490b4 (patch) | |
| tree | e3257504b6b59cbebd7a054ea36914aa7937cf50 | |
| parent | 9fb4d1f76660c8d82c10cb12a6feb404aaa59420 (diff) | |
| download | nissy-classic-9afb1a31f456b82f87539569055a76d23d0490b4.tar.gz nissy-classic-9afb1a31f456b82f87539569055a76d23d0490b4.zip | |
Improved HTR filtering
Diffstat (limited to '')
| -rw-r--r-- | src/steps.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/steps.c b/src/steps.c index e7e4834..88864b9 100644 --- a/src/steps.c +++ b/src/steps.c | |||
| @@ -37,7 +37,7 @@ static int estimate_nxoptlike(DfsArg *arg, PruneData *pd); | |||
| 37 | 37 | ||
| 38 | static bool always_valid(Alg *alg); | 38 | static bool always_valid(Alg *alg); |
| 39 | static bool validate_singlecw_ending(Alg *alg); | 39 | static bool validate_singlecw_ending(Alg *alg); |
| 40 | static bool validate_htr_qt(Alg *alg); | 40 | static bool validate_htr(Alg *alg); |
| 41 | 41 | ||
| 42 | /* Pre-transformation detectors **********************************************/ | 42 | /* Pre-transformation detectors **********************************************/ |
| 43 | 43 | ||
| @@ -407,7 +407,7 @@ cornershtr_HTM = { | |||
| 407 | .is_done = check_cornershtr, | 407 | .is_done = check_cornershtr, |
| 408 | .estimate = estimate_cornershtr_HTM, | 408 | .estimate = estimate_cornershtr_HTM, |
| 409 | .ready = NULL, | 409 | .ready = NULL, |
| 410 | .is_valid = validate_htr_qt, | 410 | .is_valid = validate_htr, |
| 411 | .moveset = &moveset_HTM, | 411 | .moveset = &moveset_HTM, |
| 412 | 412 | ||
| 413 | .pre_trans = uf, | 413 | .pre_trans = uf, |
| @@ -903,7 +903,7 @@ htr_any = { | |||
| 903 | .estimate = estimate_htr_drud, | 903 | .estimate = estimate_htr_drud, |
| 904 | .ready = check_drud, | 904 | .ready = check_drud, |
| 905 | .ready_msg = check_drany_msg, | 905 | .ready_msg = check_drany_msg, |
| 906 | .is_valid = validate_htr_qt, | 906 | .is_valid = validate_htr, |
| 907 | .moveset = &moveset_drud, | 907 | .moveset = &moveset_drud, |
| 908 | 908 | ||
| 909 | .detect = detect_pretrans_drud, | 909 | .detect = detect_pretrans_drud, |
| @@ -922,7 +922,7 @@ htr_drud = { | |||
| 922 | .estimate = estimate_htr_drud, | 922 | .estimate = estimate_htr_drud, |
| 923 | .ready = check_drud, | 923 | .ready = check_drud, |
| 924 | .ready_msg = check_dr_msg, | 924 | .ready_msg = check_dr_msg, |
| 925 | .is_valid = validate_htr_qt, | 925 | .is_valid = validate_htr, |
| 926 | .moveset = &moveset_drud, | 926 | .moveset = &moveset_drud, |
| 927 | 927 | ||
| 928 | .pre_trans = uf, | 928 | .pre_trans = uf, |
| @@ -941,7 +941,7 @@ htr_drrl = { | |||
| 941 | .estimate = estimate_htr_drud, | 941 | .estimate = estimate_htr_drud, |
| 942 | .ready = check_drud, | 942 | .ready = check_drud, |
| 943 | .ready_msg = check_dr_msg, | 943 | .ready_msg = check_dr_msg, |
| 944 | .is_valid = validate_htr_qt, | 944 | .is_valid = validate_htr, |
| 945 | .moveset = &moveset_drud, | 945 | .moveset = &moveset_drud, |
| 946 | 946 | ||
| 947 | .pre_trans = rf, | 947 | .pre_trans = rf, |
| @@ -960,7 +960,7 @@ htr_drfb = { | |||
| 960 | .estimate = estimate_htr_drud, | 960 | .estimate = estimate_htr_drud, |
| 961 | .ready = check_drud, | 961 | .ready = check_drud, |
| 962 | .ready_msg = check_dr_msg, | 962 | .ready_msg = check_dr_msg, |
| 963 | .is_valid = validate_htr_qt, | 963 | .is_valid = validate_htr, |
| 964 | .moveset = &moveset_drud, | 964 | .moveset = &moveset_drud, |
| 965 | 965 | ||
| 966 | .pre_trans = fd, | 966 | .pre_trans = fd, |
| @@ -1599,9 +1599,9 @@ validate_singlecw_ending(Alg *alg) | |||
| 1599 | } | 1599 | } |
| 1600 | 1600 | ||
| 1601 | static bool | 1601 | static bool |
| 1602 | validate_htr_qt(Alg *alg) | 1602 | validate_htr(Alg *alg) |
| 1603 | { | 1603 | { |
| 1604 | int i, lastqt, lastqt_n, lastqt_i; | 1604 | int i, lastqt_n, lastqt_i; |
| 1605 | Move m, b; | 1605 | Move m, b; |
| 1606 | 1606 | ||
| 1607 | if (!validate_singlecw_ending(alg)) | 1607 | if (!validate_singlecw_ending(alg)) |
| @@ -1618,16 +1618,11 @@ validate_htr_qt(Alg *alg) | |||
| 1618 | if (!alg->inv[i]) | 1618 | if (!alg->inv[i]) |
| 1619 | lastqt_n = i; | 1619 | lastqt_n = i; |
| 1620 | } | 1620 | } |
| 1621 | lastqt = lastqt_n == -1 ? lastqt_i : lastqt_n; | ||
| 1622 | 1621 | ||
| 1623 | for (i = 0; i < alg->len; i++) { | 1622 | for (i = 0; i < alg->len; i++) |
| 1624 | m = alg->move[i]; | 1623 | if (base_move(alg->move[i]) == D && |
| 1625 | b = base_move(m); | 1624 | i != lastqt_i && i != lastqt_n) |
| 1626 | if (m == b+1 || i == lastqt) | ||
| 1627 | continue; | ||
| 1628 | if (b == D || b == L || b == B) | ||
| 1629 | return false; | 1625 | return false; |
| 1630 | } | ||
| 1631 | 1626 | ||
| 1632 | return true; | 1627 | return true; |
| 1633 | } | 1628 | } |
