Tool to ECO classify EPD positions?

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

Moderators: hgm, Rebel, chrisw

Dann Corbit
Posts: 12537
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Tool to ECO classify EPD positions?

Post by Dann Corbit »

Does such a tool exist?
I only know of tools for PGN.
And if you turn EPD positions into PGN, the tools all classify them incorrectly (at least those that I have tried).

IOW, for instance, all games come out A00 like this:

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]
[ECO "A00a"]
[Setup "1"]
[Fen "r1b1qrk1/ppp3bp/n2p1pp1/2P5/3pP1nB/2N2N2/PP2BPPP/R2Q1RK1 w - -"]

*

after you run them through the classifier.

Other classifiers simply do not find anything.

So, is there any reliable tool to classify a set of EPD positions?
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Tool to ECO classify EPD positions?

Post by Ferdy »

I have not known such tool.

I have done a python script in the past adding eco, opening name etc.

and tried it on Kai's opening test set.

http://talkchess.com/forum/viewtopic.ph ... 11&t=61858

What I did is something like the following.

given eco.pgn and epdList

Code: Select all

for epd in epdList:
    for game in eco.pgn:
        for move in game:
            gepd = getEpd()            
            if gepd == epd:
                save_eco_from_this_game()
                break
            makemove(move)
It is a very long process as it visits all positions in every game found in ref eco.pgn. It is also dependent on the quality of ref eco.pgn you use.

Here is one complication, it can happen that the epd can be found in some games in the eco.pgn, which would result to multi eco in one epd. To filter this out further one idea is to record the ply when epd was encountered then later only use the eco of the epd having the largest ply in eco.pgn.

I am not sure now what I did on filtering I need to see the code again.

If you are really interested I will try to dig it out somewhere in my backup disk.
tpoppins
Posts: 919
Joined: Tue Nov 24, 2015 9:11 pm
Location: upstate

Re: Tool to ECO classify EPD positions?

Post by tpoppins »

I'm afraid that this quest is based on a faulty premise - that ECO codes apply to positions. They don't. ECO codes are defined by sequences of moves, not by any of the positions that arise in the process.

For example, some IQP positions can be reached via certain lines of the Panov Caro-Kann, the QGA, the Semi-Tarrasch or the Nimzo-Indian. What ECO codes would be correct for those - B1x, Dxx or Exx? The obvious answer is none. The lines that lead to those positions can be assigned ECO codes, the positions themselves cannot.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Tool to ECO classify EPD positions?

Post by Ferdy »

tpoppins wrote:I'm afraid that this quest is based on a faulty premise - that ECO codes apply to positions. They don't. ECO codes are defined by sequences of moves, not by any of the positions that arise in the process.

For example, some IQP positions can be reached via certain lines of the Panov Caro-Kann, the QGA, the Semi-Tarrasch or the Nimzo-Indian. What ECO codes would be correct for those - B1x, Dxx or Exx? The obvious answer is none. The lines that lead to those positions can be assigned ECO codes, the positions themselves cannot.
Perhaps if we are just interested on assinging ECO to position, we can just write all ECO that are applicable to epd, example.

Code: Select all

rnb1k2r/pppnqppp/4p3/3pP3/3P1P2/2N5/PPP3PP/R2QKBNR b KQkq - eco "axx bxx cxx dxx";

carldaman
Posts: 2283
Joined: Sat Jun 02, 2012 2:13 am

Re: Tool to ECO classify EPD positions?

Post by carldaman »

tpoppins wrote:I'm afraid that this quest is based on a faulty premise - that ECO codes apply to positions. They don't. ECO codes are defined by sequences of moves, not by any of the positions that arise in the process.

For example, some IQP positions can be reached via certain lines of the Panov Caro-Kann, the QGA, the Semi-Tarrasch or the Nimzo-Indian. What ECO codes would be correct for those - B1x, Dxx or Exx? The obvious answer is none. The lines that lead to those positions can be assigned ECO codes, the positions themselves cannot.
As far as I know, Chessbase assigns ECO based on the position reached, if that can be reached via a different and better-established move order, and not necessarily the actually played move order.
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: Tool to ECO classify EPD positions?

Post by jdart »

I have a tool for PGN:

https://github.com/jdart1/arasan-chess/ ... ocoder.cpp

It doesn't currently handle the FEN tag but it would not be very hard to make it do that.

See also the ECO class in the src directory, which basically is a position/ECO mapper.

As for accuracy, the problem is that the ECO classification system is inherently ambiguous. There are many cases where you can classify an opening two or more ways, because of transpositions. The classic example is D42 (Semi-Tarrasch) vs B14 (Caro-Kann Botvinnik), some lines of which can also be classified B22 or one of the Nimzo-Indian defenses. Even ChessBase is not consistent in how they classify games.

--Jon
Norm Pollock
Posts: 1056
Joined: Thu Mar 09, 2006 4:15 pm
Location: Long Island, NY, USA

Re: Tool to ECO classify EPD positions?

Post by Norm Pollock »

Scid vs PC has a file called scid.eco. I am not sure if it comes with the installation or if you have to do a small execution to create it.

It contains 10,360 DISTINCT eco positions along with an extended (4 place) ECO value.

Here is an outline for a potential tool:

Put these 10,360 eco into a binary tree. Then search this tree with each of the epd positions that the user wants to classify. If there is a match, then keep going until the search is finished. At each step where there is a match, use the ECO value of the match as the potential "eco" opcode for the user epd. There may be more than one match. Use the last possible match. Default is A00a which is the start position and also the first position listed in "scid.eco".

The default value is A00a. So expect to see A00a for any position that has gone beyond the opening. For example (extreme case): if it is a "KPkp" position, there is no way to give an ECO value.

Here is a direct link to scid.eco that I will list for a short time:

http://www.mediafire.com/file/3i82z9d8qvzi818/scid.epd
Updated links for 40H Tools and Databases
http://40Hchess.epizy.com
http://nk-qy.info/40h
Vinvin
Posts: 5228
Joined: Thu Mar 09, 2006 9:40 am
Full name: Vincent Lejeune

Re: Tool to ECO classify EPD positions?

Post by Vinvin »

For information, there are 4671 fen positions with English name and ECO code : https://gist.github.com/niklasf/e3d09e380410848964d0
Frank Quisinsky
Posts: 6808
Joined: Wed Nov 18, 2009 7:16 pm
Location: Gutweiler, Germany
Full name: Frank Quisinsky

Re: Tool to ECO classify EPD positions?

Post by Frank Quisinsky »

Hi Jon,

that is indeed a problem!
Not only Chessbase have problems with many of the codes, other GUIs too. In my opinion best available material is:

Small Encyclopaedia of chess openings.

Note:
A much bigger problem as you wrote is the following situation:
ECO code formed (for an example after 6 moves). Three moves later the move transposition into an other code. Most of programs have now the biggest problem to jump in the right code.

So, not only the move transposition for the first moves of a game are really often difficult to understand, also the move transpositions many moves later, after the ECO code should be clear and formed is much more difficult to understand for chess software.

Best
Frank