Skip to content

More practice fixes#2680

Merged
veloce merged 10 commits intomainfrom
more_practice_fixes
Feb 25, 2026
Merged

More practice fixes#2680
veloce merged 10 commits intomainfrom
more_practice_fixes

Conversation

@veloce
Copy link
Contributor

@veloce veloce commented Feb 25, 2026

No description provided.

@veloce veloce marked this pull request as ready for review February 25, 2026 11:08
@veloce veloce requested a review from Copilot February 25, 2026 11:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts offline practice-mode evaluation/hints behavior to improve responsiveness and correctness of “before/after” comparisons, while consolidating evaluation logic (engine/cloud/tablebase) into a single helper.

Changes:

  • Tune hint/move evaluation search times and introduce separate depth thresholds for hints vs. move evaluation.
  • Add a unified _getEval path that can race local engine eval, cloud eval, and optional tablebase lookup.
  • Improve practice-mode move evaluation when pre-move analysis is missing by triggering a quick “before” evaluation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
lib/src/model/offline_computer/offline_computer_game_controller.dart Updates hint/move eval thresholds and refactors evaluation logic to use a shared helper with optional tablebase lookup.
lib/src/model/engine/evaluation_service.dart Adjusts eval timeout and avoids stopping a newer work item when a previous one times out.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 353 to 355
// print(
// 'Move eval computed: depth=${evalAfter.depth}, searchTime=${evalAfter is LocalEval ? evalAfter.searchTime : null} nodes=${evalAfter.nodes}',
// );
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

These commented-out print(...) debug statements add noise to the production code path. Consider removing them (or gating them behind kDebugMode logging) to keep the file clean.

Suggested change
// print(
// 'Move eval computed: depth=${evalAfter.depth}, searchTime=${evalAfter is LocalEval ? evalAfter.searchTime : null} nodes=${evalAfter.nodes}',
// );

Copilot uses AI. Check for mistakes.
Comment on lines 415 to 420
_getEvalTimer?.cancel();
_getEvalTimer = Timer(work.searchTime + const Duration(seconds: 2), () {
_getEvalTimer = Timer(work.searchTime + const Duration(seconds: 3), () {
if (!completer.isCompleted) {
completer.complete(null);
}
});
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

_getEvalTimer is a single shared field and is cancelled/reassigned on every _getEval call. If multiple _getEval calls overlap (e.g., hints evaluation while a practice move evaluation starts), a later call can cancel the earlier call’s fallback timer, potentially leaving that earlier completer without its safety timeout if an exception occurs. Consider making the fallback timer local to _getEval (and cancelling it when the completer completes) so concurrent calls don’t interfere with each other.

Copilot uses AI. Check for mistakes.
);
}

/// Gets an evaluation by requesting at the same time the local engine and a cloud eval and optionnally doing a tablebase lookup.
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Typo in dartdoc: "optionnally" should be "optionally".

Suggested change
/// Gets an evaluation by requesting at the same time the local engine and a cloud eval and optionnally doing a tablebase lookup.
/// Gets an evaluation by requesting at the same time the local engine and a cloud eval and optionally doing a tablebase lookup.

Copilot uses AI. Check for mistakes.
Comment on lines 837 to 839
// print(
// 'Hints computed: depth = ${finalEval?.depth}, searchTime = ${finalEval is LocalEval ? finalEval.searchTime : null} nodes=${finalEval?.nodes}',
// );
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

These commented-out print(...) debug statements add noise to the production code path. Consider removing them (or gating them behind kDebugMode logging) to keep the file clean.

Suggested change
// print(
// 'Hints computed: depth = ${finalEval?.depth}, searchTime = ${finalEval is LocalEval ? finalEval.searchTime : null} nodes=${finalEval?.nodes}',
// );

Copilot uses AI. Check for mistakes.
veloce and others added 7 commits February 25, 2026 12:18
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@veloce veloce merged commit bd58978 into main Feb 25, 2026
1 check passed
@veloce veloce deleted the more_practice_fixes branch February 25, 2026 12:42
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