Shredder FEN

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

User avatar
Dan Honeycutt
Posts: 5258
Joined: Mon Feb 27, 2006 4:31 pm
Location: Atlanta, Georgia

Re: Shredder FEN

Post by Dan Honeycutt »

hgm wrote:Hmm, actually this discussion turned up a bug: by inspecting the code in order to remind me how castlings are encoded, I noticed that they are performed in a way that could be incorrect for some FRC positions: first it clears the king square and puts the king on its destination, then it clears the rook square, and puts the rook on its destination. But the king could have ended up on the square where the rook started, which would give a nice disappearance act.
Well, at least it was just the rook that disappeared. I know from experience that a program can function reasonably well if a piece occasionally vanishes. But, let the king disappear and you have total havoc.

Best
Dan H.
stevenaaus
Posts: 608
Joined: Wed Oct 13, 2010 9:44 am
Location: Australia

Re: Shredder FEN

Post by stevenaaus »

Adam Hair wrote:Unfortunately, the information required is about castling.

Scid and PGN Extract do not understand the rook location token(?) (HAha, HBhb, ... GAga, ..., etcetera).
There is a scid960 project. Unfortunately the last i heard from the person was that he had found bugs, and was going to do some more work on it, but have had no follow up.

I have a working patch for Scid vs PC, if anyone's interesting in testing it and telling me what works and what doesn't. Perhaps we can make it work properly ? Shredder FEN seem to be working ok.
Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Re: Shredder FEN

Post by Adam Hair »

hgm wrote:Hmm, actually this discussion turned up a bug: by inspecting the code in order to remind me how castlings are encoded, I noticed that they are performed in a way that could be incorrect for some FRC positions: first it clears the king square and puts the king on its destination, then it clears the rook square, and puts the rook on its destination. But the king could have ended up on the square where the rook started, which would give a nice disappearance act.
At least something good happened due to my question :)
hgm wrote: About the database functionality: within the current framework it is quite easy to write code that would answer any specific question (such as the one about castling you mentioned; if it were not for the bug I stumbled on, I could already have done it). But there are a lot of possible questions, and it is not really clear to me how one would make a method of specifying them general enough to accommodate them all. (But of course I have never looked at a real database program.) For instance, it never occurred to me that one would want to search for moves, rather than positions.

I could add a new search mode, 'find move', that would only select games which contain the move played to the currently displayed position (indicated by the highlights). But you want to select on two moves, one for each side. Of course this could be done by multi-step selection, allowing the user to limit the search to what is already selected, rather than searching all games on every query. (E.g. add a checkbox 'search selection')

It could also be useful to allow the user to 'export' the selection. Currently WinBoard can only save single games.
I would think that most often the focus would be on a position, rather than a move.

I have to agree that it is very tough trying to anticipate all (or most) possible questions. I guess this is a matter of determining what things would be useful to have in Winboard. If we were only talking about orthodox chess, then I would think the existing functionality is or is close to being sufficient. After all, there are several programs dedicated to working with chess databases. However, if we take into account variants of chess (and other games), then there is nothing I know of that can do the job. Whether or not Winboard should fill that gap seems to depend on you at the moment. :)
Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Re: Shredder FEN

Post by Adam Hair »

MrEdCollins wrote:Hi Adam,

Forgive me if I don't quite understand your problem.

You have a PGN file, a database of many PGN Fischer Randon games, and you are interested in knowing how often each side castles on the same side, on opposite sides, etc. Yes?

A year or two ago I wrote a little utility for myself called "PGN Cleanup" which, among other things, gives a bunch of statistics on the file it processes. And yes, one of those statistics are a few castling statistics.

For example, below is the partial output from a PGN file that I downloaded and then processed:


Win / Loss Statistics:
----------------------
Number of games White won: 20,306 (38.4%)
Number of games Black won: 15,628 (29.6%)
Number of draws: 16,924 (32.0%)

Castling Statistics:
--------------------
White castled Kingside and Black castled Kingside: 35,932 (68.0%)
White castled Kingside and Black castled Queenside: 1,878 (3.6%)
White castled Kingside and Black did not castle: 3,920 (7.4%)

White castled Queenside and Black castled Kingside: 3,566 (6.7%)
White castled Queenside and Black castled Queenside: 1,020 (1.9%)
White castled Queenside and Black did not castle: 1,504 (2.8%)

White did not castle and Black castled Kingside: 2,694 (5.1%)
White did not castle and Black castled Queenside: 568 (1.1%)
Neither player castled: 1,774 (3.4%)



Even though your file is a file of FR games, with a Shredder FEN tag to distinguish the opening position, the castling notation within the PGN remains the same, does it not? O-O for Kingside Castling and O-O-O for Queenside castling? If so, my program wouldn't care if the games were FR games or normal games... it would generate a similar set of statistics for your file.
Hi Ed,

You understand my question. And yes, the castling notation in the PGNs is O-O and O-O-O. So they should be compatible with your program. Is there a link to the utility on your chess page?

Adam
Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Re: Shredder FEN

Post by Adam Hair »

stevenaaus wrote:
Adam Hair wrote:Unfortunately, the information required is about castling.

Scid and PGN Extract do not understand the rook location token(?) (HAha, HBhb, ... GAga, ..., etcetera).
There is a scid960 project. Unfortunately the last i heard from the person was that he had found bugs, and was going to do some more work on it, but have had no follow up.

