Nicely, to begin with, going “again” is commonly not an possibility. Just about each opening entails pawn strikes, and you may’t take these again. You can also’t undo captures. So clearly you may should do some work simply to get right into a scenario the place the pc can take its transfer again, not to mention will.
The pc usually has a attributes that it is working in direction of, and it’ll make strikes “ahead” with respect to these targets, and taking a transfer again can be going backwards.
In the course of the opening, one of many main targets is growth, which usually entails transferring items in direction of the middle. The pc goes to want a very good cause to maneuver its items away from the middle, and “I simply moved my items again” hardly qualifies.
In the long run sport, the pc shall be working in direction of transferring its pawns ahead, and transferring your king away from the middle. The primary of those cannot be undone, and the second can, however the laptop has no cause to.
Even I might write a program which does not fall in such a lure. Simply examine the present transfer with the previous one: in the event that they’re the identical, enhance a counter, in any other case set it to 0.
Such a check can be of restricted worth. Suppose the pc assigns a rating to every place equal to the likelihood it thinks it would win in that place, minus the likelihood it thinks it would lose. Presumably the pc will select the transfer with the best rating. If the pc is selecting the identical transfer time and again, that signifies that it thinks that every one different strikes have a decrease rating. Since transferring time and again is drawing, meaning its rating is at most zero. So it thinks that each different transfer has a adverse rating, i.e. it thinks each different transfer will possible lead to a loss. So why ought to it keep away from the draw, when the choice is a loss?
Now, this does assume that the pc is weighting a draw the identical as a win plus a loss, i.e. it values “50% likelihood of a win and 50% likelihood of a loss” the identical as “100% likelihood of draw”, and this might certainly not be the case, and it will be quite sophisticated to get into when it will make sense to not weight them equally, however to first approximation, we will make this assumption.