Chess algorithm ideas: The notion of balance

A chess algorithm is trying to determine the best move in a given position by thinking based on rules. Programmers are constantly in search for ideas that could help improve this process.

One idea that is important and often overlooked is that of “balance”.

The score of positions in a chess game between two equal players usually is around an equilibrium for most of the game. No big changes in the score are expected, unless one of the players makes a serious mistake. In general a game is at a balance until a mistake is made.

Since this is the normal expected situation, we could exploit this knowledge to make the chess algorithm a bit more selective in its thinking process. Any deviation of the position’s score from the abovementioned balance should trigger special components of the algorithm that help the computer investigate further (or less – see below) the situation.

Important Note: When we refer to a deviation from the balance this does not necessarily mean deviation from score 0 (zero), where black and white are equal. The game could be in a position where one colour has the advantage and for many moves the score is kept stable – this is also an local equilibrium. For example in the below figure showing the score progress in a chess game, it seems that during the middle game phase black had the advantage and a balance was found, until black made a mistake and a large score deviation was detected (allowing white to start winning).

How?

For example…

  • When a move results in a drastic increase of the score in favor of the computer (what ‘drastic’ means is left to be defined by the programmer, usually in terms of changes in the position score, e.g. > 2) then the algorithm should continue thinking at a greater depth to verify if the move investigates is indeed so good.
  • When the move investigated results in a drastic decrease of the score for the computer, then the algorithm should stop investigating further the variant.

Note that the above scenarios and simplified and more detailed analysis is needed for the programmer to determine the actual actions needed when a large deviation from the score balance is observed.

Additional factors could affect how such a score deviation is handled. For example, if the variant analyzed involves exchanges of material, a drastic change in the position’s score is expected with every move and in this case perhaps the changes in the score are not so important to take into account.

Experimentation with the idea is needed to find the best way to embed this idea into your code.

Keep coding!

And have fun!

Leave a comment