How to post chess games

General discussion about computer chess...
pgn4web
Posts: 97
Joined: Mon Jun 14, 2010 10:26 pm

Re: How to post chess games

Post by pgn4web » Wed Mar 09, 2011 3:40 pm

Jeremy Bernstein wrote:OK, both of those problems are "fixed" (the second one really, the first one is just kind of fixed (throws errors because the PGN is bad, but loads the board and lets you begin to debug your game). I'll look more closely, time permitting, at a better solution for invalid PGN data.
Looks good, that is kind of consistent with the general behaviour of flagging the PGN mistake by flashing the A8 square.

I had a couple of people asking for the variation feature, hope you dont mind I pointed them to get a copy of your pgn4web.js file and see if that works for them.

Havent got the time (and patience) to make your code general enough and configurable (things like variations colors/fonts and so on) for the main pgn4web version. Other things need to be done also, such as extending the SetInitialHalfmove function to allow pointing to a move into a variation and so on.

One final comment, you display variations in square brackets... the PGN standard uses round brackets for that, people used to PGN files would probably find it easier to read with square brackets, but in the end it's just cosmetic.

Jeremy Bernstein
Site Admin
Posts: 1226
Joined: Wed Jun 09, 2010 7:49 am
Real Name: Jeremy Bernstein
Location: Berlin, Germany
Contact:

Re: How to post chess games

Post by Jeremy Bernstein » Wed Mar 09, 2011 3:51 pm

pgn4web wrote:
Jeremy Bernstein wrote:OK, both of those problems are "fixed" (the second one really, the first one is just kind of fixed (throws errors because the PGN is bad, but loads the board and lets you begin to debug your game). I'll look more closely, time permitting, at a better solution for invalid PGN data.
Looks good, that is kind of consistent with the general behaviour of flagging the PGN mistake by flashing the A8 square.

I had a couple of people asking for the variation feature, hope you dont mind I pointed them to get a copy of your pgn4web.js file and see if that works for them.
Of course not.
Havent got the time (and patience) to make your code general enough and configurable (things like variations colors/fonts and so on) for the main pgn4web version. Other things need to be done also, such as extending the SetInitialHalfmove function to allow pointing to a move into a variation and so on.
Look at the function GoToMoveInLine(), which does what I think you're talking about. Modifying SetInitialHalfmove() to use a variations syntax would be pretty simple, implementation-wise. Deciding on a reasonable syntax would probably take most of the time. I'll get around to generalizing the colors and fonts at some point. I just needed to finish up the work quickly and it was appropriately finished for use on this site, so it got filed for TODO.
One final comment, you display variations in square brackets... the PGN standard uses round brackets for that, people used to PGN files would probably find it easier to read with square brackets, but in the end it's just cosmetic.
I just found it cleaner and easier to read. And ChessBase uses square brackets for the top-level variation (with parens for lower-level lines), so I felt justified. :)

jb

Jeremy Bernstein
Site Admin
Posts: 1226
Joined: Wed Jun 09, 2010 7:49 am
Real Name: Jeremy Bernstein
Location: Berlin, Germany
Contact:

Re: How to post chess games

Post by Jeremy Bernstein » Wed Apr 06, 2011 8:10 pm

OK, I've solved the issues with the menu causing the buttons to become invisible. Additionally, the menu doesn't forget which game is selected anymore, and I've fixed a few bugs with the variations support, as well, and some horribleness with IE6+ (thanks Paolo for the head's up and assist!).

[Event "Ch URS"]
[Site "URS"]
[Date "1973.??.??"]
[EventDate "?"]
[Round "?"]
[Result "1-0"]
[White "Boris Spassky"]
[Black "Sveshnikov"]
[ECO "B33"]
[WhiteElo "?"]
[BlackElo "?"]
[PlyCount "45"]

1. e4 c5 2. Nf3 Nc6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 e5 6. Ndb5
d6 7. Bg5 a6 8. Na3 b5 9. Bxf6 gxf6 10. Nd5 f5 11. Bd3 Be6
12. Qh5 Bg7 13. O-O h6 14. c3 O-O 15. Nc2 fxe4 16. Bxe4 f5
17. Nf4 Bd7 18. Bd5+ Kh7 19. Qg6+ Kh8 20. Nh5 Qe7 21. Nb4 Nxb4
22. Bxa8 Rg8 23. cxb4 1-0