I have a working patch for Scid vs PC, if anyone's interesting in testing it and telling me what works and what doesn't. Perhaps we can make it work properly ? Shredder FEN seem to be working ok.
At first glance, it appears that scid960 is working correctly in regards to extracting the castling information.

I am willing to test your patch to Scid vs PC, especially since you are the current active developer for Scid.

Adam
MrEdCollins
Posts: 59
Joined: Tue May 03, 2011 12:12 am
Location: Southern California

Re: Shredder FEN

Post by MrEdCollins »

Adam Hair wrote: Hi Ed,

You understand my question. And yes, the castling notation in the PGNs is O-O and O-O-O. So they should be compatible with your program. Is there a link to the utility on your chess page?

Adam
No, I never release the utility to the public. In fact, I didn't write it with anyone else in mind. It was simply something for me and for my own personal use. When I run it I run it from the compiler GUI that I wrote it from, specifying right inside the source code what file to load, and the output file name, etc.

I suppose I COULD take the time to make it so that anyone could use it, but right now I don't have the time to do that. But if you wish to e-mail me your PGN file, I won't have a problem in processing it for you.
Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Re: Shredder FEN

Post by Adam Hair »

MrEdCollins wrote:
Adam Hair wrote: Hi Ed,

You understand my question. And yes, the castling notation in the PGNs is O-O and O-O-O. So they should be compatible with your program. Is there a link to the utility on your chess page?

Adam
No, I never release the utility to the public. In fact, I didn't write it with anyone else in mind. It was simply something for me and for my own personal use. When I run it I run it from the compiler GUI that I wrote it from, specifying right inside the source code what file to load, and the output file name, etc.

I suppose I COULD take the time to make it so that anyone could use it, but right now I don't have the time to do that. But if you wish to e-mail me your PGN file, I won't have a problem in processing it for you.
The file is slightly too big to send by email. So I uploaded it to Mediafire: http://www.mediafire.com/?hf18gvvm8833nj8

If you prefer that I send it by email, let me know and I will trim unnecessary pgn tags to get it under 25 MB (so that Gmail will let me send it).
MrEdCollins
Posts: 59
Joined: Tue May 03, 2011 12:12 am
Location: Southern California

Re: Shredder FEN

Post by MrEdCollins »

I had no problems in downloading it or processing it.

I hope this information is of some use to you:

The original input file contains 2,862,901 lines of text.
The original input file contains 107,100 games.
The new 'bad' output file contains 0 bad games.

The following statistics are for the new, cleaned up PGN output file:
The new output file contains 2,569,915 lines of text.
The new output file contains 107,100 games.

Win / Loss Statistics:
----------------------
Number of games White won: 45,026 (42.0%)
Number of games Black won: 40,394 (37.7%)
Number of draws: 21,680 (20.2%)

Castling Statistics:
--------------------
White castled Kingside and Black castled Kingside: 26,787 (25.0%)
White castled Kingside and Black castled Queenside: 6,088 (5.7%)
White castled Kingside and Black did not castle: 12,679 (11.8%)

White castled Queenside and Black castled Kingside: 5,577 (5.2%)
White castled Queenside and Black castled Queenside: 11,422 (10.7%)
White castled Queenside and Black did not castle: 10,142 (9.5%)

White did not castle and Black castled Kingside: 10,735 (10.0%)
White did not castle and Black castled Queenside: 9,030 (8.4%)
Neither player castled: 14,640 (13.7%)
Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Re: Shredder FEN

Post by Adam Hair »

Thank you, Ed. It does not answer every question about the FRC database that has come up recently, but it is more than what we had :)
stevenaaus
Posts: 608
Joined: Wed Oct 13, 2010 9:44 am
Location: Australia

Re: Shredder FEN

Post by stevenaaus »

Adam Hair wrote:
stevenaaus wrote:
Adam Hair wrote:Unfortunately, the information required is about castling.

Scid and PGN Extract do not understand the rook location token(?) (HAha, HBhb, ... GAga, ..., etcetera).
There is a scid960 project. Unfortunately the last i heard from the person was that he had found bugs, and was going to do some more work on it, but have had no follow up.

I have a working patch for Scid vs PC, if anyone's interesting in testing it and telling me what works and what doesn't. Perhaps we can make it work properly ? Shredder FEN seem to be working ok.
At first glance, it appears that scid960 is working correctly in regards to extracting the castling information.

I am willing to test your patch to Scid vs PC, especially since you are the current active developer for Scid.

Adam
It'd be nice to have this working. Could you please test with scid960 and tell me what doesn't work ?

I've contacted Ben to see how he's going, but i think he's hit a little technical hurdle which i'll document here.

This standard fen

Code: Select all

rn1qnk2/pp2p2P/3p4/2pp4/8/2P5/P1P2PP1/R1BbKB1R w KQ - 0 16
for which the best move is h8=Q+ (or h7h8q UCI), stuffs up the anaylsis widget for UCI engines. You will see an apparent ok line , but this is garbage and not what the engine is sending (have a look at the engine log). Xboard engines also work fine and show the queening move. [EDIT; actually - Crafty fails badly with scid960, but works fine with scidvspc960. Other Xboard engines seem fine in both GUIs]
The issue is internal to Scid960, and i'm examining the best solution.