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

Variation on White's first move #22

Open
jmt1423 opened this issue May 19, 2024 · 1 comment
Open

Variation on White's first move #22

jmt1423 opened this issue May 19, 2024 · 1 comment

Comments

@jmt1423
Copy link

jmt1423 commented May 19, 2024

Hey! Love the project and what I can do with it, I was just wondering if it is possible to add a variation on the first move of the game with pgn.history.addMove().

So as an example the variation tree should look like:

  1. e4 (1.d4) e5

If it isn't possible I'd be happy to try and work on a solution and create a PR for it, but would like some clarification before I start trying a different solution. Thanks!

@shaack shaack added next and removed next labels Jun 24, 2024
@shaack
Copy link
Owner

shaack commented Jun 24, 2024

@jmt1423 You are right, it is not possible to add a variation on the first move with addMove, because, if you set the parameter previous to null, the method assumes, that you want to add the move at the end of the main history.
I don't have a quick idea how to solve this, do you have one?

Maybe setting the string "start" as parameter previous in that case?

const history = new History()
history.addMove("e4")
history.addMove("d4", "start")
history.addMove("e5")

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

No branches or pull requests

2 participants