mliebelt / pgn-viewer

Simple PGN viewer with the necessary features to display chess games
GNU General Public License v3.0
161 stars 44 forks source link

Make a PGN move given a FEN string #485

Closed programarivm closed 8 months ago

programarivm commented 8 months ago

Hi there,

chesscoach.me/moves helps chess students understand why a move is good by entering a FEN string.

screencapture-chesscoach-me-moves-2024-01-02-20_59_01

As you can see in the image attached, the chessboard image is being generated on the server side with the help of PHP Chess. I'd want to use the PgnViewerJs script instead. I was wondering if it could be initialized to make a PGN move from a particular FEN position rather than from the start position.

Thanks for the help,

mliebelt commented 8 months ago

Well, that should be easy. PgnViewerJS has 4 different modes, one of them is pgnBoard, that just shows a board.

The following examples shows, what parameter is needed in the configuration: https://mliebelt.github.io/PgnViewerJS/examples.html#1022

There are many more examples there, so you can of course select the theme, pieceStyle, and many more configuration parameters. To set the position, the parameter is position or fen.