Answers.Body: <p>I don't think it's a good idea to write a new framework. You should use <a href="https://github.com/cutechess/cutechess/tree/master/docs" rel="nofollow noreferrer">Cutechess</a>. CuteChess is free, stable, fast and reliable.</p>
  
  <p>I'll answer your questions anyway:</p>
  
  <ul>
  <li>You should not clear the hash, it's the engine job to fill it and replace it</li>
  <li>You don't have to send FEN, you can also give a move list</li>
  <li>By default, multipv is 1 so you don't need to do anything</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-05T11:47:05.837Z
Answers.LastActivityDate: 2017-01-05T12:27:48.987Z
Answers.LastEditDate: 2017-01-05T12:27:48.987Z
Answers.UserDisplayName: SmallChess
Body: <p>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.</p>
  
  <p>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:</p>
  
  <p><strong>How should I setup hash and when should I clear it</strong>? After each move, after reaching certain amount of nodes searched from last clearing to defend against hash colisions?</p>
  
  <p><strong>Is there a better way than sending FEN after each move to UCI?</strong></p>
  
  <p><strong>Should I setup multipv to 1 and always wait for "bestmove"?</strong></p>
  
  <p>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.</p>
  
Tags: <programming><uci><blitz>
Title: Best way to use UCI engine to play against itself
ThreadText: # Best way to use UCI engine to play against itself
  
  (Asked by: username_0 on 2017-01-05)
  
  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.
  
  **Tags:** programming, uci, blitz
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-01-05. Score: 1 | Accepted answer
  
  I don't think it's a good idea to write a new framework. You should use [Cutechess](https://github.com/cutechess/cutechess/tree/master/docs). 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
  
  
  ---
  
  