Does a utility already exist to transform the Lichess tactical problems into regular EPD

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

Moderator: Ras

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

Does a utility already exist to transform the Lichess tactical problems into regular EPD

Post by Dann Corbit »

The problem is not the uci notation, which is trivial to fix.
It is that:
"FEN is the position before the opponent makes their move.
The position to present to the player is after applying the first move to that FEN.
The second move is the beginning of the solution."

So the first move is some useless move to get us to the problem position {WHY!?} and the second move is the bm.
I realize that it is pretty trivial to write this, but has someone already done it?
For example:
[d]Q1b2r1k/p2np2p/5bp1/q7/5P2/4B3/PPP3PP/2KR1B1R w - -,d1d7 a5e1 d7d1 e1e3 c1b1 e3b6
implies this actual problem:
[d]Q1b2r1k/p2Rp2p/5bp1/q7/5P2/4B3/PPP3PP/2K2B1R b - - bm Qe1;
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.
chesskobra
Posts: 354
Joined: Thu Jul 21, 2022 12:30 am
Full name: Chesskobra

Re: Does a utility already exist to transform the Lichess tactical problems into regular EPD

Post by chesskobra »

I wonder if this tool https://github.com/brianch/offline-chess-puzzles contains the necessary code. It takes the original csv from lichess. It can also print diagrams of puzzles from the lichess database. Lichess could have just used the epd format, with all the c0, c1, ... tags.

Also, some time ago https://chessnerd.net/ had published the lichess puzzles in pgn format. So he may have done it, although I don't find the puzzles in pgn anymore on his site, nor the code.
Dann Corbit
Posts: 12792
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Does a utility already exist to transform the Lichess tactical problems into regular EPD

Post by Dann Corbit »

The lichess code is in Rust, and unfortunately I am not a rust programmer, though I am a bit rusty at times.
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.
Dann Corbit
Posts: 12792
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Does a utility already exist to transform the Lichess tactical problems into regular EPD

Post by Dann Corbit »

I think I figured something out:
I can use form the 40H tools by Norman Pollock:
8. "epdFin" / "pgnFin" is used in combination with the utility tool
"PGN-Extract" by David Barnes. Together they input a "pgn" file. Then
for each game, they output the "epd" record of the final position.

I can just generate pgn files with [Fen "<fengoeshere>"] and then give it the move to achieve the test position.
Then the program should generate the output. In fact, I can skip a step and just use pgn2fen directly.
I should have thought of that.

I can also use PGN-extract to change all the uci moves into SAN.
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.
Halifax
Posts: 12
Joined: Fri Nov 11, 2022 8:50 pm
Full name: Ian Rastall

Re: Does a utility already exist to transform the Lichess tactical problems into regular EPD

Post by Halifax »

chesskobra wrote: Sun Oct 20, 2024 4:51 pm Also, some time ago https://chessnerd.net/ had published the lichess puzzles in pgn format. So he may have done it, although I don't find the puzzles in pgn anymore on his site, nor the code.
Here it is:
https://www.mediafire.com/file_premium/ ... r.zip/file

Along with the PGN of puzzles is the Python file that I used to create it, along with two dependent files. It's a ChatGPT script. The CSV from Lichess with the puzzle information is missing from the download, because it's always being updated, and is better to supply on your end.

Hope all are well.
chesskobra
Posts: 354
Joined: Thu Jul 21, 2022 12:30 am
Full name: Chesskobra

Re: Does a utility already exist to transform the Lichess tactical problems into regular EPD

Post by chesskobra »

Thanks a lot. Also, a nice site you maintain. I keep an eye on it for interesting data. Nowadays I sometimes use chatgpt to get small scripts, especially text processing.
Dann Corbit
Posts: 12792
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Does a utility already exist to transform the Lichess tactical problems into regular EPD

Post by Dann Corbit »

Thanks Halifax.
That saved me some toil.
I will run your script against the new file if it looks like the contents are valuable.
I am guessing that almost all of them will be too easy.
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.
Dann Corbit
Posts: 12792
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Does a utility already exist to transform the Lichess tactical problems into regular EPD

Post by Dann Corbit »

Here is the data as a pgn file with no clocks:

Last three records:

Code: Select all

8/5pk1/6p1/P6p/1r6/1P6/1R6/4K3 b - - bm h4;
4b3/7k/3bp3/3p1pBP/pPpP3P/P3P2K/8/3B4 w - - bm Bf4;
r1bqr2k/pp3pp1/3p1n1p/2pPn3/2P1P2Q/1P1B2RP/P5P1/R1B3K1 b - - bm Nxd3;
Here is the data as a pgn file with both clocks:

Code: Select all

8/5pk1/6p1/P6p/1r6/1P6/1R6/4K3 b - - 2 47 bm h4;
4b3/7k/3bp3/3p1pBP/pPpP3P/P3P2K/8/3B4 w - - 9 53 bm Bf4;
r1bqr2k/pp3pp1/3p1n1p/2pPn3/2P1P2Q/1P1B2RP/P5P1/R1B3K1 b - - 4 20 bm Nxd3;
Here is the data as a pgn file without bm or clocks (bare EPD):

Last three records:

Code: Select all

8/5pk1/6p1/P6p/1r6/1P6/1R6/4K3 b - -
4b3/7k/3bp3/3p1pBP/pPpP3P/P3P2K/8/3B4 w - -
r1bqr2k/pp3pp1/3p1n1p/2pPn3/2P1P2Q/1P1B2RP/P5P1/R1B3K1 b - -
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.
Dann Corbit
Posts: 12792
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Does a utility already exist to transform the Lichess tactical problems into regular EPD

Post by Dann Corbit »

That is one strange dataset. Almost all of the positions are lost.
Maybe the description is wrong?
Not sure even what to think of it.
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.
chesskobra
Posts: 354
Joined: Thu Jul 21, 2022 12:30 am
Full name: Chesskobra

Re: Does a utility already exist to transform the Lichess tactical problems into regular EPD

Post by chesskobra »

Dann Corbit wrote: Sun Oct 20, 2024 10:09 pm Thanks Halifax.
That saved me some toil.
I will run your script against the new file if it looks like the contents are valuable.
I am guessing that almost all of them will be too easy.
The lichess puzzles have ratings (based on how the users perform on a puzzle). You could filter by rating. But even high rated puzzles may be too easy for engines.