This template is used to display Chess games in an "interactive" display. It can display one to thirty games, using the game's PGN.

PGN of many historic chess games can be found in many databases over the internet. Please note that the notation of the game itself is generally not considered to be copyrighted material, however, if the PGN contains annotations, these may be copyrighted, so when copying the pgn, it's usually best to clear all annotations, and possibly add your own.

In order for this template to work, a script has to be loaded. at this time, this script is not loaded on enwiki by default, so this template can't be used in articles. It is meant to demonstrate the function of the Chess-viewer script, and to see it, one needs to add to Special:MyPage/common.js the following line:

importScript( 'User:קיפודנחש/pgnwrapper.js' );

Usage

edit
{{Pgnviewer
 | collapsible = true
 | collapsed = true
 | square-size = 40
 | style = float: left;
 | 1 = <PGN of game 1>
 | 2 = <PGN of game 2>
 | ... up to 30 = <PGN of game 30>
}}

Parameters

edit
  1. collapsible: any non-empty value will show a Hide/Show button to the left of the selector (when there is a selector) or above the board when showing a single game. Clicking it will collapse and expand the viewer.
  2. collapsed: (only relevant when "collapsible" is set). any non-empty value will display the viewer initially collapsed (hidden).
  3. square-size (defaults to 35): size in pixel of one square on the board, similar to parameter "size" of {{Chess diagram}}. if used, must be a number. any value below 20 will be considered as 20, and any number larger than 60 will be considered to be 60.
  4. hide-annotations (not supported yet): any non-empty value will display all the game with the annotations (if exist) hidden
  5. style: any additional html style. To show the viewer flushed to the left use style=float:left;. To display the viewer centered, use style=margin:auto;
  6. 1, 2, 3... = the PGN or algebraic notations of the games themselves.

special PGN tags

edit

The viewer supports several special PGN tags, some of which are not standard:

  • FEN (standard PGN tag): use this tag when opening position of the game is anything other than standard opening position. When this parameter is used, the viewer will display the board in the opening state rather than the last position.
  • FirstMove (non-standard PGN tag): this parameter instructs the viewer to initially show the board in some intermediate position. the value should be the move # followed by "l" (lowercase L) for white or "d" for black. To show initial position after move 15 of white, add to the pgn tags ("metadata", before the game notation) [FirstMove "15l"], and initial position after move 22 of black, [FirstMove "22d"]

Example

edit

[אתר "Belgrade, Serbia Yugoslavia|JUG"] [תאריך "1992.11.04"] [Round "29"] [White "Fischer"] [Black "Spassky"] [Result "1/2-1/2"] [FirstMove "33d"] 1. e4 e5 2. Nf3 Nc6 3. Bb5 {This opening is called the Ruy Lopez.} 3... a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 d6 8. c3 O-O 9. h3 Nb8 10. d4 Nbd7 11. c4 c6 12. cxb5 axb5 13. Nc3 Bb7 14. Bg5 b4 15. Nb1 h6 16. Bh4 c5 17. dxe5 Nxe4 18. Bxe7 Qxe7 19. exd6 Qf6 20. Nbd2 Nxd6 21. Nc4 Nxc4 22. Bxc4 Nb6 23. Ne5 Rae8 24. Bxf7+ Rxf7 25. Nxf7 Rxe1+ 26. Qxe1 Kxf7 27. Qe3 Qg5 28. Qxg5 hxg5 29. b3 Ke6 30. a3 Kd6 31. axb4 cxb4 32. Ra5 Nd5 33. f3 Bc8 34. Kf2 Bf5 35. Ra7 g6 36. Ra6+ Kc5 37. Ke1 Nf4 38. g3 Nxh3 39. Kd2 Kb5 40. Rd6 Kc5 41. Ra6 Nf2 42. g4 Bd3 43. Re6 1/2-1/2

[Event "approx"] [Site "Europe"] [Date "1625.??.??"] [Round "?"] [White "Greco, Gioacchino"] [Black "Analysis\ Analyse"] [Result "1-0"] [ECO "C54"]


1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 Nxe4 8. O-O Nxc3 9. bxc3 Bxc3 10. Qb3 {Greco invented free play with the pieces. Free pieces will win: free diagonals for the bishops, free files for the rooks!! Greco propagiert in seinen veröffentlichten Übungsbeispielen das Spiel mit den Figuren. Die Kraft der langschrittigen Läufer und Türme zu demonstrieren, lag ihm besonders am Herzen.} Bxa1 {Black is intent on winning by capturing more material. Der Schwarze ist auf Beraubungssieg aus.} 11. Bxf7+ {White is aiming for mate. Der Weiße will matt setzten.} Kf8 12. Bg5 Ne7 13. Ne5 Bxd4 { Black tries to capture as much as possible, and White tries to mate.} 14. Bg6 { aha! If the king has not yet castled, the weakest square is always f7. Hat der König noch nicht rochiert, ist das schwächste Feld immer f7.} d5 {He is still defending. Er wehrt sich noch.} 15. Qf3+ {No mate, but..} Bf5 16. Bxf5 Bxe5 17. Be6+ Bf6 18. Bxf6 Ke8 {18... gxf6 19. Qxf6+ Ke8 20. Qf7#} 19. Bxg7 { Powerful bishops, discovered by Greco. This sample game is an impressive demonstration of the power of well developed bishops. Dieses Übungsbeispiel demonstriert eindrucksvoll die Kraft der frei entfalteten Läufer.} 1-0




No description.

Template parameters

ParameterDescriptionTypeStatus
square-sizesquare-size

no description

Unknownoptional
collapsiblecollapsible

no description

Unknownoptional
collapsedcollapsed

no description

Unknownoptional
classclass

no description

Unknownoptional
stylestyle

no description

Unknownoptional
11

no description

Unknownoptional
22

no description

Unknownoptional
33

no description

Unknownoptional
44

no description

Unknownoptional
55

no description

Unknownoptional
66

no description

Unknownoptional
77

no description

Unknownoptional
88

no description

Unknownoptional
99

no description

Unknownoptional
1010

no description

Unknownoptional
1111

no description

Unknownoptional
1212

no description

Unknownoptional
1313

no description

Unknownoptional
1414

no description

Unknownoptional
1515

no description

Unknownoptional
1616

no description

Unknownoptional
1717

no description

Unknownoptional
1818

no description

Unknownoptional
1919

no description

Unknownoptional
2020

no description

Unknownoptional
2121

no description

Unknownoptional
2222

no description

Unknownoptional
2323

no description

Unknownoptional
2424

no description

Unknownoptional
2525

no description

Unknownoptional
2626

no description

Unknownoptional
2727

no description

Unknownoptional
2828

no description

Unknownoptional
2929

no description

Unknownoptional
3030

no description

Unknownoptional