Best way to use UCI engine to play against itself So far I used UCI only to make analysis of particular positions, sending FEN, showing multipv, analysing fixed depth/time, clearing hash for every next position.

Now I would like to make the same engine play against itself a blitz game and I guess this approach might waste a lot of CPU resources. Any information on this topic, ideally with example of UCI communication included, will be appreciated. Especially I want to ask:

How should I setup hash and when should I clear it? After each move, after reaching certain amount of nodes searched from last clearing to defend against hash colisions?

Is there a better way than sending FEN after each move to UCI?

Should I setup multipv to 1 and always wait for "bestmove"?

I'm not very concerned by slowdowns caused by fen parsing etc, but I would like not to make some huge mistake like clearing knowledge made on previous moves. Of course I want engine being able to reuse as much calculations as possible for both sides from last moves.
I don't think it's a good idea to write a new framework. You should use Cutechess. CuteChess is free, stable, fast and reliable.

I'll answer your questions anyway:


You should not clear the hash, it's the engine job to fill it and replace it
You don't have to send FEN, you can also give a move list
By default, multipv is 1 so you don't need to do anything