Skip to content

fix: checkout helper logic - #21

Open
DaniilSyzenko wants to merge 5 commits into
BySplashGm:mainfrom
DaniilSyzenko:fix/checkout-helper-logic
Open

DaniilSyzenko wants to merge 5 commits into
BySplashGm:mainfrom
DaniilSyzenko:fix/checkout-helper-logic

Conversation

@DaniilSyzenko

Copy link
Copy Markdown

Changes checkout helper logic.

  • Removes impossible checkout suggestions like "D22" (it doesn't exist on the board)
  • Improves suggestion logic to prioritize more practical combinations, e.g., "D15, T19" instead of "T10, T19" because triples are
  • Removes unnecessary checks for triple bull, as isValidSector already returns null for rawValue > 20

@BySplashGm BySplashGm left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the invalid sectors (D21, D22, D24 don't exist — those were real bugs).

The score_validator.dart cleanup is fine assuming isValidSector already guards against rawValue > 20, which it does.

Main concern: the new checkout suggestions for 2- and 3-dart finishes heavily favour starting on a Double (e.g. 62: ['D11', 'D20'], 66: ['D13', 'D20']). In practice, triples are easier to aim for than doubles — the segments are larger — so standard checkout charts always prioritise Triples as the first dart. For example:

  • 62 → T10, D16 or T14, D10
  • 66 → T10, D18
  • 81 → T19, D12

The old code was closer to convention here, even if it had some invalid sectors. The fix should address the invalid sectors without changing the Triple-first logic.

Do you have unit tests covering CheckoutHelper? Given how many values changed, tests would help catch any arithmetic errors.

@BySplashGm BySplashGm closed this Jul 15, 2026
@DaniilSyzenko

Copy link
Copy Markdown
Author

Hi, can I still work on this?

@DaniilSyzenko

Copy link
Copy Markdown
Author

Changed the checkout suggestions to favour triples just like on the standard checkout charts. There is now also a priority of hitting bigger numbers e.g. T20 T17 instead of T17 T20. Standard checkout tables also recomment hitting S10 D20 instead of Bull on 50, so the test covering this scenario was also modified. There is a new test to check whether the suggestion is arithmetically correct for every single checkout suggestion. It also covers impossible scores, so I combined it with other tests that check for impossible score scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants