Page 1 of 20

How to post chess games

Posted: Wed Jun 09, 2010 4:46 pm
by Jeremy Bernstein
OpenChess has implemented a JavaScript-based software (pgn4web) to display chess games and positions within the forum body. Using them is easy: it works just like other BBCode markup.

Code: Select all

[fen]1r3rk1/p3pp1p/6p1/3pqb2/Q7/4P1P1/P4PBP/2RR2K1 b - - 0 19[/fen]
looks like this:
1r3rk1/p3pp1p/6p1/3pqb2/Q7/4P1P1/P4PBP/2RR2K1 b - - 0 19

and

Code: Select all

[pgn]
[Event "Miscellaneous Game"]
[Site "?"]
[Date "1620.??.??"]
[EventDate "?"]
[Round "12"]
[Result "0-1"]
[White "NN"]
[Black "Gioachino Greco"]
[ECO "C50"]
[WhiteElo "?"]
[BlackElo "?"]
[PlyCount "26"]

1.e4 e5 2.Nf3 Nc6 3.Bc4 Bc5 4.O-O Nf6 5.Re1 O-O 6.c3 Qe7 7.d4
exd4 8.e5 Ng4 9.cxd4 Nxd4 10.Nxd4 Qh4 11.Nf3 Qxf2+ 12.Kh1 Qg1+
13.Nxg1 Nf2# 0-1
[/pgn]
will display
[Event "Miscellaneous Game"]
[Site "?"]
[Date "1620.??.??"]
[EventDate "?"]
[Round "12"]
[Result "0-1"]
[White "NN"]
[Black "Gioachino Greco"]
[ECO "C50"]
[WhiteElo "?"]
[BlackElo "?"]
[PlyCount "26"]

1.e4 e5 2.Nf3 Nc6 3.Bc4 Bc5 4.O-O Nf6 5.Re1 O-O 6.c3 Qe7 7.d4
exd4 8.e5 Ng4 9.cxd4 Nxd4 10.Nxd4 Qh4 11.Nf3 Qxf2+ 12.Kh1 Qg1+
13.Nxg1 Nf2# 0-1

(you can also skip all of the info in []s above, e.g.

Code: Select all

[pgn]1.e4 e5 2.Nf3 Nc6 3.Bc4 Bc5 4.O-O Nf6 5.Re1 O-O 6.c3 Qe7 7.d4
exd4 8.e5 Ng4 9.cxd4 Nxd4 10.Nxd4 Qh4 11.Nf3 Qxf2+ 12.Kh1 Qg1+
13.Nxg1 Nf2#[/pgn]
if you don't want all of the headers...)

1.e4 e5 2.Nf3 Nc6 3.Bc4 Bc5 4.O-O Nf6 5.Re1 O-O 6.c3 Qe7 7.d4
exd4 8.e5 Ng4 9.cxd4 Nxd4 10.Nxd4 Qh4 11.Nf3 Qxf2+ 12.Kh1 Qg1+
13.Nxg1 Nf2#

This is all in progress. Appearance will probably change a bit over time, but the basic functionality is all there.

Jeremy

Re: How to post chess games

Posted: Thu Jun 10, 2010 3:22 am
by Peter C
That's pretty sweet. If you need any help modifying the CSS to make it look better (though I think it's pretty good now) I might be able to help with that.

EDIT: Oh, you can play through the games. Actually, that's really sweet.

Peter

Re: How to post chess games

Posted: Thu Jun 10, 2010 3:31 am
by 64x
I am not sure this feature (playing through games) can be found in any other forum... bravo!!

Re: How to post chess games

Posted: Thu Jun 10, 2010 3:39 am
by Swaminathan
64x wrote:I am not sure this feature (playing through games) can be found in any other forum... bravo!!

Yeah, It's such an AWESOME feature!!! ;)

Thanks a lot, Jeremy!!

Re: How to post chess games

Posted: Thu Jun 10, 2010 7:25 am
by kingliveson
Man, this is great. It was going to be my first question but already answered. Really nice that you can go through an actually game too instead of just a static position.


Franklin

Re: How to post chess games

Posted: Thu Jun 10, 2010 10:53 am
by Max Cady
very nice

Is it possible to add comments on moves? in other words does it recognize comments after a move?

Re: How to post chess games

Posted: Thu Jun 10, 2010 3:11 pm
by Zarkon
Playing through games is a real bonus! :D

Re: How to post chess games

Posted: Thu Jun 10, 2010 3:19 pm
by Jeremy Bernstein
Max Cady wrote:very nice

Is it possible to add comments on moves? in other words does it recognize comments after a move?
Check out the home page: http://code.google.com/p/pgn4web/ for features. I believe that it does support comments, but I haven't had a chance to test it out, really. Possibly I have to add a switch to the HTML I am generating to create the image. Try it out and let me know!

Jeremy

Re: How to post chess games

Posted: Thu Jun 10, 2010 3:26 pm
by Robert Flesher
Great stuff ! I am glad you started this forum!

Re: How to post chess games

Posted: Thu Jun 10, 2010 4:37 pm
by Jarkko
When stepping through the game with next button, Is it possible to get a FEN string from the position one is interested? A button for that would be nice or present at the bottom of the board all the time for the current position.

Good luck for the new site

- Jarkko