|
Cookbook /
ChessMarkupSummary: Display chessboards in arbitrary positions
Version: 2009-08-22
Status: Stable
Prerequisites: 2.1.0
Maintainer: Pm
Categories: Markup
Votes:
DescriptionThe chess.zipΔ recipe provides Portable Game Notation PGN markup into PmWiki, and the ability to graphically display the board position after selected moves in a game. NotesFirst, the
There are options available (described below) for changing the size and color of the resulting chessboard image. Of course, displaying a chessboard in its starting position isn't all that useful by itself, so this recipe also recognizes Portable Game Notation as wiki markup that internally modifies the chessboard. Thus, an author can write something like 1. e4 c5 Sicilian opening
2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6
5. Nc3 g6 Dragon variation
and PmWiki treats each of the above PGN entries as moves in a virtual game. The
Following multiple analysis linesThe PGN markup can also be used to investigate alternate lines of play. For example, starting with the Dragon variation listed above, we can write The move 2...e6 leads to more defensive variations of the Sicilian opening. The Taimanov variation goes 2...e6 3.d4 cxd4 4.Nxd4 Nc6 which leads to:
Notice how the Of course, this means that starting from a completely new board position is as simple as writing a new first move: 1. d4 It's also possible to display a chessboard in a specific position using Forsyth-Edwards Notation. For example, to display a chessboard after white's third move in the classic Ruy Lopez:
The InstallationTo install this recipe, simply download the chess.zipΔ file and unpack it into your base PmWiki directory. The zip archive contains the following files: cookbook/chess.php - PGN and Once installed, add the following line to a local customization file to enable the chess PGN markups: include_once("cookbook/chess.php");
Other notes and commentsAlthough the PGN markups understand things such as castling ( The width=[width] width of the chessboard in pixels (default 240)
height=[height] height of the chessboard (default same as width)
class=[class] table class (default "chesstable")
align=[center] table alignment ("left", "right", or "center")
style=[style] table CSS styles
In addition, there's also a
![]() Since the ![]() Board after 1.d4
The board at right shows the initial move for a variety of queen's pawn openings, including the Queen's Gambit.
The tile images for chess pieces are stored in a simple image file, custom piece images can be easily created and configured into the chessboard.php script. The image files distributed with this recipe was built from tile images created by David Benbennick and made available through the Wikimedia commons through a freely-redistributable license. See Also
Contributors
Discussion(Solved) Bug with queenside castlingThe recipe prior to version 2006-12-12 didn't recognize the queenside castling (O-O-O) properly. The bug was reported by Bartolin December 12, 2006, at 03:41 AM. Now fixed, thanks! Pm December 12, 2006, at 07:42 AM Problem with
|
3... Nf6 4. Nxe5
However, the classic Ruy Lopez opening is 3. Bb5, which leads to
3... a6
1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O b5 6. Bb3 Be7 7. Re1 O-O 8. d3 d6 9. h3 Na5 10. Nbd2 Nxb3 11. axb3 Ne8 12. Nf1 f5 13. exf5 Bxf5 14. Bd2 Bc8
15. N1h2
15. ... Bb7 16. Qc1 c5 17. Ng5 Nc7 18. c4 h6 19. Ne4 Qe8 20. f4 exf4 21. Bxf4 Qg6 22. Qd2 Bf6 23. Nxf6+ Rxf6 24. Ng4 Rf7 25. Bxh6 gxh6 26. Nxh6+ Kh7 27. Nxf7 Qxf7 28. Qg5 Ne6 29. Qh4+ Kg8 30. Rxe6 Qxe6 31. Qg3+ Kh7 32. Re1 Qf6 33. Qg4 Rg8 34. Qh5+ Qh6 35. Re7+ Rg7 36. Qf5+ Qg6 37. Rxg7+ Kxg7 38. Qd7+ Qf7 39. Qxd6 1/2-1/2
* (+) Optional positive comment. Name, date * (-) Optional negative comment. Name, date
These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.