Skip to content

Fix the South hint in same-board table solves - #455

Merged
zzcgumn merged 2 commits into
dds-bridge:developfrom
randalburns:fut-overwritten-inline
Nov 16, 2026
Merged

zzcgumn merged 2 commits into
dds-bridge:developfrom
randalburns:fut-overwritten-inline

Conversation

@randalburns

Copy link
Copy Markdown
Contributor

When CalcDDtable solves a full deal, North's lead is solved in full. East, South and West then re-solve the same board with a null-window search that starts from a hint. South's hint is supposed to be partner North's score. By that point, though, fut.score[0] had already been overwritten by East's solve, so South started from East-West's trick count.

The result is unchanged; only the amount of work is affected. On random full deals, South needed about 6 null-window searches per strain instead of about 2.

The fix reads North's score from where it was saved before East's solve: solved.solved_board[bno].score[0] in calc_single_common_internal and scores[0] in calc_single_deal_scores.

🤖 Generated with Claude Code

When solving a full deal's table, the leaders after North start from a
hint. The South hint was meant to be partner North's score, but fut had
already been overwritten by East's solve, so South started from
East-West's trick count. On random full deals South needed about 6
null-window searches per strain instead of about 2. Results were
unaffected, only the amount of work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@randalburns
randalburns marked this pull request as ready for review November 12, 2026 23:15
@zzcgumn
zzcgumn requested a balanced review from Copilot November 13, 2026 15:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A deterministic regression test is still needed for the South hint in both table-solving paths because existing tests cannot detect regressions in this selection logic.

1 open issue
What changed in this PR

This PR corrects South’s starting hint in both full-deal table-solving paths, reducing unnecessary null-window searches without changing the calculated trick counts.

Changes:

  • Use North’s saved score for South instead of East’s overwritten result.
  • Add comments explaining why the saved score is needed.
File Description
library/​src/​calc_tables.cpp Corrects South’s hint in calc_single_common_internal and calc_single_deal_scores.

Review effort: Balanced

Comment thread library/src/calc_tables.cpp Resolved
@zzcgumn

zzcgumn commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

@randalburns , can you please add the suggested tests?

The hint only changes how much work a table solve does, not its
results, so existing tests could not catch a regression. Add an
optional observer that sees each same-board hint, and check that
South's hint equals North-South's tricks with North leading through
both CalcDDtableN and CalcAllTablesX.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@randalburns

Copy link
Copy Markdown
Contributor Author

@zzcgumn Added the regression tests in bbd3e65.

  • library/tests/system/same_board_hint_test.cpp checks that South's hint equals North's score in both table-solving paths: CalcDDtableN (calc_single_common_internal) and CalcAllTablesX (calc_single_deal_scores). The deal is chosen so North's and East's scores differ, and the test asserts that.
  • calc_tables.cpp gets a small test-only observer, set_same_board_hint_observer(), that sees each hint before the re-solve. The hint logic itself stays inline.

Both tests fail with the old hint restored and pass with the fix. All of //library/tests/... passes locally.

@zzcgumn
zzcgumn merged commit 93c7d8e into dds-bridge:develop Nov 16, 2026
15 checks passed
@randalburns
randalburns deleted the fut-overwritten-inline branch November 16, 2026 21:07
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.

3 participants