-
Notifications
You must be signed in to change notification settings - Fork 16
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
Use the changeTurn method to make a move programmatically #18
Comments
Hey, thanks for your feedback! You can use the move() function provided by the lichess chessground to make a move on the board programmatically. Example: function makeMove() {
boardAPI.value?.board.move('e2', 'e4');
setTimeout(() => {
boardAPI.value?.board.move('e7', 'e5');
}, 1000);
} Any help in development would be very welcome :) |
That does not work because the board and game are then out of sync. I solved it by updating the board like this:
Thank you for your response! |
oh, youre right. Its out of sync :D If you want you could implement a move method for the boardAPI which stays in sync with the board. At the moment im mostly working on polishing the board, not really features. |
i added a makeMove method in 0.0.7 (8215b15). Please reopen this issue if this method doesn't work for you or you see room for improvement. |
From the documentation it is not entirely clear how to make a move programmatically.
Can the
changeTurn
method be used to do this?Thank you for this amazing chess package. It really helps me to create my hobby chess analysis tool.
If you need any help to develop this package, please let me know.
The text was updated successfully, but these errors were encountered: