Answers.Body: <p>I dug around for a bit and it seems it's surprisingly less straightforward than I thought. I don't know about other engines, but much of the randomness of eg. Stockfish and Leela Chess Zero comes from the time control and multi threading. It's surprisingly hard to make multi-threading search code deterministic, and since computer timers aren't perfectly precise, time control can introduce randomness by changing number of nodes searched even if the search itself was deterministic if the search is only given a certain amount of wall clock time as opposed to number of nodes.</p>
  <p>It seems both Stockfish and lc0 running with a single thread and with a time control of a fixed number of nodes (instead of wall clock time) are deterministic. (For example, according to Wikipedia on lc0: Setting up the engine to play a single node with --minibatch-size=1 and go nodes 1 for each played move creates deterministic play, and Self-Play Elo on such settings will always yield the same result between 2 of the same networks on the same start position—always win, always loss, or always draw. See also <a href="https://chess.stackexchange.com/questions/19482/randomness-in-engine-play/19486">Randomness in engine play</a>) It's possible to control the number of nodes searched, but this feature is rarely used and not available as an option on popular platforms/apps such as chess.com, Lichess or Smallfish for iOS when playing against the computer. I haven't found a good simple way to do this yet, and if there's no existing solution, the easiest way might be to set up your own local engine (can be web-based) and give it the correct parameters to make it deterministic. Lichess does have a few bots based on lc0 that claim to not use calculation (I guess this means only using one node so should take out the randomness), such as <a href="https://lichess.org/@/LazyBotJr" rel="nofollow noreferrer">https://lichess.org/@/LazyBotJr</a> but I'm not sure if it's how it works, and anyway it's not very strong and the strength can't be adjusted.</p>
  <p>Edit: I found another possible solution: it seems Fairy-Stockfish Playground (<a href="https://fairyground.vercel.app/advanced.html" rel="nofollow noreferrer">https://fairyground.vercel.app/advanced.html</a>) has advanced options that allow setting the number of nodes to search. Yes, it's mainly for chess variants, but by default it plays normal chess if you don't choose a variant. You can try setting the number of nodes in Settings (in one of the input boxes marked &quot;Nodes&quot;) and setting number of threads to 1 (input box marked &quot;Thread&quot;) and enable engine for White or Black and play it.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-22T06:54:40.950Z
Answers.Text: I’ll look into old emulators, maybe there are GBA chess engines that are single tread.
Answers.UserDisplayName: OrigamiEye
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-22T08:21:29.443Z
Answers.Text: @OrigamiEye It seems Chessmaster on GBA is not deterministic because its search is limited by time/hardware rather than number of nodes according to https://gamefaqs.gamespot.com/gba/567124-chessmaster/faqs/38373 ("Personality ratings change ... based upon the 
  processor speed, current memory usage, and RAM available to the engine") It may be somewhat more predictable than multi-threaded engines but likely not truly deterministic. I tested fairy-stockfish playground and it works and gives the same result on different devices if I set it to the same number of nodes and 1 thread.
Answers.UserDisplayName: alices_and_bobs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-22T10:50:22.087Z
Answers.Text: In a drawn endgame, it might be the case multiple moves are equally good (they result in a draw) so the engine might pick one at random.
Answers.UserDisplayName: Lucenaposition
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-22T15:39:34.923Z
Answers.Text: @Lucenaposition I don't know about others but Stockfish uses pseudorandomness based on number of nodes, so if you set number of nodes it is deterministic. see https://chess.stackexchange.com/questions/25278
Answers.UserDisplayName: alices_and_bobs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-22T03:33:36.507Z
Answers.LastActivityDate: 2024-06-22T07:42:38.217Z
Answers.LastEditDate: 2024-06-22T07:42:38.217Z
Answers.UserDisplayName: alices_and_bobs
Answers.Body: <p>A chess engine on PC is almost deterministic in its move results if...</p>
  <p>You play with 1 thread only;</p>
  <p>you switch off all parameters that guide move variety like Position Learning, Book Learning, Hashtables, MultiPV;</p>
  <p>keep the usage of Endgame Tablebases on;</p>
  <p>if possible switch off NNUE and MCTS to force the computer to use its own coded routines (not possible with every engine.)</p>
  <p>Despite of all that, some engines have a randomness in their code with which they process the possible moves, some make a ranking hitlist after the main calculated variation that is different each time, in this case you cannot get a secure repetition of a move in a specific time frame.
  You would also have in each case to make the computer move after a fixed time bypassing the variety of different response times - as said above, best is to set a precise nodes-per-move calculation.</p>
  <p>So far for my answer, but commenting on your &quot;go back and try different moves to see how they effect the game&quot;, I don't think that doing all this is really necessary for that purpose.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-22T13:03:01.953Z
Answers.LastActivityDate: 2024-06-22T13:08:38.993Z
Answers.LastEditDate: 2024-06-22T13:08:38.993Z
Answers.UserDisplayName: MikeTrans
Answers.Body: <p>Most engines do in my experience. Its just that nowadays the devs fiddle the source code in a way that it's not the same repetitive straight track. In most GUIs, you should see the pgn. Try going back to that same move in that visible pgn and make another move. That should work. Hope this helps!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-24T21:40:57.210Z
Answers.LastActivityDate: 2024-06-24T21:40:57.210Z
Answers.UserDisplayName: Hugo
Answers.Body: <p>By default engines are deterministic, usually them having variance is a feature.</p>
  <p>You just want to play against <em>any</em> computer? I enjoyed playing against this one: <a href="https://krystman.itch.io/pico-checkmate" rel="nofollow noreferrer">https://krystman.itch.io/pico-checkmate</a>
  Have fun!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-12-12T10:29:32.263Z
Answers.Text: Not with multiple threads on normal operating systems.
Answers.UserDisplayName: Ian Ringrose
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-12-11T02:18:34.327Z
Answers.LastActivityDate: 2024-12-11T02:18:34.327Z
Answers.UserDisplayName: Fynmorph
Body: <p>Playing against the computer I’d like to be able to go back and try different moves to see how they effect the game, however each time I go back again and repeat my previous positions the computer moves differently.</p>
  <p>I’m looking for a ‘stupid’ computer that responds the same to a position each time. Then I can try different combinations to beat it in as few moves as possible.</p>
  <p>I play on web and iOS.</p>
  
Tags: <engines><learning>
Title: Is there a chess engine that always responds with the same move to a given position?
ThreadText: # Is there a chess engine that always responds with the same move to a given position?
  
  (Asked by: username_0 on 2024-06-22)
  
  Playing against the computer I’d like to be able to go back and try different moves to see how they effect the game, however each time I go back again and repeat my previous positions the computer moves differently.
  
  I’m looking for a ‘stupid’ computer that responds the same to a position each time. Then I can try different combinations to beat it in as few moves as possible.
  
  I play on web and iOS.
  
  **Tags:** engines, learning
  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_1 on 2024-06-22. Score: 3 | Accepted answer
  
  I dug around for a bit and it seems it's surprisingly less straightforward than I thought. I don't know about other engines, but much of the randomness of eg. Stockfish and Leela Chess Zero comes from the time control and multi threading. It's surprisingly hard to make multi-threading search code deterministic, and since computer timers aren't perfectly precise, time control can introduce randomness by changing number of nodes searched even if the search itself was deterministic if the search is only given a certain amount of wall clock time as opposed to number of nodes.
  
  It seems both Stockfish and lc0 running with a single thread and with a time control of a fixed number of nodes (instead of wall clock time) are deterministic. (For example, according to Wikipedia on lc0: Setting up the engine to play a single node with --minibatch-size=1 and go nodes 1 for each played move creates deterministic play, and Self-Play Elo on such settings will always yield the same result between 2 of the same networks on the same start position—always win, always loss, or always draw. See also [Randomness in engine play](https://chess.stackexchange.com/questions/19482/randomness-in-engine-play/19486)) It's possible to control the number of nodes searched, but this feature is rarely used and not available as an option on popular platforms/apps such as chess.com, Lichess or Smallfish for iOS when playing against the computer. I haven't found a good simple way to do this yet, and if there's no existing solution, the easiest way might be to set up your own local engine (can be web-based) and give it the correct parameters to make it deterministic. Lichess does have a few bots based on lc0 that claim to not use calculation (I guess this means only using one node so should take out the randomness), such as <https://lichess.org/@/LazyBotJr> but I'm not sure if it's how it works, and anyway it's not very strong and the strength can't be adjusted.
  
  Edit: I found another possible solution: it seems Fairy-Stockfish Playground (<https://fairyground.vercel.app/advanced.html>) has advanced options that allow setting the number of nodes to search. Yes, it's mainly for chess variants, but by default it plays normal chess if you don't choose a variant. You can try setting the number of nodes in Settings (in one of the input boxes marked "Nodes") and setting number of threads to 1 (input box marked "Thread") and enable engine for White or Black and play it.
  
  > **Comments:**
  > **username_0**: I’ll look into old emulators, maybe there are GBA chess engines that are single tread.  
  > **username_1**: @username_0 It seems Chessmaster on GBA is not deterministic because its search is limited by time/hardware rather than number of nodes according to https://gamefaqs.gamespot.com/gba/567124-chessmaster/faqs/38373 ("Personality ratings change ... based upon the  processor speed, current memory usage, and RAM available to the engine") It may be somewhat more predictable than multi-threaded engines but likely not truly deterministic. I tested fairy-stockfish playground and it works and gives the same result on different devices if I set it to the same number of nodes and 1 thread.  
  > **username_2**: In a drawn endgame, it might be the case multiple moves are equally good (they result in a draw) so the engine might pick one at random.  
  > **username_1**: @username_2 I don't know about others but Stockfish uses pseudorandomness based on number of nodes, so if you set number of nodes it is deterministic. see https://chess.stackexchange.com/questions/25278  
  
  ---
  
  ### Answer by username_3 on 2024-06-22. Score: 1
  
  A chess engine on PC is almost deterministic in its move results if...
  
  You play with 1 thread only;
  
  you switch off all parameters that guide move variety like Position Learning, Book Learning, Hashtables, MultiPV;
  
  keep the usage of Endgame Tablebases on;
  
  if possible switch off NNUE and MCTS to force the computer to use its own coded routines (not possible with every engine.)
  
  Despite of all that, some engines have a randomness in their code with which they process the possible moves, some make a ranking hitlist after the main calculated variation that is different each time, in this case you cannot get a secure repetition of a move in a specific time frame.
  You would also have in each case to make the computer move after a fixed time bypassing the variety of different response times - as said above, best is to set a precise nodes-per-move calculation.
  
  So far for my answer, but commenting on your "go back and try different moves to see how they effect the game", I don't think that doing all this is really necessary for that purpose.
  
  
  ---
  
  ### Answer by username_4 on 2024-06-24. Score: 0
  
  Most engines do in my experience. Its just that nowadays the devs fiddle the source code in a way that it's not the same repetitive straight track. In most GUIs, you should see the pgn. Try going back to that same move in that visible pgn and make another move. That should work. Hope this helps!
  
  
  ---
  
  ### Answer by username_5 on 2024-12-11. Score: -2
  
  By default engines are deterministic, usually them having variance is a feature.
  
  You just want to play against *any* computer? I enjoyed playing against this one: <https://krystman.itch.io/pico-checkmate>
  Have fun!
  
  > **Comments:**
  > **username_6**: Not with multiple threads on normal operating systems.  
  
  ---
  
  