Shredder FEN

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

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Adam Hair
Posts: 3185
Joined: Wed May 06, 2009 8:31 pm
Location: Fuquay-Varina, North Carolina

Shredder FEN

Post by Adam Hair » Wed Mar 28, 2012 2:57 am

Does anybody know of a database program that understands Shredder FENs? I am trying to extract some information from the CCRL FRC database, but I am having little luck. Unfortunately, Scid and its offshoots choke on the Shredder FEN strings found in the PGNs.

Thanks,
Adam

User avatar
hgm
Posts: 22332
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Shredder FEN

Post by hgm » Wed Mar 28, 2012 5:28 am

It depends on what information you want. If it is very basic (like how many times a certain opening position occured, and how often it was won for white) you could us WinBoard. I suppose the FRC database is not that huge.

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

Re: Shredder FEN

Post by Adam Hair » Wed Mar 28, 2012 5:51 pm

hgm wrote:It depends on what information you want. If it is very basic (like how many times a certain opening position occured, and how often it was won for white) you could us WinBoard. I suppose the FRC database is not that huge.
Unfortunately, the information required is about castling.

Scid and PGN Extract do not understand the rook location token(?) (HAha, HBhb, ... GAga, ..., etcetera). When I modify the FEN string so that HAha et al is replaced with KQkq, Scid drops its objections to the FEN tag, but it still does not understand FRC castling. I also tried CQL (Chess Query Language), but it does not seem to recognize FEN tags (the PGN it produces from a query lacks a FEN tag and it does not recognize when pieces are in non-standard positions).

User avatar
hgm
Posts: 22332
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Shredder FEN

Post by hgm » Wed Mar 28, 2012 7:10 pm

Well, so what do you want to know? WinBoard is open source, so there is no limit to what it could be made to do. There already is code in there to parse all games (doesn't matter whether is is FRC, Xiangi or Gothic Chess), and store the moves in a compressed form in memory. I am sure it would be trivial to take some stats in the process, and let it pop up a window too present it when it completes a search command.

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

Re: Shredder FEN

Post by Adam Hair » Wed Mar 28, 2012 8:06 pm

hgm wrote:Well, so what do you want to know? WinBoard is open source, so there is no limit to what it could be made to do. There already is code in there to parse all games (doesn't matter whether is is FRC, Xiangi or Gothic Chess), and store the moves in a compressed form in memory. I am sure it would be trivial to take some stats in the process, and let it pop up a window too present it when it completes a search command.
I have yet to find a limitation that did not ultimately lead back to me, rather than Winboard :)

There has been some interest as to how often same-side and opposite-side castling occurs in the CCRL FRC database. As well as examining white score for each starting position, where the opponents are above a specified Elo and are within a specified Elo difference. I have found a hack that will allow me to examine the second area of interest, but not the first.

Are you entertaining the idea of expanding the database functionality (I hope that phrasing conveys my thought) of Winboard. If so, that would be great, but unexpected.

User avatar
hgm
Posts: 22332
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Shredder FEN

Post by hgm » Wed Mar 28, 2012 9:34 pm

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.

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.

MrEdCollins
Posts: 59
Joined: Mon May 02, 2011 10:12 pm
Location: Southern California
Contact:

Re: Shredder FEN

Post by MrEdCollins » Wed Mar 28, 2012 10:33 pm

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.

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

Re: Shredder FEN

Post by Dan Honeycutt » Thu Mar 29, 2012 1:47 am

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: 596
Joined: Wed Oct 13, 2010 7:44 am
Location: Australia
Contact:

Re: Shredder FEN

Post by stevenaaus » Thu Mar 29, 2012 8:10 am

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: 3185
Joined: Wed May 06, 2009 8:31 pm
Location: Fuquay-Varina, North Carolina

Re: Shredder FEN

Post by Adam Hair » Thu Mar 29, 2012 8:22 pm

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. :)

Post Reply