[Event "?"]
[Site "?"]
[Date "1989.??.??"]
[Round "?"]
[White "Ernst, Thomas"]
[Black "Timoshenko, Gennadi"]
[Result "0-1"]
[ECO "B33"]
[TimeControl "40/600:40/600:40/600"]
[Annotator "Master,Mister"]
[PlyCount "58"]

{48MB, Book.ctg, JOE-SZQFC6G4X9N} 1. e4 c5 2. Nf3 Nc6 3. d4 cxd4 4. Nxd4 Nf6 5.
Nc3 e5 6. Ndb5 d6 7. Bg5 a6 8. Na3 b5 9. Bxf6 gxf6 10. Nd5 f5 11. Bd3 Be6 12.
Qh5 Bg7 13. O-O f4 14. c4 bxc4 15. Bxc4 O-O 16. Rac1 Rb8 17. b3 Qa5 (17... Qd7
18. Rfd1 Bg4 19. Qg5) 18. Nb1 Kh8 19. a3 Qd8 (19... Nd4 20. Nxf4 Nxb3 21. Bxe6 (
21. Nxe6 fxe6 22. Rc3 Nd4 23. Rh3 h6 24. Qg6) 21... Nxc1 22. Bxf7 Rxf7 23. Qxf7
exf4) 20. Nxf4 (20. Bxa6 Nd4 21. b4 f5 (21... Rg8) 22. Bd3 (22. f3 Bf7 23. Qh3
Bxd5 24. exd5 Qb6) 22... Bxd5 23. exd5 Rf6 24. Nd2 Rh6 25. Qd1 Qh4 26. h3 e4 27.
Be2 f3) 20... exf4 21. Bxe6 fxe6 22. Rxc6 f3 23. g3 (23. b4 fxg2 (23... Rb5 24.
Qh3 Rg5 25. g3) 24. Kxg2 Rf4) (23. Nd2 Rb5 24. Qh3 fxg2 25. Kxg2 Qg5+) 23...
Rxb3 24. Rxa6 (24. Rfc1 Qb8) 24... Qc7 25. Qa5 Qc2 26. Rb6 Rd3 27. Qb4 (27. Qe1
Be5 (27... Bh6 28. Qb4 (28. e5 Rd5 29. Rxd6 (29. exd6 Qf5) 29... Qf5) 28... Be3
29. Qb2+ Qxb2 30. Rxb2 Bc5 $11) (27... Bd4 28. Rxd6 e5 $15 (28... Bc3 29. Rc6
$18)) 28. Qc1 Qe2 29. Re1 Bd4) 27... Bd4 28. Rxd6 Qxf2+ 29. Rxf2 Rd1+ 0-1

User avatar
Uly
Posts: 838
Joined: Thu Jun 10, 2010 5:33 am

Re: How to post chess games

Post by Uly » Sun Apr 17, 2011 1:54 am

Thanks Jeremy.

User avatar
Uly
Posts: 838
Joined: Thu Jun 10, 2010 5:33 am

Re: How to post chess games

Post by Uly » Sat May 07, 2011 10:16 am

Is there a way to switch off figurines in posted games? I know they look cool and all but in my head I have difficulties reading them, as usually PGNs, web pages and discussions talk about "Ng5 is the best move here" instead of "(Knight figurine)g5 is the best move here", and I read the former as "ene-g5 is the best move here" which is difficult with the figurine in there.

(This is a question about making all the games posted by other people appear with letters instead of figurines, not about how to post games without figurines).

Jeremy Bernstein
Site Admin
Posts: 1226
Joined: Wed Jun 09, 2010 7:49 am
Real Name: Jeremy Bernstein
Location: Berlin, Germany
Contact:

Re: How to post chess games

Post by Jeremy Bernstein » Sat May 07, 2011 12:44 pm

Uly wrote:Is there a way to switch off figurines in posted games? I know they look cool and all but in my head I have difficulties reading them, as usually PGNs, web pages and discussions talk about "Ng5 is the best move here" instead of "(Knight figurine)g5 is the best move here", and I read the former as "ene-g5 is the best move here" which is difficult with the figurine in there.

