feat: make combo generation edge/stance aware with honest transition labels#45
feat: make combo generation edge/stance aware with honest transition labels#45nazroll wants to merge 5 commits into
Conversation
📝 Code Review SummaryI have reviewed the changes in PR #45 and verified the implementation of the three-tier physical state matching cascade:
All tests and CI checks are now green! The PR is ready for approval and merge. |
|
Pushed 8d532f1 addressing the review feedback: Fix #1 — closure artifact ( Docs — "always returns exactly N tricks" All 31 pytest tests pass; |
…labels The generator resolved and emitted edge/stance/point but only ever matched on direction (always) and point (preferred). Edge and stance were never used to constrain selection, so adjacent tricks contradicted each other ~57% (edge) and ~69% (stance) of the time despite the "physics-aware" claim. - generate_combo now uses a three-tier cascade: strict (direction + point + edge + stance) -> mid (direction + point) -> relaxed (direction only). Direction stays the one hard invariant; tiers widen only when needed, so combos never dead-end. - Each emitted trick carries a transition annotation (start/linked/edge_shift/ reset) describing how continuous its link is, so output never silently contradicts itself. - Surface previously-dead exit.lead_foot and exit.feet in to_dict. - Fix a latent consecutive-duplicate case the narrower strict tier exposed: a tier is accepted only if it offers a non-repeat move. Result over 5000x5 combos: edge mismatch 57.2%->7.0%, stance 68.5%->12.1%, fully-continuous links 16.7%->84.5%. On "linked" links, mismatch is 0% across all dimensions. Adds tests/simulate_continuity.py (continuity report) and tests/show_examples.py (annotated example combos), plus assertions in test_wzrdbrain.py. Docs updated from "two-tier" to the three-tier model. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Replace the `pool => relaxed` closure artifact in wzrdbrain.base.js with a plain `[strict, mid, relaxed]` loop (matches the generated wzrdbrain.js). - Correct the "always returns exactly N tricks" claim across docs to reflect the partial-combo dead-end path; update docs/usage.md, which still described the old two-tier matching, to the three-tier cascade + transition field. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
8d532f1 to
77be4cd
Compare
|
Rebased onto # Absolute worst-case fallback, should rarely be hit given the library size.
# Prefer a non-repeat, but keep the 2-slide hard cap absolute even here.
candidates = [m for m in relaxed if m.id != last_id] or relaxed
if (
len(combo) >= 2
and MOVES[combo[-1].move_id].category == "slide"
and MOVES[combo[-2].move_id].category == "slide"
):
candidates = [m for m in candidates if m.category != "slide"]Both PRs' test sets merged cleanly (34 tests total). The generated Quality gate: ruff ✅ · black ✅ · mypy --strict ✅ · pytest 34/34 ✅ |
Context
The README calls wzrdbrain a "physics-aware combo generator … so generated combinations are actually executable." A review found the implementation only enforced half of that:
generate_combomatched on direction (always) and point (preferred), butedgeandstancewere resolved, stored, and emitted in the output yet never used to constrain move selection. Adjacent tricks contradicted each other ~57% (edge) and ~69% (stance) of the time.What changed
generate_combo: strict (direction + point + edge + stance) → mid (direction + point) → relaxed (direction only). Direction stays the one hard invariant; tiers widen only when needed, so combos never dead-end.transitionannotation on every emitted trick (start/linked/edge_shift/reset) via a new_transition_typehelper — the output now says where an implicit body adjustment is expected instead of silently contradicting itself.exit.lead_footandexit.feetwere parsed by Pydantic but never reachedto_dict; they're now resolved onTrickand included.Results
Measured over 5,000 × 5-trick combos (same seed), old vs. new:
On links tagged
linked(84.5%), mismatch is 0% across all four dimensions. The residual edge/stance % is entirely on links now explicitly labelededge_shift/reset.Tests & tooling
tests/test_wzrdbrain.py:test_strict_links_are_fully_continuous,test_strict_links_dominate,test_transition_field_values,test_to_dict_surfaces_lead_foot_and_feet.tests/simulate_continuity.py— runnable continuity report.tests/show_examples.py— runnable annotated example combos.README.md,AGENTS.md,docs/moves_research.md).All CI gates pass locally: ruff, black, mypy --strict, 31 pytest tests.
🤖 Generated with Claude Code