🎮 AI and Games

5th Grade 🤖 Artificial Intelligence

Games are one of AI researchers’ favorite places to work: they have clear rules, a clear goal and a simple way to know who won. From tic-tac-toe to chess and Go, games have helped scientists test new ideas — and discover what computers still can’t do.

Free · US Letter · no sign-up
Google Classroom Save to Pinterest Email me

Why scientists love games

To check whether a program is “smart,” you need a task you can measure. A game is perfect for that: the rules are known, the board is defined, and at the end it’s clear who won. You can run thousands of games without putting anyone at risk, and compare one program with another or with a human player.

But a game is a small, tidy world, and the real world is much messier. A program that beats world champions at chess can’t cross a street or make a salad. Every game program is usually good only at its own game.

Tic-tac-toe: checking every possibility

Tic-tac-toe has a fairly small number of possible positions, so a computer can check all of them. Before every move it asks: if I go here, what can my opponent do? And if they do that, what will I do? And so on, all the way to the end of the game. That way it always finds the best move.

It turns out that when both players play without mistakes, tic-tac-toe always ends in a tie. So you can’t beat a computer that plays tic-tac-toe perfectly — the best you can get is a tie. That’s not because the computer is “smart,” but because the game is small enough to check everything.

Chess and Go: too many possibilities

In chess the number of possible games is enormous, and no computer can check them all. So chess programs look only a few moves ahead and estimate how good the position on the board is — for example, by which pieces are left and where they are. In 1997 IBM’s computer Deep Blue beat world champion Garry Kasparov in a match, mostly thanks to its ability to check an enormous number of moves every second.

In Go, an ancient board game from East Asia, there are even more possibilities — more possible board positions than there are atoms in the observable universe. There, checking moves wasn’t enough. In 2016 the program AlphaGo beat Lee Sedol, one of the best Go players in the world. It used neural networks that learned from games played by people, and then played a huge number of games against itself to get better.

Learning by trial and error

The method where a program plays again and again, gets a “reward” when it succeeds and a “penalty” when it fails, and changes its behavior to match, is called “reinforcement learning.” It’s a bit like training a dog with treats, or a kid learning to ride a bike after lots of falls.

In reinforcement learning, a program sometimes finds surprising ways to score points — even ways the programmers never intended. For example, in a racing game it might discover it can rack up points by driving in circles instead of finishing the track. That teaches an important lesson: a program tries to reach exactly the goal we gave it, not what we meant in our hearts.

Characters in video games

The video games you play have “AI” too — the characters the computer controls, like enemies, teammates or people walking around a town. Very often these are fairly simple rules the game designers wrote: if the player is close — chase them; if they’re far away — go back to patrolling. The goal here isn’t to beat you no matter what, but to make the game fun and just challenging enough.

And a little safety tip: online games sometimes have a chat with other players. Don’t share personal details there, don’t move to a private chat with strangers, and if someone acts strangely or asks you for something — tell an adult.

Key facts

  • In tic-tac-toe played perfectly by both sides, the game always ends in a tie.
  • In 1997 Deep Blue beat world chess champion Garry Kasparov.
  • In 2016 AlphaGo beat Lee Sedol at the game of Go.
  • Reinforcement learning is learning by trial and error with “rewards” and “penalties.”
  • A program that excels at one game usually can’t do other things.

Quick quiz

  1. Why do AI researchers like to test ideas with games?

  2. How does tic-tac-toe end when both players play without mistakes?

  3. Who beat Garry Kasparov at chess in 1997?

  4. Why doesn’t a chess program check every possible game?

  5. How did AlphaGo get better at Go?

  6. What is reinforcement learning?

  7. What’s the lesson from the program that scored points driving in circles instead of finishing the race?

  8. What should you do if a stranger in a game chat asks for personal details?

💭 Think and talk about it

  1. Play tic-tac-toe with a friend and try to play without mistakes. How many times did it end in a tie?
  2. If you were designing an enemy in a video game, what rules would you give it so it’s challenging but not impossible?
  3. Why do you think a program that wins at chess can’t also win at soccer?

Questions kids ask

Can you beat a computer at chess?

Strong chess programs today beat even the best players in the world. But you can play against programs set to easier levels, and that’s a great way to practice.

Do the characters in video games think?

No. In most games they follow rules the game designers wrote so the game will be fun. Even when machine learning is used, they don’t have thoughts or feelings.

What’s the difference between Deep Blue and AlphaGo?

Deep Blue relied mostly on quickly checking huge numbers of moves. AlphaGo also used neural networks that learned from many games, because in Go you can’t check enough possibilities.

🔎 Ask Thinkapedia another question