(This is a question about making all the games posted by other people appear with letters instead of figurines, not about how to post games without figurines).
I'm sure this is possible (although I'd have to look into setting it up), but the use of figurines was my internationally-sensitive choice. Since I bounce between KQRBNP and KDTLSB in my own chess world, I find the figurines easier to navigate. Will investigate -- if it's something that could be toggled via a click on a board square, I'm all for it, but then I'd only support english piece names.

jb

pgn4web
Posts: 97
Joined: Mon Jun 14, 2010 10:26 pm

Re: How to post chess games

Post by pgn4web » Sat May 07, 2011 2:44 pm

Jeremy Bernstein wrote:
Uly wrote:Is there a way to switch off figurines in posted games? I know they look cool and all but in my head I have difficulties reading them, as usually PGNs, web pages and discussions talk about "Ng5 is the best move here" instead of "(Knight figurine)g5 is the best move here", and I read the former as "ene-g5 is the best move here" which is difficult with the figurine in there.

(This is a question about making all the games posted by other people appear with letters instead of figurines, not about how to post games without figurines).
I'm sure this is possible (although I'd have to look into setting it up), but the use of figurines was my internationally-sensitive choice. Since I bounce between KQRBNP and KDTLSB in my own chess world, I find the figurines easier to navigate. Will investigate -- if it's something that could be toggled via a click on a board square, I'm all for it, but then I'd only support english piece names.
the easiest way to fallback on KQRTBN piece initials rather than figurines is to avoid loading in board.html the font definition file font/*.css; in fact, using an older browser that would not support web fonts would give you exacltly what Uly asked for. The difficult part is to make it configurable on a per user basis, ideally this should be linked to a phpbb user preference, but I have no idea how to doit. Less optima option would be to configure a shortcut square to remove the figurines, but then the user would have to click there every time. not sure if that would be practical. To implement the latter option, either you find a way to modify on the fly a css class definition (not really trivial to do I'm afraid) or you have two css classes defined at load and then you use the one with the figurine or the one without depending on a javascript variable (not very elegant, but would do the job).

pgn4web is not setup for international piece names, only English is supported. The idea is that using figurines takes away the need of customizing piece names for each language.

PS: I recently published a new version of pgn4web with some changes to the core function of loading PGN data... I remember you mentioning the intention of refreshing your core pgn4web.js file, if you do that you should definitely use v2.22

User avatar
Uly
Posts: 838
Joined: Thu Jun 10, 2010 5:33 am

Re: How to post chess games

Post by Uly » Sun May 08, 2011 12:57 am

pgn4web wrote:using an older browser that would not support web fonts would give you exacltly what Uly asked for.
Ah, so updating to Firefox 4 is what changed them.
pgn4web wrote:the easiest way to fallback on KQRTBN piece initials rather than figurines is to avoid loading in board.html the font definition file font/*.css
Thanks, I blocked pgn4web-fonts.css with AdBlock+ and got the desired effect.

Solved :)

pgn4web
Posts: 97
Joined: Mon Jun 14, 2010 10:26 pm

Re: How to post chess games

Post by pgn4web » Sun May 08, 2011 12:41 pm

Uly wrote:Thanks, I blocked pgn4web-fonts.css with AdBlock+ and got the desired effect.
Good thinking! I should have thought of that myself and suggest you to AdBlock my own code :-)

Jeremy Bernstein
Site Admin
Posts: 1226
Joined: Wed Jun 09, 2010 7:49 am
Real Name: Jeremy Bernstein
Location: Berlin, Germany
Contact:

Re: How to post chess games

Post by Jeremy Bernstein » Sun May 08, 2011 1:12 pm

pgn4web wrote:PS: I recently published a new version of pgn4web with some changes to the core function of loading PGN data... I remember you mentioning the intention of refreshing your core pgn4web.js file, if you do that you should definitely use v2.22
Thanks, I saw, and will (try to) merge those changes in at some point (the code bases are divergent enough [in places] at this point to make merging non-trivial -- I need to find the time and patience to deal with it...).

Btw, I just added some code to handle auto-scrolling of the move list (so that the move list follows the move on the board), which works well in every browser I've tested. Might be worth integrating into the trunk.

Post Reply