View on GitHub

Chess Replayer

A javascript chess replayer implemented as a jQuery plugin

Download this project as a .zip file Download this project as a tar.gz file


jquery.chess-replayer is a jQuery plugin that displays a complete chess game. It supports variations and annotations.

jquery.chess-replayer was designed to be as easy as possible to use. Complete usage information


Morphy vs the Duke of Brunswick and Count Isouard

[Title "Morphy vs the Duke of Brunswick and Count Isouard"] [StartPly "13"] 1. e4 e5 2. Nf3 d6 3. d4 Bg4 4. dxe5 Bxf3 5. Qxf3 dxe5 6. Bc4 Nf6 7. Qb3 {[%draw arrow,b3,f7,green][%draw arrow,b3,b7,green][%draw square,f7,red]} Qe7 8. Nc3 c6 9. Bg5 b5 10. Nxb5 cxb5 11. Bxb5+ Nbd7 12. O-O-O Rd8 13. Rxd7 Rxd7 14. Rd1 Qe6 15. Bxd7+ Nxd7 16. Qb8+ Nxb8 17. Rd8#

Variations and comments

Taken with permission from the author from us chess league news

[Event "ICC 74 30 u"] [Site "Internet Chess Club"] [Date "2011.11.09"] [Round "?"] [White "Esserman, Marc"] [Black "Fedorowicz, John"] [Result "1-0"] [ECO "B33"] [WhiteElo "2554"] [BlackElo "2523"] [Annotator "Esserman, Marc"] [PlyCount "63"] [EventDate "2011.11.09"] [EventCountry "USA"] 1. e4 $7 c5 $8 2. Nf3 $5 Nc6 $1 {John immediately improves over our Week 3 encounter. He now intends to decline my Morra gambit with 3... d3, when Black has a much more flexible structure than before, having not committed to e7-e6. He could then adopt a Scheveningen, or a Dragon...} 3. d4 cxd4 4. Nxd4 $6 {One question mark for stupidity, and another for originality. As the informed few are well aware, I only know how to play the Morra gambit, so I boldly, or foolishly, head into unfamiliar territory. I would have gladly unleashed the unsound Morra and lost a Pawn for nothing, but John is a dogmatic decliner and does not want the free pawn, like so many of you these days. So instead, I planned to sacrifice a pawn a little later for chaotic complications, on move 18 to be exact.} Nf6 5. Nc3 e5 $5 {Some of you may want to know if this entire game was prepared/memorized beforehand, and I will gladly answer. Since Grandmaster Fedorowicz has not played the volatile Sveshnikov variation of the Sicilian since 1991 in the database, I knew for sure going into the match that he would surprise me with it, and therefore focused all of my pre-game energies on this anti-positional yet dynamic defense. After 6...e5!?, Black creates gaping holes on the key d6 and d5 squares, but sends my proud Knight packing for the hills. If White wishes to keep up the initiative and secure the d5 square, he must give up the Bishop pair. This is the strategic justification behind the opening variation, a system Grandmaster Sveshnikov pushed upon the resistant chess public until they finally appreciated the creativity of his radical idea. Today, the Sveshnikov remains one of the most popular aggressive responses for Black in the Open Sicilian.} 6. Ndb5 d6 7. Bg5 {I am fighting for control of the d5 square, but my Knight is still badly offside.} a6 8. Na3 b5 9. Nd5 Be7 10. Bxf6 Bxf6 {The battle lines have been drawn -- Black with his two Bishops but backward d-pawn, and White with his strong centralized Knight. In the coming moves, I will bring my sad a3 Knight to e3, where he will assist his brother on d5.} 11. c3 O-O 12. Nc2 Bg5 13. a4 bxa4 14. Rxa4 a5 15. Bc4 Rb8 { As all of these moves are logical, they have been played 100's of times over, 1112 in the database, to be precise. Now White has a choice. Should he permanently defend his Pawn with b3, or tie his Rook down to the defense with Ra2? Naturally b3 is the more common move, but Ra2 is a retreat of far reaching beauty.} 16. Ra2 Kh8 { Black aims to break with f5, so the King must sidestep the White Bishop.} 17. Nce3 {But if Black strikes with f5 now, then after exf5 he will have to recapture with the Bishop, and White's central Knights remain undisturbed. Thus, Fedorowicz supports the f5 break with g6 first. Kasparov did the same in 2005, in the final year of his professional career, against Anand.} g6 18. h4 $1 {Ponomariov uncorked this deep sacrifice against Kramnik a month before Kasparov's game against Anand, although it had appeared far earlier than that. At a glance, the Pawn thrust looks extremely dubious, and as we move forward, it only gets more and more ridiculous!} Bxh4 19. g3 Bg5 20. f4 $1 { A King's gambit inside a Sveshnikov!} exf4 21. gxf4 Bh4+ 22. Kf1 f5 23. b4 $1 { A King's, and now an Evans Gambit, inside a Sveshnikov. At last the idea of Ra2 is revealed: starting at move 17, White spends five of the next six moves clearing the path for his Queen's Rook to the Kingside by force! The coup leads to a forced win.} fxe4 24. Rah2 g5 {Still all "theory." Later in 2005, Kramnik grew tired of defending the Black side, and took the reins for White vs. Van Wely. After 25. b5 Ne5! Qd4 the position grew unclear, and although White won, proving an objective advantage is far from obvious. GM Fedorowicz was most definitely aware of these games.} 25. Ke2 $3 $18 {This adventurous King walk, however, refutes the entire 17... g6 main line variation of the Sveshnikov. The key to the solution, like a great chess problem, contains multiple points: a) By unpinning the King, I threaten fxg5, ripping apart Black's defenses) The threat of b5 now takes on even greater significance, as Ne5 now simply hangs a piece c) Black has no immediate punishing counter attack against White's showboating King, as axb4 axb4 opens up the a1-h8 diagonal for White's Queen to do her mischief. gxf4 is quickly met by Rxh4, and the natural Bg4 is obviously impossible, as it hangs a piece. Fedorowicz chooses the most logical defense, guarding his vulnerable h7 pawn with Rb7 and giving the defense some air. However, the counter-intuitive Rf7 and Qf8, lining up for a defense of the Black King and an attack on the f-file, is actually Black's best try in this lost position.} Rb7 (25... Rf7 $1 26. b5 Qf8 $1 {White now must fear the f-line, as 27. fxg5?? Rf2! leads to ruin, and 27. bxc6 Rb2 is another scary sight! But now, the final point of Ke2 appears, a calm, dare I say, "positional" walk to the Queenside!} 27. Kd2 $1 {And Black's creative counter measure fails. The position now degenerates into a wild wild west shootout. Here are some bloody highlights:} Bd7 (27... gxf4 28. Rxh4 fxe3+ 29. Kc1 $1 Ne5 30. Nf6 $1 {A triple barrel on h7!} Bf5 31. Qh5 $3 {A quadruple barrel, and the decisive Qxh7 and mate in a few cannot be stopped without catastrophic material loss.}) 28. Kc2 $1 {Stopping any Rb2 tricks once and for all, and its open season on the Black King.} Nd8 29. fxg5 Bxg5 30. Qd4+ Kg8 31. Rxh7 $1 {Rxh7 32. Ne7# would have pleased the crowd.}) 26. b5 $1 {Black has no choice now but to sacrifice the Knight for dubious compensation. If he retreats to a7 or b8 he gets mated brutally in multiple ways.} Ne5 (26... Nb8 27. Qd4+ Rg7 28. fxg5 $1 Bxg5 29. Rxh7+ Kg8 30. Nf6# (30. Ne7#) (30. Rxg7#) ( 30. Qxg7#)) 27. fxe5 dxe5 28. Qb1 {Black still has a puncher's chance, and after Rf4!?, sacrificing another exchange for three connected passed pawns and open lines to my King, I would need extreme accuracy.} Qd6 (28... Rf4 $1 29. Nxf4 exf4 30. Qxe4 $1 {Slicing through the jungle -- the only path to victory.} Re7 (30... fxe3 31. Rd1 Qf8 32. Qe5+ Rg7 33. Rf1 Qd8 {and among a few wins, Qd4 is simplest, and Rf7, allowing Qd2+, is mate in 15. I leave you to work out why!}) 31. Rxh4 $1 {The artistic conclusion to crown the refutation.} Rxe4 (31... gxh4 32. Qxf4 $1 { And I emerg from the chaos a full piece up while the attack still rages.}) 32. Rxh7#) 29. Qxe4 Rbf7 30. Rxh4 $1 {This thematic exchange sacrifice clears the path to the Black King at last, a trail White had been blazing through the h-file since the 18th move.} gxh4 31. Rxh4 Rg7 32. Bd3 {While I thought that 25. Ke2!! was my original novelty, I received a shock when my teammate, FM Griego, informed me that 25. Ke2 had been played once in a game of 2200's and below, and in addition a few games of correspondence chess as well. I simply did not believe him and lost a few dollars on a gentleman's bet. But please, no one tell the Commissioner, as gambling is against league rules, and I do not want to face suspension. I must confess, this is a very good way to make money off me, as, like Tal said, "I smoke, I drink, I gamble, I chase women, but correspondence chess is one vice I do not have." If you would like to immerse yourself in the theoretical debate and delve into abstract questions like "what is a novelty?", I refer you to the following message board: http://} 1-0

Setup from FEN header in the pgn

[Event "Summer Swiss"] [Site "Sven Brask Chess Club"] [Date "2011.07.27"] [Round "?"] [White "Larry"] [Black "Andrew"] [Result "0-1"] [ECO "B25"] [SetUp "1"] [FEN "5rk1/p4p2/1p2r2p/2p2Rp1/3b2P1/1P1P3P/P1PR3B/7K b - - 0 31"] [PlyCount "11"] 31... Re1+ 32. Kg2 Be3 33. Rff2 Bxf2 34. Rxf2 Rfe8 35. Kf3 R8e3+ 36. Kg2 R1e2 0-1

Scid Annotation Test

[Event "Two Knights Defense"] [Site "?"] [Date "????.??.??"] [Round "?"] [White "Two Knights"] [Black "4. Ng5"] [Result "*"] 1.e4 e5 2.Nf3 Nc6 3.Bc4 Nf6 4.Ng5 $5 {[%draw full,f7,yellow][%draw arrow,c4,f7,green][%draw arrow,g5,f7,green]} *