A lot of these other answers are missing a key point. These engines determine the “best move” by searching the game tree for a certain amount of time. However, a tiny difference in the amount of time spent (due to random fluctuations in the calculation time) can result in a different best move, especially when 2 moves are equally good. Also, many engines are multithreaded, which adds more randomness as certain threads finish before others. If you had a match with 2 single-threaded engines that searched to a set depth (meaning they search the same amount regardless of time), then the game *would* be deterministic and always have the same outcome.
Chess isnt a solved game. The amount of possible games is so large that even with a computer we cannot come close to evaluating every possible game so we cant know what the best move is. Chess engines, like humans, try to make the best move based on limited information and their moves are way way better than any moves made by humans, but they are still not neccesarily the best possible move.
There can be intentional randomization, and unintentional randomization.
A program that has to do a lot of anything will generally try to calculate multiple things at the same time – for example, evaluating the outcome of many possible moves. When things happen in parallel in computers, one may finish before the other (for example, because the operating system “borrowed” the CPU core doing one of the calculations for briefly doing something else).
A program could account for it, but it’s often not important, and spending time/resources on accounting for it would be a bad tradeoff.
As a result, moves may end up on the candidate list in a different order, and since the chess engine typically only has limited time, this means it’ll evaluate slightly different moves.
(This is pretty common, and many programs will output slightly different things randomly due to such variations. A program or algorithm that will always produce the same result is called *deterministic*, one that doesn’t is called *non-deterministic*. Sometimes this matters, but often it doesn’t, so non-deterministic is good enough.)
There are moments when several moves may have the same evaluated value. So the chess engine chooses one of them, having judged them as equal. This may happen a lot and with either engine, so it is possible to play the same game over and over again, but the engines are programmed no to be predictable either.
ie; if a certain setup always caused a chess engine to make a specific move, it would make it predictable and more easily defeated, so some randomness is added when more than one move is equal in value.
Because chess engines weight every move differently based on it’s own rules and depending on the code and constraints, time limits and memory/computer resources available, they usually calculate future moves x steps in advance.
I have watched recently a video by Sebastian Lague, where he ran a chess programming tournament and while most of the stuff about coding it’s out of the scope of an eli5 he goes through many of the entries where he explains the criteria and weighting and how the code chooses future moves.
There are (broadly) two types of chess engines.
One have a set of “questions” or “rules”, a script if you want, and it follows step by step until it finds a good move. The simplest example would be an engine that chooses the first legal move it finds, checking every piece left-right, bottom-top. These engines will always return the same move given the same circumstances.
The other type looks for several moves that look “good”, put them in a bag, and then choose between them depending on which one “feels” better. These engines are the ones that may produce different moves given the same circumstances.
But regardless of the type of engine there is a limit on the information they can recall at any given time so they can look only so many moves ahead, so they are likely to find a “good” move that is not necesarily “the best” move. It is the same case with chess Grand Masters.
They’re far too many possible outcomes to predict how the end result will be or even what the second or third move might be. There’s too many potential moves to make depending on who you think you’re playing and what your personal strategy is. Machines, computers are no different. Sure, you could give each one a different strategy or you could have the same general library of moves and strategies available, but the outcome of every single choice are going to be dependent on the choice the other makes. And that is not set in stone. The number of potential moves every single time is not infinite, yet, to the perspective of a human being it might very well be. And every single move determines the next move based on your own priority and what you believe the opponents will be., or even more options available then the average human who might have learned a few or simply will play reactive game. Since the dawn of the game of chess, we have not seen every single move that could be made in every order that it could be done, and nowhere near every single potential game has been played. In fact humans could probably play for the rest of their existence and still not play every potential game. They’re simply that many potential moves and games that could happen. I’m not sure what the question was anymore however, I’ll end it there.
Latest Answers