As a computer does not possess any intelligence of it's own, how it plays games like chess?
This should be of interest to you:
here is a really cool applet which visually shows you how a computer decides it's next move. just drag your piece somewhere legal, and watch the computer do it's magic.
A short answer is, the computer tries to search all possible paths of play for several moves into the future. As a "brute force" approach, this would take too long, so the programmer tries to add heuristics to the chess program so that it can guess which paths to eliminate without projecting every possible path many steps into the future.
Separate names with a comma.