Skip to content

Add Puzzle Hints#1459

Merged
veloce merged 27 commits intolichess-org:mainfrom
CloudyDino:puzzle-hints
Feb 21, 2025
Merged

Add Puzzle Hints#1459
veloce merged 27 commits intolichess-org:mainfrom
CloudyDino:puzzle-hints

Conversation

@CloudyDino
Copy link
Copy Markdown
Contributor

@CloudyDino CloudyDino commented Feb 17, 2025

Add Puzzle Hints

For #1158
Based on #1224
Merge after #1445

Changes

  • Adds button to puzzle screen bottom bar to show hint
  • Once hint is shown, we mark hint shown for the puzzle state
  • If hint has been shown for puzzle, we set puzzle to not be rated
  • When hint is shown, we use green circle for the piece to move and we use blue circles to show where the piece can move. This is slightly different from what Web does in that it preselects the piece we can move so we can see all the places it moves to. I'm not sure how to do that with the current BoardTable widget.

Screenshots / Recordings

puzzle.hint.-.only.circle.piece.mp4
Phone Tablet
image image
image image

@veloce
Copy link
Copy Markdown
Contributor

veloce commented Feb 18, 2025

Looks very good!

I'm not sure why the piece is preselected on the website. Since we're not doing that, I think we can just add the circle around the hinted piece. But not showing the possible destinations. It just adds noise in my opinion. If you're playing puzzle it means you know where the piece can move to ;)

@CloudyDino
Copy link
Copy Markdown
Contributor Author

Thanks for the review @veloce! Just updated to only circle the square the piece to move is on.

@CloudyDino
Copy link
Copy Markdown
Contributor Author

Whoops, accidentally closed the PR.
Fixed the merge conflicts and used the _viewSolutionCompleter.future in PuzzleScreen to show the hint.

@CloudyDino CloudyDino reopened this Feb 19, 2025
Copy link
Copy Markdown
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.

Looks good except a small comment.

Same as with the rated feature, we should add a widget test here. Since we have already the "view solution" puzzle test it should be easy to adapt from it.
The new tests should check:

  • that the right square is highlighted
  • that the solution is marked as not rated if the hint was shown, even though rated is enabled in preferences
  • that the hint shown bool is correctly reset in the next puzzle (tested by solving another puzzle without hint and verifying that it is rated).

});
}

NormalMove solutionMove() {
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.

This can be private. And also a getter instead of a method.

Also I'd name it nextSolutionMove since it depends on the current move index.

@CloudyDino CloudyDino changed the title Add Puzzle Hints Add Puzzle Hints (WIP: tests) Feb 20, 2025
@ijm8710
Copy link
Copy Markdown

ijm8710 commented Feb 20, 2025

Per Veloces last comment if you have it on rated and use a hint do future puzzles stay rated or does it change it?

@CloudyDino
Copy link
Copy Markdown
Contributor Author

Per Veloces last comment if you have it on rated and use a hint do future puzzles stay rated or does it change it?

Future puzzles will continue to be rated. I tested that manually and I added that as a part of our test case.

Right now I think the only thing left is to check that the correct square is being circled after the hint button is pressed which is a bit tricky since I don't see a ValueKey being set for ShapeWidget in flutter-chessground/.

Still unable to check if hint is set on the right square
@CloudyDino CloudyDino changed the title Add Puzzle Hints (WIP: tests) Add Puzzle Hints Feb 20, 2025
@veloce
Copy link
Copy Markdown
Contributor

veloce commented Feb 21, 2025

Per Veloces last comment if you have it on rated and use a hint do future puzzles stay rated or does it change it?

Future puzzles will continue to be rated. I tested that manually and I added that as a part of our test case.

Right now I think the only thing left is to check that the correct square is being circled after the hint button is pressed which is a bit tricky since I don't see a ValueKey being set for ShapeWidget in flutter-chessground/.

Right I didn't think about that. I guess we can skip that test for now, the tests regarding rating were much more important.

@veloce veloce merged commit 4dbe069 into lichess-org:main Feb 21, 2025
1 check passed
@CloudyDino CloudyDino deleted the puzzle-hints branch August 14, 2025 19:45
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.

4 participants