Skip to content

Create a component for solving chess puzzles #22

@fave77

Description

@fave77

Is your feature request related to a problem? Please describe. 💡
The puzzles page would allow a user to practice random puzzles with varying ELO ratings. The basic functionality including but not limited to:

  • whenever the user visits the page, a random chess puzzle is generated for them to solve
  • a chessboard would be displaying for acting as an interface
  • an error would pop up indicating a wrong move at every turn should a user do so
  • a verdict would be given if the user has been able to successfully solve it
  • two buttons for navigating to the next random puzzle as well as to the previous puzzle
  • the previous button would be disabled when a user first visits or refreshes
  • on clicking previous and next consecutively shouldn't display a random puzzle but the one that has been visited before

Describe the solution you'd like
The puzzles component will consist of the following elements:

  • The chessboard
    • use react-chessground for the UI, chess.js for the logic and chessblunders for the API
  • The previous and the next button
    • In order to access the specific puzzle, maintain a state for all the visited puzzle ids until the next exit or refresh

Describe alternatives you've considered 🌟
Haven't considered any other alternatives but open to suggestions ☺️

Additional context 📝

For the API, create a new service class called PuzzleService and save it inside the client/src/services folder named puzzle.service.js. The class should contain a method called getPuzzle(<optional id argument>) which calls the following endpoint - https://chessblunders.org/api/blunder/get, method=POST and body includes -

{
    "type": "explore"
}

For further references regarding the implementation, you could check game.js and game.controller.js except the logic would be handled on the client-side!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is neededmoderateThis issue is moderately difficult

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions