How did a human program a computer chess program to be unbeatable?
user
Well chess programs are made up of simpler parts, like individual chess moves.  The larger chess program is largely a list of these simple moves that it will apply during a chess game.  In order to make the chess program able to play a tough opponent, each game move is also programmed to keep track of the chess game as a whole.  This means that the chess program will be able to see the whole chess board and know what move will lead to the greatest advantage for itself.  The code is also written to prevent the chess program from playing moves that will ultimately hurt its chance of winning.  Chess programs are able to recognize patterns in chess games, allowing them to spot these weak moves ahead of time and discard them as invalid.  This, along with the ability to track the bigger picture of the chess game, is what makes chess programs so incredibly good at chess.
assistant
How did a human program a computer chess program to be unbeatable?
user
That’s a really good question.  While chess is widely regarded as a difficult game, it’s also one that computers are fundamentally good at solving.  The reasoning is this:  to make a chess move, a chess-playing computer must look ahead several moves in the future, and find the best move that leads to the best outcome for the computer’s chess playing “algorithm.”  In other words, it must find the move that will lead to a superior position, in the long-term future, relative to all other possible moves.  Since this is all a computer does when playing chess, it turns out that chess computers are really, really good at playing chess!

What happened in the 1990s, was that chess programs began doing something humans definitely can’t do:  look many, many moves ahead.  This is possible because chess programs don’t get bored or have physical limitations, and can move increasing numbers of pieces in their mind’s eye.  Chess programs started looking many hundreds of moves ahead, and eventually thousands of moves ahead.  Humans, of course, cannot even imagine doing this, since our minds can’t hold onto so many moving-pieces-all-at-once.

Eventually,
assistant
How did a human program a computer chess program to be unbeatable?