15.04.2018 Views

programming-for-dummies

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Problem Solving 645<br />

Game-playing<br />

Because teaching a computer how to solve a variety of problems is hard,<br />

computer scientists decided to limit the scope of the problems a computer<br />

might face. By limiting the types of problems a computer might need to<br />

solve, computer scientists hoped to figure out the best ways to teach<br />

computers how to learn.<br />

Solving any problem involves reaching <strong>for</strong> a goal, so the first test of artificial<br />

intelligence revolved around teaching computers how to play games. Some<br />

games, such as tic-tac-toe, have a small set of possible solutions that can be<br />

identified in advance. Because there’s only a small number of possible solutions<br />

to the problem of playing tic-tac-toe, it’s easy to write algorithms that<br />

specifically tell the computer what to do in any given situation.<br />

The game of chess is an example of a hard problem because the possible<br />

number of valid moves is far greater than any human programmer can write<br />

into a program. Instead, human programmers have to give the computer<br />

guidelines <strong>for</strong> solving a problem. These guidelines are heuristics.<br />

A heuristic is nothing more than a general set of rules to follow when faced<br />

with similar problems. Telling a child to look both ways be<strong>for</strong>e crossing the<br />

street is an example of a heuristic. Telling a child to look left and then look<br />

right be<strong>for</strong>e crossing the corner of 5th Street and Broadway is an example of<br />

a specific direction, which is absolutely useless <strong>for</strong> solving any problem<br />

except that one.<br />

Book VII<br />

Chapter 4<br />

To teach a computer to play chess, programmers typically use a tree data<br />

structure (see Book III, Chapter 5) that the computer creates be<strong>for</strong>e making a<br />

move. The tree represents all possible moves, so the human programmer<br />

simply writes algorithms <strong>for</strong> telling the computer how to solve each problem<br />

by gathering in<strong>for</strong>mation about that problem. Because games have distinct<br />

rules, teaching a computer to play a game also taught computer scientists<br />

the best way to teach a computer to solve any type of problem.<br />

Artificial<br />

Intelligence<br />

Of course, the problem with this theory is that teaching a computer to play<br />

chess created a great computer that can only play chess. Game-playing<br />

taught computer scientists only how to make computers play better games<br />

but not be able to solve problems outside a fixed set of rules.<br />

Not surprisingly, the one area that has benefited from game-playing research<br />

has been using artificial intelligence techniques to create better computer<br />

opponents in video games. The next time you play your favorite video game<br />

and the computer seems particularly clever, you can thank all the research<br />

in AI <strong>for</strong> making smarter video games.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!