1. Home
  2. Explore
  3. Computer Science
  4. Computers and Chess

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Computers and Chess

Speaker 1Speaker 2

Computers and Chess

11:37
0:00-11:37
  1. Anna

    Let’s begin with a famous chess story. Around 1963, philosopher Hubert Dreyfus published a paper headed “Computers Can’t Play Chess.” He was invited to play the Greenblatt chess machine at MIT’s artificial intelligence lab—and lost. Seymour Papert answered with a rebuttal titled “Dreyfus Can’t Play Chess Either.”

  2. Michael

    But there’s a more thoughtful version of Dreyfus’s point: computers couldn’t yet play chess the way humans play chess. Around 1968, chess master David Levy bet AI pioneer John McCarthy that no computer would beat the world champion within ten years. McCarthy eventually gave up the bet—not because a computer had won, but because it was clear a computer wouldn’t win by using the kind of human-like reasoning he had in mind.

  3. Anna

    Then, in 1997, Deep Blue beat the world champion, Garry Kasparov. That achievement raises a bigger question: was Deep Blue thinking like a person, or was it showing us another kind of intelligence? To answer that, let’s look at how a computer might choose a chess move.

  4. Michael

    The most human-like approach would be to describe the board in terms of ideas chess players use: pawn structure, king safety, whether it’s a good time to castle, and so on. The program would combine strategic analysis and tactical considerations to decide on a move. The difficulty is that we don’t know how to build a program that does that kind of reasoning. In that sense, Dreyfus’s criticism had a point.

  5. Anna

    A simpler possibility is to use if-then rules. The program looks at the board and follows instructions such as, “If the queen’s pawn can move forward one square, move it.” It doesn’t evaluate the position or look at what might happen next; it just picks a move that matches a rule.

  6. Michael

    That approach is limited for chess. It’s hard to see how rules of that sort could produce a strong chess player. But a reasonably good checkers program has used a related idea: identify available moves, rank them, and choose the highest-ranked one. So simple rules can be useful in some games, even if they don’t give us a general solution.

  7. Anna

    A third approach is to look ahead. Instead of choosing a move based only on the current board, the program explores the possible consequences of its moves and asks which resulting position looks best. To do that, it needs a way to evaluate a board position.

  8. Michael

    One common method is a static evaluation: score features of the board as it currently stands, without exploring what could happen afterward. Features might include king safety or pawn structure. A function combines those feature values into an overall score from the program’s perspective.

  9. Anna

    Often that function is a linear scoring formula. It multiplies each feature by a weight and adds the results together. But the program doesn’t necessarily need to produce precise scores; at minimum, it needs a way to decide which of several positions it prefers.

  10. Michael

    Now imagine searching the entire game tree—every possible move, every response, and every response after that—right down to the end of the game. That’s the brute-force approach. To see why it fails, we need two terms: the branching factor is the number of choices at each level, and depth is the number of levels searched.

  11. Anna

    If the branching factor is three and we search two levels, we get nine leaf positions to evaluate: three choices followed by three choices. In general, the number of leaves grows roughly as the branching factor raised to the depth, or b to the d. That growth becomes enormous very quickly.

  12. Michael

    In chess, the branching factor varies, but an average around 14 or 15 is often used. A game with about 50 moves by each player means roughly 100 plies, or individual moves, in the tree. Claude Shannon’s estimate for the number of leaf positions is around 10 to the 120th. Evaluating every one is out of reach.

  13. Anna

    Here’s a way to feel the scale. The universe has about 10 to the 80th atoms. If every atom performed a static evaluation every nanosecond throughout the roughly 10 billion years of the universe’s history, the total would still be about 14 orders of magnitude short of 10 to the 120th. Even a fantastically large cloud of computers wouldn’t solve the whole tree that way.

  14. Michael

    So the practical strategy is to search as far ahead as we can, evaluate the leaf positions we reach, and use those evaluations to choose a move. The central method for doing that is minimax, an idea associated with both Claude Shannon and Alan Turing.

  15. Anna

    In minimax, the player whose perspective determines the scores is the maximizing player: they want the largest score. The opponent is the minimizing player, who wants the smallest score. Since each player assumes the other will make the best move for themselves, the program works backward through the tree, alternating between taking a minimum and taking a maximum.

  16. Michael

    Take a tiny example. Suppose the maximizing player has two choices, and each leads to a choice for the minimizing player. The left branch ends in scores 2 and 7, so the opponent would choose 2. The right branch ends in 1 and 8, so the opponent would choose 1. The maximizing player then compares 2 with 1 and chooses the left branch.

  17. Anna

    That’s why the method is called minimax: first account for the opponent minimizing the outcome, then choose the option that maximizes the result left to you. The final outcome may not be the biggest score—or the smallest one. In an adversarial game, each side is trying to limit what the other can achieve.

  18. Michael

    The catch is that minimax still has to evaluate a huge number of positions. With a branching factor of 14, even searching just 10 levels means a staggering number of leaves. And if the search reaches only shallow positions, the static evaluations may be crude; deeper searches can make the estimates more meaningful.

  19. Anna

    That’s where alpha-beta pruning comes in. It doesn’t replace minimax or change the answer minimax would give. It helps the program avoid examining parts of the tree that can’t affect the decision—like refusing to keep beating a dead horse.

  20. Michael

    Suppose the minimizer already has a choice that guarantees a score of 2 or less. If another option on that same branch produces 7, the minimizer will choose 2 instead. Once we know that, we can pass the value 2 upward. If the maximizer has another branch that guarantees at least 2, exploring a position that can only give the maximizer 1 or less cannot change the choice.

  21. Anna

    Exactly. The maximizer already has a better option, so the rest of that branch is irrelevant. We can skip its remaining static evaluations—and, in some cases, we don’t even need to generate the moves below it. Alpha-beta keeps track of limits, called alpha and beta, that help identify these cutoffs.

  22. Michael

    Some cutoffs are less local than that. You might compare a value several levels down with a useful value much higher in the tree and realize the entire branch cannot improve the result. That’s often called a deep cutoff. The reasoning is still the same: if a player would never choose that branch, there’s no reason to spend time exploring it.

  23. Anna

    In a small tree, the savings may look modest, but in a large tree they matter enormously. With ideal move ordering, alpha-beta can reduce the work from roughly b to the d to about 2 times b to the d over 2. Ignoring the factor of 2, that’s like searching twice as deeply for a similar amount of work.

  24. Michael

    For example, if plain minimax can search seven levels, alpha-beta could—in that ideal case—reach about 14. The ideal depends on examining moves in a helpful order, but the method is valuable in practice too. It preserves minimax’s answer while saving computation; it’s a speed-up, not an approximation.

  25. Anna

    There’s another practical problem: the branching factor changes with the position, so a program can’t know exactly how deep it will get before its time runs out. Early game-playing programs could stop after only a few seconds, wasting time they had available, or keep searching until the clock expired and fail to have a move ready.

  26. Michael

    The solution is progressive deepening. Search the tree to depth one, then depth two, then depth three, and so on. After each completed search, the program has a move available. If its time runs out, it can return the best move from the deepest search it finished.

  27. Anna

    Why not just start at the maximum depth and hope to finish? Because completing a shallower search is a useful insurance policy. If the branching factor is 10, searching to one level less takes about one tenth as much work as the final level. And if the deeper search doesn’t finish, the program still has a completed result to use.

  28. Michael

    You can extend that insurance policy to every depth: finish one level, then the next, and keep a result ready at each step. The total extra work is small compared with the deepest search because the number of positions falls sharply at shallower levels. That makes progressive deepening a natural anytime algorithm: it can provide an answer whenever it’s interrupted.

  29. Anna

    It also helps alpha-beta. Results from earlier, shallower searches can help order the moves in a later search. If promising moves are examined first, alpha-beta is more likely to find cutoffs early and avoid exploring unnecessary branches.

  30. Michael

    So the basic recipe for game-playing programs is minimax, with alpha-beta layered on top, plus progressive deepening. Deep Blue used those ideas, but it added much more than raw speed.

  31. Anna

    In 1997, Deep Blue could perform about 200 million static evaluations per second and search roughly 14 to 16 levels using alpha-beta. It also used substantial parallel computing, an opening book, and special-purpose methods for the endgame.

  32. Michael

    One particularly important addition was uneven tree development. A search doesn’t have to stop at the same depth along every line. If a position is especially dynamic—for example, a queen might be captured on the next move—the program can search further there. It can allocate effort where deeper analysis gives it more confidence in the result.

  33. Anna

    That brings us back to intelligence. Games do model some situations people face: we anticipate an opponent’s response and plan several steps ahead. But Deep Blue’s method isn’t necessarily how a person plays chess. It can search far deeper than a human chess master could reasonably calculate.

  34. Michael

    Human chess masters rely heavily on knowledge and pattern recognition. In famous experiments, masters could memorize a chessboard very well when the pieces formed a legitimate game position. When the pieces were placed randomly, they were much worse. Their skill depends on recognizing meaningful chess patterns, not simply memorizing any arrangement.

  35. Anna

    Deep Blue’s strength was different: enormous computational power applied to search and evaluation. One way to picture it is as a bulldozer moving gravel—raw power doing a job without the same kind of sophistication a person brings. It demonstrates a kind of intelligence, but not necessarily the kind operating in a human chess master’s head.

  36. Michael

    And that distinction is the key lesson. Computer game-playing can help us study intelligence, even when it doesn’t imitate human thought. Deep Blue combined minimax, alpha-beta pruning, progressive deepening, and specialized techniques to win—but its victory didn’t show that it played chess the way humans do.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent