How to post chess games
-
- Posts: 1
- Joined: Mon Jun 14, 2010 10:55 pm
Re: How to post chess games
Great forum and 100% in english (not in russian for a change )
Re: How to post chess games
The PGN output is not an issue, click square D8 and C8 and you'll get it.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 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.
Re: How to post chess games
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.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.
-
- 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
Great! One more request -- would it be possible to display the + or # state of check or mate moves in the move list?pgn4web wrote: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.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.
Re: How to post chess games
[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
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
-
- 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
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...
- 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...
Re: How to post chess games
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.
-
- 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
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.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.
Jeremy
Re: How to post chess games
I see that now . I got confused, as B8 strips out the comments on the PGN. Was that the intent?
Re: How to post chess games
Yes. That was the intent.64x wrote:I see that now . I got confused, as B8 strips out the comments on the PGN. Was that 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