#UCI to FEN conversion

10 messages · Page 1 of 1 (latest)

fickle glen
#

Copied from #lichess-development @leaden goblet

i'm building CLI app with go and idea is that i want to display mate in 1 puzzle when you open a terminal
and you should enter a correct move in prompt ... but in lichess_db_puzzle.csv these puzzles comes with: one opponent move and then second final move(c3b5 e5h2) ...
i want position from move one , so you only need to enter last move in prompt...
i thought i would convert that UCI move to fen or something...

#

the opponent move is so that the last move can be highlighted

#

Obviously, you can't convert a UCI move itself into a FEN (the same as you can't convert "Nf3" into a FEN. But you can apply the move to the starting FEN to get the position after the move.

#

if you're using a chess library, it might have a built-in function for that

#

otherwise, you'll have to do it yourself. for the most part, you just need to move the piece from the first square to the second. but en passant and castling need special handling.

#

possibly, you could also pre-process all puzzles with python-chess which definitely supports this. you can just create a board from a FEN, apply a UCI move, and get the FEN of the new board.

lusty edge
#

I had to do something similar in my app in TS, I v exactly done what you last said, create a board with the starting fen, make the move, then get the fen of the new board. I used chess.js for that. You should be able to find a library in the language you are using.

leaden goblet
#

i'm not using any chess library or chess logic , just converting fen position to board...
so the best move would be to pre-process all puzzles with python-chess. create a board from a FEN, apply a UCI move, and get the FEN of the new board.?

lusty edge
#

imo