Page 1 of 2

FEN - Flipper for Windows

Posted: Wed May 17, 2017 10:10 am
by Matthias Gemuh
FEN - Flipper for Windows

Give him your EPD folder, and the guy will flip the FENs, and best moves, and "avoid" moves, and PV.

He spits out *_flip.epd with only flipped positions, and *_x.epd with mixed.
The original EPD files remain untouched.

http://www.chess.hylogic.de/chess/FenFlipper.zip

[D]r2q1rk1/pp3ppp/1bpN1n2/4n3/1PP1P1b1/P1N2PP1/6BP/R1BQK2R b KQ - bm Bxf3

flips to

[D]r1bqk2r/6bp/p1n2pp1/1pp1p1B1/4N3/1BPn1N2/PP3PPP/R2Q1RK1 w kq - bm Bxf6

Matthias.

Re: FEN - Flipper for Windows

Posted: Wed May 17, 2017 10:22 am
by Daniel Anulliero
It will be good to debug the eval and others things
Thanks for sharing !

Re: FEN - Flipper for Windows

Posted: Wed May 17, 2017 2:47 pm
by Matthias Gemuh
Daniel Anulliero wrote:It will be good to debug the eval and others things
Thanks for sharing !
Yes, example

Code: Select all

0001 124 1br3k1/1p4p1/p3p2r/5pq1/3Nb3/P1B1PpP1/1P1R3P/2R1Q1K1 b - - bm f2;
0002 124 2r1q1k1/1p1r3p/p1b1pPp1/3nB3/5PQ1/P3P2R/1P4P1/1BR3K1 w - - bm  f7;
0003 110 1k1r1b1r/Rpp2ppp/4b3/1q2N3/5Q2/1PN5/2nP1PPP/2BKR3 b - - bm Bxb3;
0004 110 2bkr3/2Np1ppp/1pn5/5q2/1Q2n3/4B3/rPP2PPP/1K1R1B1R w - - bm  Bxb6;
0005 -134 1k1r1b1r/p1p1q3/2p1p3/4Ppp1/4nP2/P2BQ3/1PP3PB/2KR3R b - - bm Rxh2;
0006 -134 2kr3r/1pp3pb/p2bq3/4Np2/4pPP1/2P1P3/P1P1Q3/1K1R1B1R w - - bm  Rxh7;
0007 -40 1k1r2r1/p1p3q1/2p2p2/3pn3/1P1b2bB/1QN5/P4PPP/1R2RBK1 b - - bm Nf3;
0008 -40 1r2rbk1/p4ppp/1qn5/1p1B2Bb/3PN3/2P2P2/P1P3Q1/1K1R2R1 w - - bm  Nf6;
0009 -653 1k6/1p2p3/3p4/Qp1P1p2/2P2Pp1/P3Rn2/KP1q4/6r1 w - - bm Qd8;
0010 -653 6R1/kp1Q4/p3rN2/2p2pP1/qP1p1P2/3P4/1P2P3/1K6 b - - bm  Qd1;
0011 -9 1n2k2r/rp4pp/pN3p2/2n1p3/4P3/N7/PP2KPPP/R6R w k - bm Rac1;
0012 -9 r6r/pp2kppp/n7/4p3/2N1P3/Pn3P2/RP4PP/1N2K2R b K - bm  Rac8;
0013 75 1n2rr2/1pk3pp/pNn2p2/2N1p3/8/6P1/PP2PPKP/2RR4 w - - bm Nca4;
0014 75 2rr4/pp2ppkp/6p1/8/2n1P3/PnN2P2/1PK3PP/1N2RR2 b - - bm  Nca5;
0015 8 1nbq1r1k/3rbp1p/p1p1pp1Q/1p6/P1pPN3/5NP1/1P2PPBP/R4RK1 w - - bm Nfg5;
0016 8 r4rk1/1p2ppbp/5np1/p1Ppn3/1P6/P1P1PP1q/3RBP1P/1NBQ1R1K b - - bm  Nfg4;

Re: FEN - Flipper for Windows

Posted: Wed May 17, 2017 6:35 pm
by Dann Corbit
My friend Les Fernandez wrote something like that for me using vb.net.

