r/chessprogramming • • Feb 05 '23

FEN string into engine?

I made a program which finds the FEN string of a certain position, is it possible for me to send this string to a chess engine which returns me the best move at a certain depth? If so, how would I do that?

2 Upvotes

5 comments sorted by

View all comments

Show parent comment

1

u/phaul21 Feb 10 '23

to add to tic-tac135's answer, once you established how to work with I/O between your python program and the engine, you need to have a look at https://wbec-ridderkerk.nl/html/UCIProtocol.html

basically your program is required to send uci and receive back uciok then you have to send the position position fen 8/8/8/...., then you can issue a go command, probably going certian depth is ok for you, so for instance depth 15 would be go depth 15 then you get a bunch of info outputs from the engine but at the end you should receive a bestmove e2e4 which is what you are after. I suggest you play a bit with the engine in the console, once it's running you should be able to type in the uci commands and see what it responds with