Games Computers Can Play
Learn how computers play games like chess and Go: searching ahead through moves, scoring positions, learning from practice, and why they still have limits.
Key takeaways
- A game-playing computer looks ahead at many possible moves
- It gives each position a score to decide which move is best
- Some game AIs get better by practising against themselves
- A computer is great at games with clear rules, but not at everything
Computers that play to win
Computers can play games, and some play extremely well. A computer has beaten the best human players in the world at chess and at an ancient game called Go.
How can a machine be so good? It is not magic, and the computer is not really thinking like you. Let's see what is really happening.
Looking ahead
Imagine you are playing chess. Before you move, you think: "If I move here, my opponent might move there, then I could do this." You are looking ahead.
A game computer does the same thing, but much, much faster. It looks ahead at huge numbers of possible moves:
- If I move my knight, what could happen next?
- And after that? And after that?
It builds a giant tree of "what if" moves. A fast computer can check millions of positions in the time it takes you to blink. This is called searching.
Scoring each position
Looking ahead is only useful if the computer knows which positions are good. So it gives every position a score.
A high score means "this is great for me", like winning a piece. A low score means "this is bad for me". The computer then picks the move that leads to the best score it can reach.
This is a bit like following a clear set of rules to make a decision, the same idea as Making Decisions with If in coding.
Learning by practising
The very strongest game AIs do something extra. They learn by practising.
A famous Go program got better by playing millions of games against itself. Each game, it noticed which moves led to wins and which led to losses. Slowly it discovered clever strategies that even human experts had never tried.
This is machine learning: getting better from lots of examples instead of being told every rule. You can read more in How Does AI Learn?.
Why games suit computers
Games like chess and Go are perfect for computers, and there is a reason:
- The rules are clear and never change.
- Each player can see the whole board.
- You can tell exactly who is winning.
When the rules are this neat, a computer can search and score with great power. That is why computers do so well here.
The honest limits
But a game computer is not as clever as it looks. Here are some honest limits:
- A chess computer can only play chess. It cannot drive a car, write a poem, or tie a shoe. It is built for one job.
- It does not enjoy the game or understand why the game is fun. It just calculates.
- In real life, the "rules" are messy and full of surprises. That is much harder for a computer than a tidy board game.
So when a computer wins at chess, it is amazing, but it is winning at one clear task by searching and scoring very fast. It is not generally smart like a person.
To meet more clever machines, visit Meet Artificial Intelligence. And to build a simple game of your own, start with Coding!
Quick quiz
Test yourself and earn XP
How does a chess computer pick a move?
It looks ahead at lots of possible moves and chooses the one with the best score.
What does the score of a position tell the computer?
A higher score means a better position, so the computer aims for high-scoring moves.
How did some game AIs get so strong?
They practised by playing against themselves again and again, learning from each game.
Why are games like chess good for computers?
Clear, fixed rules let a computer search and score moves exactly.
Can a chess computer also drive a car or cook?
A game AI is built for one game. It cannot do unrelated tasks.
FAQ
Not the way a person thinks. It searched through huge numbers of possible moves and scored them very fast, and it had practised millions of games. It was brilliant at the game, but it did not understand or enjoy it like a human player.
Chess has clear, fixed rules, so a computer can search and calculate exactly. Real life is messy and full of surprises with no fixed rules, which is much harder for a computer.
Keep exploring
More in AI