Skip to content

Comments

feat: learn from your mistakes#2229

Merged
veloce merged 8 commits intolichess-org:mainfrom
tom-anders:learn-from-mistakes
Oct 1, 2025
Merged

feat: learn from your mistakes#2229
veloce merged 8 commits intolichess-org:mainfrom
tom-anders:learn-from-mistakes

Conversation

@tom-anders
Copy link
Collaborator

@tom-anders tom-anders commented Sep 27, 2025

retro_final.webm

@tom-anders tom-anders force-pushed the learn-from-mistakes branch 2 times, most recently from 1c01a7a to 7561575 Compare September 27, 2025 10:31
@tom-anders tom-anders marked this pull request as ready for review September 27, 2025 10:46
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 introduces a retrospective analysis feature called "Learn from your mistakes" that helps players review and practice the critical mistakes they made in their games. The feature identifies significant mistakes from server analysis and creates an interactive training environment where users can attempt to find better moves.

Key changes:

  • Added a comprehensive retro analysis system with mistake detection and interactive training
  • Extracted reusable UI components from puzzle widgets for broader use
  • Enhanced the analysis board system to support different interaction modes

Reviewed Changes

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

Show a summary per file
File Description
test/view/analysis/retro_screen_test.dart Comprehensive test suite for the retro screen functionality
test/example_data.dart Made makeSteps function public for reuse in tests
lib/src/view/puzzle/puzzle_feedback_widget.dart Extracted reusable components and made FeedbackTile public
lib/src/view/analysis/server_analysis.dart Added "Learn from your mistakes" button to server analysis summary
lib/src/view/analysis/retro_settings_screen.dart Settings screen for retro analysis preferences
lib/src/view/analysis/retro_screen.dart Main retro analysis screen with interactive mistake review
lib/src/view/analysis/analysis_board.dart Enhanced base analysis board to support retro mode interactions
lib/src/model/explorer/opening_explorer_repository.dart Added Riverpod provider for opening explorer repository
lib/src/model/common/eval.dart Added utility method for calculating winning chances differences
lib/src/model/analysis/retro_controller.dart Core controller logic for retro analysis functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@veloce
Copy link
Contributor

veloce commented Sep 28, 2025

the screen recording just shows a static screen @tom-anders , perhaps wrong one?

@tom-anders
Copy link
Collaborator Author

Oh that may be related to my recent emulator problems, I'll make a new one today

Copy link
Contributor

@veloce veloce left a comment

Choose a reason for hiding this comment

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

I realise this is a lot of work, so thank you very much for this!

It looks very good, I have only small comments that should be easy to fix.

@veloce
Copy link
Contributor

veloce commented Sep 29, 2025

To improve the discoverability of the feature, I'd suggest to add a "Learn from your mistakes" button on game screen if the server analysis is available. What do you think? The button could be added in the game screen end pop-up, and game menu.

@tom-anders
Copy link
Collaborator Author

Thanks for the review!

To improve the discoverability of the feature, I'd suggest to add a "Learn from your mistakes" button on game screen if the server analysis is available. What do you think? The button could be added in the game screen end pop-up, and game menu.

Good idea! Maybe directly after the game, we could also add a "learn from mistakes" button to the menu that would request server analysis, display some kind of progress dialog, and then take you directly to the retro screen...?
IIRC we used to have a "request analysis" button there, but it was removed at some point...?

@tom-anders
Copy link
Collaborator Author

Think I addressed all the comments now. Also added a new video that hopefully works this time

@veloce
Copy link
Contributor

veloce commented Sep 30, 2025

Good idea! Maybe directly after the game, we could also add a "learn from mistakes" button to the menu that would request server analysis, display some kind of progress dialog, and then take you directly to the retro screen...?

yes we could do that; this adds complexity and will likely not work from time to time, but not a big deal.

if we do that though, I'd handle the logic in the retro controller:

  • if the game was not analysed yet, request server analysis in retro build method
  • while server analysis is pending, simply display a circular progress with the text "Calculating moves..."
  • probably need a timeout like 1 minute, if for some reason the server analysis never finishes

return null;
}

// https://github.com/lichess-org/lila/blob/d29f27d8cbb0e0dac38308c23c63b828028c085f/ui/analyse/src/nodeFinder.ts#L26
Copy link
Contributor

Choose a reason for hiding this comment

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

This is nitpicking again, but it is better to make a constant of the 0.1 here. So you can name it for better clarity and put the ref to lila code here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also better just put the file where the logic is found, without the line number; lines number will most likely change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As I understand it, since I used the "Copy permalink" button, these links refer to a specific commit, not to the master branch. So they will always point to the same line/code


/// Depth needed to evaluate alternative solution moves.
///
/// https://github.com/lichess-org/lila/blob/d29f27d8cbb0e0dac38308c23c63b828028c085f/ui/analyse/src/retrospect/retroCtrl.ts#L151
Copy link
Contributor

Choose a reason for hiding this comment

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

Better not put the link to Lila code actually; line number will most probably change; or just put the link to the whole rectroCtrl file.

@tom-anders
Copy link
Collaborator Author

Good idea! Maybe directly after the game, we could also add a "learn from mistakes" button to the menu that would request server analysis, display some kind of progress dialog, and then take you directly to the retro screen...?

yes we could do that; this adds complexity and will likely not work from time to time, but not a big deal.

if we do that though, I'd handle the logic in the retro controller:

* if the game was not analysed yet, request server analysis in retro `build` method

* while server analysis is pending, simply display a circular progress with the text "Calculating moves..."

* probably need a timeout like 1 minute, if for some reason the server analysis never finishes

Sounds good, I moved it to a new issue

OpeningExplorerEntry.empty(),
),
);
final mockClient = MockClient((request) {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@veloce
Copy link
Contributor

veloce commented Oct 1, 2025

rebasing your changes now with main @tom-anders

@veloce veloce force-pushed the learn-from-mistakes branch from 82e35fd to 271df7e Compare October 1, 2025 22:24
@veloce veloce merged commit 271df7e into lichess-org:main Oct 1, 2025
1 check passed
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