yo35 / rpb-chessboard

A WordPress plugin to display chess games and diagrams (using the standard FEN and PGN notations).
https://wordpress.org/plugins/rpb-chessboard/
GNU General Public License v3.0
35 stars 16 forks source link

Puzzles #291

Open DanijelDomazet opened 2 months ago

DanijelDomazet commented 2 months ago

Once there is a mechanism to have games starting from some FEN possition #290, it could be used for chess puzzles, but would require additional "show solution" button or something similar (have a look at pgn4web solution to this feature).

yo35 commented 1 month ago

Already discussed in other issues. See for instance #221 or #239.

clorgie commented 1 month ago

I happened to come here with the same question, and seeing that this is not (yet, perhaps) a feature, this is the approach I am probably going to use for now. Perhaps it will help others who end up here!

I am using rpb-chessboard and the bbspoiler plugin. For the puzzle I use two blocks:

The first is the diagram of the puzzle using a fen string such as this used in the example: 5rRk/p1p4p/5n2/4NPR1/1PQ5/P3P2r/5PK1/3q4 b - - 0 1

The second is a shortcode block with the solution which I set to be hidden using the bbspoiler plugin. This block contains something like the following as seen in the current (live test post):

[spoiler title='Solution']
[pgn flip=true navigation_board=above colorset=original]

[Event "Dutch Open"]
[Site "<a href='https://old.chesstempo.com/chess-problems/9119'>Chess Tempo: 9119</a>"]
[Round "8"]
[Date "2001.7.25"]
[White "Janssen, Ruud"]
[Black "Van Den Doel, Erik"]
[WhiteElo "2437"]
[BlackElo "2607"]
[Result "1-0"]
[Variant "Standard"]
[TimeControl "600+0"]
[ECO "A20"]
[Opening "English Opening"]
[Termination "Time forfeit"]
[Annotator "Stockfish"]
[FEN "5rRk/p1p4p/5n2/4NPR1/1PQ5/P3P2r/5PK1/3q4 b - - 0 1"]

1...Nxg8 2.Qxg8+ ({+1.24}  2.Kxh3 Qh1+ 3.Kg3 Qg1+ 4.Kf4 Qh2+ 5.Rg3 Qxf2+ 6.Nf3 Rxf5+ 7.Kxf5 Qxg3 8.Qd4+ Qg7 9.Ke6 h5 10.Qxg7+ Kxg7 ) Rxg8 3.Nf7# 1-0
[/pgn]
[/spoiler]