Given this input:
B2R4/1nQqQ3/1QrbrQ2/NqqkqqN1/1QqqqQ2/2QbQn2/3B2R1/3K4 w - - acd 17; acs 14040; bm Qcxc6+; c3 "Qcxc6+"; ce 32752; dm 8; pm Qcxc6+; pv Qcxc6+ Qbxc6 Q4xc5+ Qc4xc5 Qcxc5+ Qdxc5 Qexc5+ Qxc5 Bxb7+ Qcc6 Bxc6+ Qxc6 Qxc6+ Kd4 Nxf3#;
QqN1Q3/rqb1q3/1QqQ4/1n1Q3R/krq1Qq2/2Qb4/q1n2QR1/NqQqBB1K w - - acd 17; acs 6660; bm Qbxa7+; ce 32752; dm 8; pm Qbxa7+; pv Qbxa7+ Q8xa7 Qfxa7+ Qxa7 Qxa7+ Ba5 Nb6+ Qxb6 Qexb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krrrnN2/1q6/2qq3r/8/8 b - - pv Nxg6+; ce 32752; id "P3bS1";
1N2QKN1/nqq1QQNN/1q1qN1N1/krrr1N2/1q3n2/2qq3r/8/8 b - - pv Nxg6+; ce 32752; id "P3bS2";
1N2QKN1/nqq1QQNN/1q1qN1N1/krrr1N2/1q5n/2qq3r/8/8 b - - pv Nxg6+; ce 32752; id "P3bS3";
1N2QKNn/nqq1QQNN/1q1qN1N1/krrr1N2/1q6/2qq3r/8/8 b - - pv Nxg6+; ce 32752; id "P3bS4";
8/8/R3QQ2/6Q1/2nNRRRK/1n1nQ1Q1/nnqq1QQN/1nkq2n1 w - - pv Nxb3+; ce 32752; id "P3cS1";
8/8/R3QQ2/2N3Q1/2n1RRRK/1n1nQ1Q1/nnqq1QQN/1nkq2n1 w - - pv Nxb3+; ce 32752; id "P3cS2";
8/8/R3QQ2/N5Q1/2n1RRRK/1n1nQ1Q1/nnqq1QQN/1nkq2n1 w - - pv Nxb3+; ce 32752; id "P3cS3";
8/8/R3QQ2/6Q1/2n1RRRK/1n1nQ1Q1/nnqq1QQN/Nnkq2n1 w - - pv Nxb3+; ce 32752; id "P3cS4";
8/8/2QQ3R/1Q6/KRRRNn2/1Q1Qn1n1/NQQ1qqnn/1n2qkn1 w - - pv Nxg3+; ce 32752; id "P3dS1";
8/8/2QQ3R/1Q3N2/KRRR1n2/1Q1Qn1n1/NQQ1qqnn/1n2qkn1 w - - pv Nxg3+; ce 32752; id "P3dS2";
8/8/2QQ3R/1Q5N/KRRR1n2/1Q1Qn1n1/NQQ1qqnn/1n2qkn1 w - - pv Nxg3+; ce 32752; id "P3dS3";
8/8/2QQ3R/1Q6/KRRR1n2/1Q1Qn1n1/NQQ1qqnn/1n2qknN w - - pv Nxg3+; ce 32752; id "P3dS4";

Re: FEN - Flipper for Windows 1.1

Posted: Wed May 17, 2017 9:12 pm
by Matthias Gemuh
FEN - Flipper 1.1

I have just added the handling of the "pm" and "c0" tags.

The STS Testsuite uses the "c0" tag to score moves.

Re: FEN - Flipper for Windows

Posted: Thu May 18, 2017 1:30 am
by Ferdy
Nice converter :!:

Created a tool to read its output send eval command to engine and compare the score returned for every two succeeding positions.

Code: Select all

C:\chess\python\PositionFlipTest>pft.py d.exe sts_x.epd
:: Result summary ::
Test file             : sts_x.epd
Total Positions       : 3000
Number of Comparisons : 1500
Engine                : Deuterium v2017.1.35.402g
Errors                : 0

C:\chess\python\PositionFlipTest>pft.py sf.exe sts_x.epd
:: Result summary ::
Test file             : sts_x.epd
Total Positions       : 3000
Number of Comparisons : 1500
Engine                : Stockfish 180417 64 POPCNT
Errors                : 0 
BTW I am converting around 1.3 million positions (71 mb file) and it took now 35 minutes and is still running...

The epd format is just like this:

Code: Select all

r3rk2/p1p2ppp/b2b4/2P5/2PB2n1/P2B4/4NPPP/2KR3R b - - c9 "1/2-1/2";
Perhaps this can be optimized in the future.

Re: FEN - Flipper for Windows

Posted: Thu May 18, 2017 3:16 am
by Matthias Gemuh
Ferdy wrote:...

BTW I am converting around 1.3 million positions (71 mb file) and it took now 35 minutes and is still running...

The epd format is just like this:

Code: Select all

r3rk2/p1p2ppp/b2b4/2P5/2PB2n1/P2B4/4NPPP/2KR3R b - - c9 "1/2-1/2";
Perhaps this can be optimized in the future.
35+ minutes is really long.

If the conversion fails, let me know. Speed up possible.

Re: FEN - Flipper for Windows

Posted: Thu May 18, 2017 3:42 am
by Ferdy
Matthias Gemuh wrote:
Ferdy wrote:...

BTW I am converting around 1.3 million positions (71 mb file) and it took now 35 minutes and is still running...

The epd format is just like this:

Code: Select all

r3rk2/p1p2ppp/b2b4/2P5/2PB2n1/P2B4/4NPPP/2KR3R b - - c9 "1/2-1/2";
Perhaps this can be optimized in the future.
35+ minutes is really long.

If the conversion fails, let me know. Speed up possible.
Conversion was finally done after around 2 hrs and used a max of around 600 MB of memory.

Re: FEN - Flipper for Windows

Posted: Thu May 18, 2017 3:48 am
by Ferdy
With selected 1.3 million pos, my new implementation of ending knowledge was busted quickly :).

Code: Select all

C:\chess\python\PositionFlipTest>pft.py d.exe train_1_x.epd

There is problem in Pos 1905 and 1906
pos1: 5, pos2: 381
There is problem in Pos 1945 and 1946
pos1: -6, pos2: -398
There is problem in Pos 2573 and 2574
pos1: -417, pos2: -6
There is problem in Pos 5645 and 5646
pos1: 7, pos2: 466
There is problem in Pos 7449 and 7450
pos1: -7, pos2: -504

Re: FEN - Flipper for Windows

Posted: Thu May 18, 2017 4:14 am
by Matthias Gemuh
Ferdy wrote: Conversion was finally done after around 2 hrs and used a max of around 600 MB of memory.
I lazily load the EPD files into a listbox before processing it.
That eats memory and limits size of EPD file the tool can handle.
I shall change that and speed things up.