I'm trying to talk to a UCI engine (right now Stockfish, but more generally to all UCI engines) to write my own computer-vs-computer program (I could use Fritz, but I really want to learn more about UCI and engines in general, so I'm trying to do it on the nuts and bolts level).
I've gotten to the point where I can do:
position fen r1b1kb1r/ppp2ppp/3p1q1n/4p3/3nP3/1PN2N2/PBPPQPPP/R3KB1R w KQkq - 0 7 go wtime 500000 btime 500000
info nodes 811977 time 4620 bestmove f3d4 ponder e5d4
So I know my engine decided, after it's processing time of 4620 milliseconds, to move f3d4, and it expects the other player to play e5d4.
First question: do I immediately send
go ponder to let the engine think? Or do I need to use other commands first?
The player plays a move and, hot dog, it's what the engine said it was going to ponder.
Second question: do I just send it a
ponderhit or do I need to
postition fen --new position-- first then send
I'd personally expect the engine to update it's internal state on a ponderhit, but it looks like the engine is supposed to rely on the GUI to handle all board state for the game, is this correct?
All the examples I've seen just do a single analysis, or run a single move then end, I don't know how to continue the game!
Third question: When I send a
go command I send along with it the wtime and btime left on my game's clock. Does the engine actually use this data to decide how long to think on each move, or does it expect the GUI to tell it how to manage it's own time? It looks like the engine handles this thinking on it's own, but as I've never actually gotten to the NEXT move, I'm not sure if it's actually doing time management.
I know these are horribly newbish questions, but all the reading up I've found on the UCI engine seems to just talk about one move, or analyzing a move, and I haven't found any examples of multiple moves in sequence, so I'm not quite sure how to play THROUGH a game on the UCI command line.