Closed Pepijnk12 closed 1 year ago
Hey,
thanks for your feedback! The development and documentation is still in an early stage and far from finished.
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:
boardAPI.value.game.move({from: request.from, to: request.to})
boardAPI.value.board.set({
fen: boardAPI.value.game.fen(),
turnColor: toColor(boardAPI.value.game),
movable: {
color: toColor(boardAPI.value.game),
dests: possibleMoves(boardAPI.value.game),
},
});
Thank you for your response! Do you need help on any specific tasks?
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. Or if you have any other idea for a feature let me know.
At the moment im mostly working on polishing the board, not really features.
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.