> For the complete documentation index, see [llms.txt](https://freedom-developer.gitbook.io/the-chess/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://freedom-developer.gitbook.io/the-chess/scenes-details/chesspuzzle.md).

# ChessPuzzle

### **Loading Puzzle Data**

Puzzle level data are created from ChessPuzzleEditor scene and being saved into ChessPuzzleLevel scriptable object, a PuzzleButton Prefab has been prepared for convenience, with the ChessLoadPuzzleLevelButton script component attached, loading a puzzle level is just a matter of click on the button.

<figure><img src="/files/s3AyD8dVa7jDFDS0dAoJ" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/q5A5t9ThrxjlNq2gSHZr" alt=""><figcaption></figcaption></figure>

## Scene Description

<figure><img src="/files/tc36uMpRBb8gQVA6xHuu" alt=""><figcaption></figcaption></figure>

Descriptions of numbered UI in image above : &#x20;

1\) **Fixed Move Scroll View** - The data and concept is exact the same from the scroll view in ChessPuzzleEditor scene.

2\) **Puzzle Move Scroll View** - The answer provided by the controller will be validated by the underlying game logic while being displayed as buttons with algebraic notation text on the **right side** of the scroll view, to check if any of the sequence has the potential to match the exact same move variant histories data, as provided by the **Move Variant Scroll View** in ChessPuzzleEditor scene.&#x20;

To show or hide the **left side** of the scroll view, click the Show/Hide Answer button. The scroll view display the exact answer for the puzzle level in visual format(white row for white color and black row for black, it will turn green when correct, red for failure), any content within the scroll view are unclickable. The dropdown above the scroll view is the exact same dropdown when saving move variant in ChessPuzzleEditor scene. When controller made a move without matching any available answer sequence will cause a failure in the validation and thus failed the puzzle level. The content in the scroll view will regenerate to potential answer that has the potential to match the exact sequence of moves made by controller, if only if there are more than one set of saved move variant. The level is successful as soon as the validator found an exact match of move sequence made by the controller and from the answer.

3\) **Show Hint Button** - Show answer for the next move by highlighting the tiles as well as the associated row in the 2) Left Side of Puzzle Move Scroll View.

4\) **Undo View/Redo View Button** - Forward or backward the state of board position without triggering the puzzle level validation logic. When clicking the button on the scroll view of 1) or 2), it's using this function to reach the desirable state.

5\) **Restart Button** - Restart the puzzle level by clearing all of the historical puzzle move made by controller and reset validation record.

6\) **Undo Button** - This will undo the validation record and remove the last move history made by controller.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://freedom-developer.gitbook.io/the-chess/scenes-details/chesspuzzle.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
