PGN to FEn

40 views
Skip to first unread message

Steve

unread,
Apr 21, 2005, 12:52:43 AM4/21/05
to
Hi!

I've been looking for a very simple program that converts PGN to FEN. It
can be a DOS app or linux or even windows.

All I need is to convert several 1000 PGN formats to FEN.

I noted and have software that does this one file at a time. I want to
write a script to convert them.

Ex: I have a number of Kasparov and Anand etc PGN files. However, I want
them in FEN format. I like the PGN format when I sit down and study a game.
However when I want the computer to analyze a position I don't want to type
each one in, I can make mistakes in the process.

Also, I want to use the FEN format to train a program I've been working on
learning strategies. FEN is the easiest for me. I am trying to experiment
with a new learning algorithm which I've been working on for a while. I
want to compile this data from FEN and have my program try to learn
something from it.

I've an idea that may sound odd. I am using traditional analysis to compute
a position. I spent about 3 years working on this style and using Dr.
Hyatts insight regarding his ingenious bitboard method which took me a while
to comprehend. Now I have something that plays pretty well. As an
experiment, I want to add to the evalulation routine (which is very simple
and I kept it simple for this exact purpose), I want to organize various
games and try to analyze them to say 4 moves deep. Then use some statistical
analysis and learning algorithms to locate trends. Use this info as what I
call the 'creative' feature. Add this 'creative' feature (value) to the
simple analysis and see if the machine begins to learn. The general idea is
that the 'creative' feature(component) will try to come up with the same
value as if it were analyzed by traditional methods. In short, it'd be
interesting to find a set of rules from a self-learning system that doesn't
require to analyze 3 to 4 moves deep but can find the same value within one
move deep.

Therefore, a large sample of FEN would be extremely helpful.

Please is there a simple solution to convert PGN to FEN
-OR-
Is there a db filled w/FEN formats with Grandmasters playing?

If there is a FEN db I can download where can I find it?

I really would appreciate any help.
Steve


Ari Makela

unread,
Apr 21, 2005, 4:51:37 AM4/21/05
to
On 2005-04-21, Steve <scp...@hotmail.com> wrote:

> Please is there a simple solution to convert PGN to FEN

How do you define converting PGN to FEN? Every position in a game or the
last position converted to FEN?

If you know Python I have a python library which could be useful for
you. It's a derivative of Erik Max Francis's python library.

--
Ari Makela no escaping it -
ha...@arska.org I must step on fallen leaves
http://arska.org/hauva/ to take this path (Suzuki Majoko)

hsmyers

unread,
Apr 21, 2005, 10:57:42 AM4/21/05
to
And if you know Perl, I can make the same offer...

--hsm

Enzo

unread,
Apr 21, 2005, 11:13:46 AM4/21/05
to
Hello
I think you have here is the solution:
http://www.7sun.com/chess/index.php
Regards
Enzo

"hsmyers" <hsm...@sdragons.com> a écrit dans le message de news:
1114095462....@g14g2000cwa.googlegroups.com...

Mathieu Pagé

unread,
Apr 21, 2005, 1:25:43 PM4/21/05
to


Hi steve,

Some years ago, I compiled a FEN database, if I remember well it
contains more than 160 millions unique positions. Actually it is on a
CD at home, if you want I can put it on a ftp for you to download it.
(send me an email in that case)


