How to post chess games

General discussion about computer chess...
Sellig1947
Posts: 1
Joined: Mon Jun 14, 2010 10:55 pm

Re: How to post chess games

Post by Sellig1947 » Tue Jun 15, 2010 8:55 am

Great forum and 100% in english (not in russian for a change :D :D :D )

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

Re: How to post chess games

Post by pgn4web » Wed Jun 16, 2010 12:09 pm

Jeremy Bernstein wrote:Paolo's done an amazing job with it -- great to see him here. I have a pretty clear idea now of how to generate the FEN for the current position (at least as part of the PGN output, but possibly also as a display element, if it looks ok). If I get to it this week, that's great, otherwise it'll have to be in a couple of weeks (Chalkidiki and JavaScript don't mix).
The PGN output is not an issue, click square D8 and C8 and you'll get it.

The FEN output is more of an issue, it's not at all easy to generate a FULLY CORRECT FEN string. The issue is with the "last but one" number in the FEN string: the "Halfmove clock". The javascript tool does not track at the moment this information (it would likely require adding a new array HistHalfmove, similar to HistEnPassant). This is why the FEN output is not there, I could not do all that work nor live with generating a FEN string with an incorrect "Halfmove clock".
Anyway, any program dealing with FEN would be able as well to take the game PGN and work from there the position you are looking for, just a couple of clicks away.

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

Re: How to post chess games

Post by pgn4web » Wed Jun 16, 2010 3:38 pm

pgn4web wrote: The FEN output is more of an issue, it's not at all easy to generate a FULLY CORRECT FEN string. The issue is with the "last but one" number in the FEN string: the "Halfmove clock". The javascript tool does not track at the moment this information (it would likely require adding a new array HistHalfmove, similar to HistEnPassant). This is why the FEN output is not there, I could not do all that work nor live with generating a FEN string with an incorrect "Halfmove clock".
Anyway, any program dealing with FEN would be able as well to take the game PGN and work from there the position you are looking for, just a couple of clicks away.
Hmmm, as usual, few moment after posting I got the idea how to do that... so I should post shortly a new version of pgn4web (it will be v1.98) that generates the FEN string of the current position.

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 Jun 16, 2010 3:40 pm

pgn4web wrote:
pgn4web wrote: The FEN output is more of an issue, it's not at all easy to generate a FULLY CORRECT FEN string. The issue is with the "last but one" number in the FEN string: the "Halfmove clock". The javascript tool does not track at the moment this information (it would likely require adding a new array HistHalfmove, similar to HistEnPassant). This is why the FEN output is not there, I could not do all that work nor live with generating a FEN string with an incorrect "Halfmove clock".
Anyway, any program dealing with FEN would be able as well to take the game PGN and work from there the position you are looking for, just a couple of clicks away.
Hmmm, as usual, few moment after posting I got the idea how to do that... so I should post shortly a new version of pgn4web (it will be v1.98) that generates the FEN string of the current position.
Great! One more request -- would it be possible to display the + or # state of check or mate moves in the move list?

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

Re: How to post chess games

Post by pgn4web » Thu Jun 17, 2010 2:51 pm

[quote="Jeremy Bernstein]would it be possible to display the + or # state of check or mate moves in the move list?[/quote]

Not at the moment; while check detection is already built into the tool, checkmate detection would likely need a full move generator that would be overkill for a js tool (or at least for this js tool).

There is a (ugly) workaround if you really want to show those, adding + and # signs as PGN comments, like this:

Nc3 a6 Nb5 a5 Nxc7{+} Qxc7 f3 a4 g4 a3 h3 Qg3{#}

It's ugly for two reasons:
1) a space is added between the actual move and the comment and probably you dont want that for + and # signs (allthough this would be one line code fix in the js)
2) either the user is adding the comment brackets with the + and # signs or you add a pre-processing of the user input to add brackets around + and # signs already present in the pgn

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 » Fri Jun 18, 2010 9:14 pm

A couple of new features to the chess game display:

- Paolo (pgn4web) implemented FEN string generation. Click on the field B8 to get it. Awesome, Paolo, and thanks!
- I implemented the addition of '+' and '#' to check and mate, respectively, when parsing/displaying the notation.

Please let me know if you see anything untoward...

64x
Posts: 301
Joined: Thu Jun 10, 2010 2:47 am

Re: How to post chess games

Post by 64x » Sat Jun 19, 2010 9:43 am

Awesome! In the example above + and # become duplicated in the display, I assume because the notation was already in the original pgn. I wonder if a check for existence can be added before inserting.

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 Jun 19, 2010 9:46 am

64x wrote:Awesome! In the example above + and # become duplicated in the display, I assume because the notation was already in the original pgn. I wonder if a check for existence can be added before inserting.
Nope. The + and # were entered as comments in the example above -- the comments appear in light grey -- if you remove the comments, you'll see that + and # are automatically attached to the move.

Jeremy

64x
Posts: 301
Joined: Thu Jun 10, 2010 2:47 am

Re: How to post chess games

Post by 64x » Sat Jun 19, 2010 1:12 pm

I see that now :) . I got confused, as B8 strips out the comments on the PGN. Was that the intent?

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

Re: How to post chess games

Post by pgn4web » Sun Jun 20, 2010 1:41 am

64x wrote:I see that now :) . I got confused, as B8 strips out the comments on the PGN. Was that the intent?
Yes. That was the intent.
D8 gives you the full PGN as posted, with all games included and with comments.
C8 gives you the PGN of the current game, with comments.
B8 gives you the FEN of the current position. When producing that, I thought that people would likely paste the FEN in their chess software to analyze, so I thought it would be a good idea to add the following moves (still you could have loaded the PGN of the game instead, but I wanted to make people's life easier).

If B8 were to give the comments, I'd suspect someone would ask why I left out the preceding moves... then B8 would become the same as C8 :-(

Post Reply