nissy-classic

Stable branch of nissy
git clone https://git.tronto.net/nissy-classic
Download | Log | Files | Refs | README | LICENSE

commit fd865fc493af21efe02f54f2a557c36f43aed3c3
parent 90fd8880f9f0db3f55335141d2f2799cea43b118
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Sat, 28 Oct 2023 10:11:25 +0200

Do not print qt-equivalent HTRs

Diffstat:
Msrc/steps.c | 45++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 40 insertions(+), 5 deletions(-)

diff --git a/src/steps.c b/src/steps.c @@ -38,6 +38,7 @@ static int estimate_nxoptlike(DfsArg *arg, PruneData *pd); static bool always_valid(Alg *alg); static bool validate_singlecw_ending(Alg *alg); +static bool validate_htr_qt(Alg *alg); /* Pre-transformation detectors **********************************************/ @@ -407,7 +408,7 @@ cornershtr_HTM = { .is_done = check_cornershtr, .estimate = estimate_cornershtr_HTM, .ready = NULL, - .is_valid = validate_singlecw_ending, + .is_valid = validate_htr_qt, .moveset = &moveset_HTM, .pre_trans = uf, @@ -903,7 +904,7 @@ htr_any = { .estimate = estimate_htr_drud, .ready = check_drud, .ready_msg = check_drany_msg, - .is_valid = validate_singlecw_ending, + .is_valid = validate_htr_qt, .moveset = &moveset_drud, .detect = detect_pretrans_drud, @@ -922,7 +923,7 @@ htr_drud = { .estimate = estimate_htr_drud, .ready = check_drud, .ready_msg = check_dr_msg, - .is_valid = validate_singlecw_ending, + .is_valid = validate_htr_qt, .moveset = &moveset_drud, .pre_trans = uf, @@ -941,7 +942,7 @@ htr_drrl = { .estimate = estimate_htr_drud, .ready = check_drud, .ready_msg = check_dr_msg, - .is_valid = validate_singlecw_ending, + .is_valid = validate_htr_qt, .moveset = &moveset_drud, .pre_trans = rf, @@ -960,7 +961,7 @@ htr_drfb = { .estimate = estimate_htr_drud, .ready = check_drud, .ready_msg = check_dr_msg, - .is_valid = validate_singlecw_ending, + .is_valid = validate_htr_qt, .moveset = &moveset_drud, .pre_trans = fd, @@ -1599,6 +1600,40 @@ validate_singlecw_ending(Alg *alg) return nor && inv; } +static bool +validate_htr_qt(Alg *alg) +{ + int i, lastqt, lastqt_n, lastqt_i; + Move m, b; + + if (!validate_singlecw_ending(alg)) + return false; + + lastqt_n = lastqt_i = -1; + for (i = 0; i < alg->len; i++) { + m = alg->move[i]; + b = base_move(m); + if (m == b+1) + continue; + if (alg->inv[i] && lastqt_i == -1) + lastqt_i = i; + if (!alg->inv[i]) + lastqt_n = i; + } + lastqt = lastqt_n == -1 ? lastqt_i : lastqt_n; + + for (i = 0; i < alg->len; i++) { + m = alg->move[i]; + b = base_move(m); + if (m == b+1 || i == lastqt) + continue; + if (b == D || b == L || b == B) + return false; + } + + return true; +} + /* Pre-transformation detectors **********************************************/ static int