• Question: In what way can I use maths to work out strategic advantages and disadvantages in a board game like chess?

    • Keywords:
      • Find out more on the Maths Careers site:
      Asked by dharrington06 on 9 Nov 2020.
      • Photo: Chris Budd

        Chris Budd answered on 9 Nov 2020:

        The modern answer to this question is to use machine learning. What this does is to train a neural net to play chess by getting a computer to play itself a very very large number of times. You then ‘train’ a mathematical function to work out the best moves. This method is incredibly effective. Neural nets trained this way (starting only from the rules of chess) can beat all human players.

      • Photo: Daniel Bearup

        Daniel Bearup answered on 9 Nov 2020:

        The first step would typically be to assign values to each piece. It’s possible that you’ve encountered the values P = 1, N = 3, B = 3, R = 5, Q = 9 for example. These scores are a pretty good representation of the values of the pieces and connected to the mobility of those pieces.

        However, it is clear that these static values miss something. A pawn on the 7th rank (about to queen) is worth a lot more than a pawn on the second rank! So you need a way to evaluate how the positions of pieces on the board affect their value, or, more generally, a way to evaluate how good your position is relative to your opponents.

        There are natural measures you can consider to do such an evaluation (e.g. spaces controlled by your pieces, spaces attacked by your pieces, spaces where your pieces can be, differences in attack strength etc). in practice, this quickly becomes too complicated to do in your head so instead we rely on rules of thumb which are derived from computer analysis. e.g. the bishop pair is worth an extra pawn on an open board … .

        Now the computer analysis programmes all take slightly different approaches, but I believe they are typically less “mechanistic” that the measures described above. Instead, programmers define some functions that evaluate a chess position. Then they let those programmes analyse positions, and evaluate which ones “do best” (typically by tacking on some more functionality to let them play chess and see who wins). They would eliminate the programmes that do badly, and “mutate” the programmes that do well, searching for the “best programme”. (Machine learning and genetic algorithms are the search terms for the basic theory.)

      • Photo: Eduard Campillo-Funollet

        Eduard Campillo-Funollet answered on 9 Nov 2020:

        That’s a very interesting question!

        In practice, that is, during a game… math is not that useful. Top players rely on memory (openings and endings are usually played “by the book”), and on recognising common patterns in the play.
        Traditionally, computers use brute force (play all the possible combinations of moves) and again on memory specially for openings. One of the big advantages of computers is simply that they memorise longer opening sequences. Modern approaches are based on “learning” from millions of matches, famously the AlphaZero computer program. Experts were surprised by the performance of AlphaZero, but many people thinks that human intuition can beat it.

        Maths has a lot to say about more “theoretical” questions about chess. For instance, it is not known if a match between two perfect players will always end up on a draw. It is known that there exists an optimal strategy, but not what the strategy is! This is a beautiful thing about maths: one can prove that the strategy exist, without describing the strategy step by step!

      • Photo: Tom Ranner

        Tom Ranner answered on 9 Nov 2020:

        I think the best way that maths can help you in chess is to train your way of thinking. You can train a computer to be very good at chess using lots of clever maths but if you want to improve your own abilities you need to improve the way you think about chess.

        Very good chess players normally use their experience to remember how a game will play out when they know how the pieces are placed. Normally their memory will only allow them to remember or work out a few steps ahead of time. They will not always rely on just having seen one particular layout of pieces but they will also think of similar layouts which share common patterns or features. By improving your mathematical thinking it will help you improve your recognition of those different patterns to help you work out what to do in more situations.

      • Photo: Alan Walker

        Alan Walker answered on 9 Nov 2020:

        Playing a game of chess is much like trying to solve a mathematical problem. You often have well-practiced openings to both chess and to maths problems. However, what is important about both activities is that you’ll often need to have foresight on where your opening is going to lead you. There’s no point in a great opening, without a plan on how to progress. It is important that you are able to adapt to your opponent’s moves in the same way that you’ll have to adapt to unforeseen issues cropping up in your mathematical solutions. What helps with both? Practice.