Mathieu P.
mathieu dot page at [google's email service] dot com

Mike Leahy

unread,
Apr 21, 2005, 8:39:14 PM4/21/05
to

"Steve" <scp...@hotmail.com> wrote in message
news:LMmdnXXGxOA...@adelphia.com...

> Hi!
>
> I've been looking for a very simple program that converts PGN to FEN. It
> can be a DOS app or linux or even windows.
>
> All I need is to convert several 1000 PGN formats to FEN.
>
> I noted and have software that does this one file at a time. I want to
> write a script to convert them.
>
> Ex: I have a number of Kasparov and Anand etc PGN files. However, I want
> them in FEN format. I like the PGN format when I sit down and study a
game.
> However when I want the computer to analyze a position I don't want to
type
> each one in, I can make mistakes in the process.

While not a simple program (nor free) Bookup 2000 Professional will import
PGN and then export to EPD which is basically FEN. It has the advantage of
exporting each unique position only once.


Mike Leahy
"The Database Man!"
www.bookup.com
www.chessopeningspgn.com


Ari Makela

unread,
Apr 22, 2005, 4:14:47 AM4/22/05
to
On 2005-04-22, Mike Leahy <mikelea...@bookuppro.com> wrote:

> It has the advantage of
> exporting each unique position only once.

If I understood correctly what Steve wanted (one position as FEN per
line) this is not a problem because one of the platforms was linux.
The command "sort -u" sorts the lines and prints out only the unique
lines.

Mike Leahy

unread,
Apr 22, 2005, 12:22:37 PM4/22/05
to

"Ari Makela" <ha...@lagavulin.sappho.net> wrote in message
news:slrnd6hcjn...@lagavulin.sappho.net...

> On 2005-04-22, Mike Leahy <mikelea...@bookuppro.com> wrote:
>
> > It has the advantage of
> > exporting each unique position only once.
>
> If I understood correctly what Steve wanted (one position as FEN per
> line) this is not a problem because one of the platforms was linux.
> The command "sort -u" sorts the lines and prints out only the unique
> lines.

Handy.

But I doubt it took each FEN and removed those that are duplicates because
of mirrors and/or color reversals. :)

Chris F.A. Johnson

unread,
Apr 22, 2005, 3:04:43 PM4/22/05
to
On Fri, 22 Apr 2005 at 08:14 GMT, Ari Makela wrote:
> On 2005-04-22, Mike Leahy <mikelea...@bookuppro.com> wrote:
>
>> It has the advantage of
>> exporting each unique position only once.
>
> If I understood correctly what Steve wanted (one position as FEN per
> line) this is not a problem because one of the platforms was linux.
> The command "sort -u" sorts the lines and prints out only the unique
> lines.

If you want to keep the lines in the original order:

awk 'x[$0]++ == 0' FILENAME > NEWFILE


--
Chris F.A. Johnson http://cfaj.freeshell.org
==================================================================
Shell Scripting Recipes: A Problem-Solution Approach, Apress, 1999
http://www.torfree.net/~chris/books/ssr.html

Wijnand Engelkes

unread,
Apr 23, 2005, 12:24:37 AM4/23/05
to
there is the SAN kit by Mr. Edwards,
and at http://www.7sun.com/chess/index.php
there is the program PGN2FEN.
I always use the SAN kit. It is a DOS command line program, but it has a lot
of features.
Wijnand.

"Steve" <scp...@hotmail.com> wrote in message
news:LMmdnXXGxOA...@adelphia.com...

-nospam-

unread,
Aug 10, 2005, 2:21:03 PM8/10/05
to
Steve wrote:

> I've been looking for a very simple program that converts PGN to FEN. It
> can be a DOS app or linux or even windows.

See other answers. I can add pgn-extract that does a lot of PGN
conversions.

> Also, I want to use the FEN format to train a program I've been working on
> learning strategies. FEN is the easiest for me. I am trying to experiment
> with a new learning algorithm which I've been working on for a while. I
> want to compile this data from FEN and have my program try to learn
> something from it.

I am in the same situation for my program. I came accross EPD however
that is an extension to FEN. (Cut the last 2 parts and add some new ones).

I am still trying to figure out how you actually use this together with
some scripts to evaluate your program. There is plenty of information
available on those EPD testsuites.

> I've an idea that may sound odd. I am using traditional analysis to compute
> a position. I spent about 3 years working on this style and using Dr.
> Hyatts insight regarding his ingenious bitboard method which took me a while
> to comprehend. Now I have something that plays pretty well. As an
> experiment, I want to add to the evalulation routine (which is very simple
> and I kept it simple for this exact purpose), I want to organize various
> games and try to analyze them to say 4 moves deep.

We need to talk about this... I plan trying 0 moves deep statistical
analysis.


http://www.internetcontact.be/~macchess
Yves

Reply all
Reply to author
Forward
0 new messages