shaack / cm-chessboard

A JavaScript chessboard without dependencies. Rendered in SVG, coded in ES6. Views FEN, handles move input, animated, responsive, expandable
MIT License
219 stars 68 forks source link

Promotions #24

Closed thewhisperinyourears closed 3 years ago

thewhisperinyourears commented 3 years ago

CM board does not handle promotions?

shaack commented 3 years ago

To handle full chess games you have to use chess-console https://github.com/shaack/chess-console, which uses cm-chessboard and can manage whole games with promotion, history, sound, etc. You can see a working example here: https://www.chessmail.de/pages/chess-computer.html

cm-chessboard is just a control to show and input chess moves and positions, it does not open dialogs, to keep it simple.

thewhisperinyourears commented 3 years ago

I looked into chess console and is quite good. But i noticed the bootstrap dependency and i am trying to avoid dependencies as much as i can. Can the CM board be modified to support promotion?

shaack commented 3 years ago

cm-chessboard has no chess rules implemented, you have to use other tools for this like chess.js or my ES6 version cm-chess. Look at the example "Input enabled, move validation with chess.js" https://shaack.com/projekte/cm-chessboard/examples/validate-moves.html

A simple promotion logic can be coded using the inputHandler callback.