Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoTo specific move number #482

Open
mliebelt opened this issue Dec 18, 2023 Discussed in #481 · 3 comments
Open

GoTo specific move number #482

mliebelt opened this issue Dec 18, 2023 Discussed in #481 · 3 comments
Assignees

Comments

@mliebelt
Copy link
Owner

Discussed in #481

Originally posted by RasmusRow December 17, 2023
Hi,

I can't seem to figure out if it's possible to programmatically forward/rewind the game to a specific move number.

Just like the notation already provided in the library, but I'd like to be able to implement some custom functionality that allows to me to click a button somewhere on the page that triggers the same event as when I click on a move number in the notations.

I hope it makes sense :)

Thank you for your work!

@mliebelt
Copy link
Owner Author

You are right, there is no API to do something like that. I checked the API again, at the moment, you can only do manual moves from one position to the next.

So let me write down the requirement: The user should be able to jump to any position in the game denoted by the move number. The move number is denoted by the array index of the half moves done. In the game e4 e5 Nf3 Nc6 the move numbers are: 1 e4 2 e5 3 Nf3 4 Nc6.

What about variants? We cannot say which move number will be which move in which variant (at least not so simple). For the moment, this would only work for the main line.

@mliebelt mliebelt self-assigned this Dec 18, 2023
@mliebelt
Copy link
Owner Author

mliebelt commented Jan 3, 2024

There is a similar functionality already implemented, see #171 The ideas from that implementation could be moved.

Requirements would be:

  1. This works only to repeat moves already done.
  2. The moves are the moves of the main line (only). Later on, we may find a way to address moves from the variant (like in the 5th move, the 1st variant, the 3rd move == 5.v1.3. Too complicated at the moment.
  3. The moves are counted from 0 onward, so the moves of the notation 1. e4 e5 2. Nf3 Nc6 will be: 0 e4 1 e5 2 Nf3 3 Nc6.

mliebelt added a commit that referenced this issue Jan 3, 2024
Missing: all special cases, marking the move in the HTML
@mliebelt
Copy link
Owner Author

mliebelt commented Jan 3, 2024

Did a quick hack, there are many things missing (yet). But demonstrates that jumping to a move is not a big deal ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: Todo
Development

No branches or pull requests

1 participant