oakmac / chessboardjs

JavaScript chessboard
https://chessboardjs.com
MIT License
2.01k stars 408 forks source link

Put a piece that was captured back to its place after takeback #156

Open igbo61 opened 6 years ago

igbo61 commented 6 years ago

I want to use this chessboard to visualize stored chess games, move after move, forwards and backwards. I found no means to put a piece, that was captured, back to the board, after a piece, that captured it, moves backwards.

This is possible if driving the board manually, by using spare pieces. However, if the board is controlled from some external software, I found no means to do it.

The method desired would be something like "instantiate (coordinate, piece)". This would drop a piece wanted to the place at will (without to touch the rest of the board). For example, "instantiate ('b2', 'wR');. The method would also be useful to set up positions from databases, as it would probably be more convenient to store positions consisted of single pieces instead of position strings.

brucou commented 5 years ago

If I remember well, ChessBoard has an undo functionality. You can replay all the moves and at any point use that undo functionality. There is not much more to do. Have a look at the documentation website.

An example of using the undo functionality: