Intelligent mistakes

8/21/2005 – A few owners of chessplaying software have sometimes wished that their chess engines would make more "intelligent mistakes" when set to a handicap level. Columnist Steve Lopez dissects this apparent oxymoron and delves into the nature of errors in chess in his latest ChessBase Workshop.

ChessBase 14 Download ChessBase 14 Download

Everyone uses ChessBase, from the World Champion to the amateur next door. Start your personal success story with ChessBase 14 and enjoy your chess even more!

Along with the ChessBase 14 program you can access the Live Database of 8 million games, and receive three months of free ChesssBase Account Premium membership and all of our online apps! Have a look today!


For this week's ChessBase Workshop I'd originally intended to preview the new disks by Garry Kasparov and Alexander Bangiev; I promise that we'll get back to them shortly. But I've recently (as I write this; it'll be a month old or more by the time this column hits the Web) been involved in an interesting message board discussion regarding chessplaying programs, a discussion has prompted me to do a lot of thinking about the electronic aspect of this royal game of ours. This will be kind of a strange column, partly just woolgathering by yours truly and partly explanation/exposition -- so expect a few weird twists and turns, as well as some fairly serious theoretical stuff. I'll try to keep your attention, though, and hopefully this thing will be relatively clear by the time we reach the end.

The message board discussion was started by an Expert level player and Fritz user who seemed a bit disconcerted by the mistakes the program makes while playing in levels such as "Friend" mode. It was a difficult conversation because the poster seemed to "waffle" a bit in his comments. He seemed to be upset when he lost a game because the program was too strong, yet seemed equally upset when he won against Fritz because the program "made mistakes". The latter point was interesting to me because it operated on a couple of levels -- the problem wasn't just the fact that the chess engine erred, but also that it seemed to err too badly, that is, it made mistakes that a titled player wouldn't make.

Hmmmm...let's look at that again: "it makes mistakes that a titled player wouldn't make." What kind of mistakes does a titled player make? While there are certainly exceptions (like the famous miniature between Larry Christiansen and Anatoly Karpov), most often a titled player will make subtle positional mistakes, little things that allow the opponent to "accumulate small advantages" (as Steinitz preached over a century ago). Keep that thought in mind -- we'll be returning to it.

First we need to sidestep to look at what a personal computer really is. Although I can do a ton of neat stuff with my computer, like play chess, balance personal finances, simulate a historical battle, build an empire, look at pictures, shoot the bad guys, and crank out a weekly chess column of dubious merit, what's really going on in the "guts" of the machine is that it's juggling numbers. And it's really only juggling two numbers: ones and zeros. When you strip away the upper levels of programming languages and look at the core of any digital computer program, it's just bouncing ones and zeros around. Everything is either "one" or "zero", "yes" or "no", "true" or "false", "on" or "off" -- there are no "shades of grey" involved.

Consequently computer programs are, at their heart, a series of "yes" and "no" decisions. Does such-and-such a condition apply? If so, do this. If not, do that. There are no "maybes" in this binary realm, no "fuzzy logic" -- either a condition applies or it doesn't. It's cold and hard as a brick. There's no such thing as "intuition" here, no vague factors that lead to sudden epiphanies.

And that's why I submit to you that computers don't "play" chess. A computer isn't playing chess any more than it's commanding a Civil War army, racing a car, or swinging a lightsaber. It's simulating a person playing chess -- and it's doing it by crunching ones and zeros, not by using intuition or imagination.

That's exactly the reason why it's so hard to get a computer to play "human-like" chess (even beyond the fact that "human" in this case covers a lot of territory, from beginners to world champions). Humans don't crunch numbers the way a computer does. We don't play chess by looking at thousands of board positions, assigning each a numerical value, and then "minimaxing" our way to a decision on the best course of action. We use a lot of intuition when we play. Even strong players do it -- Kasparov, when asked why he played a particular move, has sometimes said that it "smelled right". He can't tell you in concrete terms why the move looked good, why it intuitively appealed to him. It looked right, so he played it. World champions do it, you do it, I do it.

Computers don't do that. They play a move because they view it as the best one in cold, concrete, mathematical terms. And sometimes, because of a flaw in their programming, they're wrong.

Programming a computer to play good chess is tough. It took literally decades to get from Alan Turing's primitive chess "program" (really just a set of simple questions that provided a one-move "lookahead" to determine a move) to Deep Blue's match win over Kasparov in 1997. A lot of progress has been made just in the handful of years I've been in this business. Back when I first got involved with this madness (in 1992), if your program beat a grandmaster at the annual Harvard Cup it earned you a year's worth of bragging rights in your print advertisements. These days it's pretty "ho-hum" when a software program beats a top-level chessplayer. It's become old hat; we're used to it.

The problem is that the "little guy", the average club player, got lost in the shuffle. As far back as the late 1980's you could buy a dedicated tabletop chess computer for $200 that could routinely beat 95+% of the world's chessplayers. So the emphasis has shifted a bit -- now programmers need to write chessplaying software that can tear the head off of a top player while still possessing the ability to be "dumbed down" enough to give a beginner or club player a competitive game. And the programmers discovered something interesting: it's actually harder to write a "bad" chess program than it is to write a good one.

Now I'm not talking "lobotomy" bad here, nothing like playing 1.e4 e5 2.Qh5 in the hope of exploiting the inherent weakness of f7 after something like Bc4. I mean "convincingly" bad -- the little mistakes that allow the human player to accumulate those Steinitzian small advantages which we were talking about a few paragraphs back. It's hard to write a program like that for a couple of reasons. While some of these mistakes may be mathematically quantifiable, they might not matter within the search horizon of a software program. For example, a backward pawn in the early middlegame is definitely bad but it might not be exploitable until the late middlegame or endgame twenty or twenty-five moves later. A computer just can't see this far ahead. So how would you, the programmer, handle this? Remember that we have to work with ones and zeros here. You either write the program to tell it that a backward pawn is bad (in which case the program will avoid such a structure like the dickens) or else ignore that positional motif (in which case the program will leave backward pawns all over the board).

It's a classic Catch-22. If you ignore the positional factor of a backward pawn, you wind up with a weak chess program and receive complaints that the error isn't one that a competent human player would make. If you include that motif, you wind up with a program that doesn't make that kind of "subtle" mistake -- and you displease players who want an engine which makes "human-like" errors.

As I said above, and someone else commented in the Internet message board thread that inspired this column, "It's harder to write a bad chess program than it is to write a good one".

So how do programmers set about the task of giving you a "handicap" game? The easiest way to do it -- and one which many programmers have adopted -- is to give you a modified form of an "odds" game. Back in the 1800's, when a strong master was playing against a much weaker opponent, he'd give him "odds": he'd start a game with some of his own material removed from the board in order to even the odds (and that's why these games are called "odds" games). There was nothing disrespectful about it: the weaker player was acknowledging the reputation and ability of the master, while the stronger player was being chivalrous and offering the weaker player the chance at a good competitive game instead of a slaughter.

These days, though, we live in a more "egalitarian" world in which many people don't like to admit that someone else is better at anything. That's why odds games are a thing of the past. It's also why I won't teach adults how to play chess anymore. If you offer them odds, they feel insulted. If you don't give them odds and you beat them, they feel humiliated or that advantage has been taken of them. So they expect unlimited takebacks (and we'll talk more about this in a moment) and, after they beat you (for reasons which we'll elaborate upon in a moment), they crow loudly about how they "beat the chess guy". It's another Catch-22. That's why kids are so cool: you offer them odds and they accept, because they're smart enough to know that they don't know, and that you want to give them a chance.

I'll bet not one (adult) chessplayer in a hundred would sit down to play a game against a computer program giving them odds (that is, with some of the program's material missing at the game's start). So the programmers disguise the "odds": depending on what level is set by the player, the program will deliberately hang x amount of material (either outright or, in the case of Fritz' Sparring mode, through setting up and allowing a material-winning combination to the player) and, once the material is off the board, will play like a house afire thereafter.

This works really well for the average player. But what do you do for a titled player who complains that the program at full strength is "too strong" but wants the program to make "intelligent mistakes" (an oxymoron if ever there was one, but it's an expression I've heard used by many chess software users down through the years)?

That's a really tough task. Programmers have become better at it, though. Fritz' Sparring mode took several years of development. It was the early 1990's when I first heard it was in the works, but it didn't see the light of day until Fritz5's introduction in 1997. Even strong players can make use of Sparring mode -- just set the difficulty level at its highest and Fritz will start looking for multi-move combinations for you to play against it instead of allowing just one-movers.

But even that sometimes doesn't satisfy folks. They still want "intelligent mistakes" of an extremely subtle nature. And, in the ultimate Catch-22, I can still remember the days of the early versions of Fritz when titled players would complain when the program made those kind of mistakes ("anti-positional pawn pushes" was a favorite complaint of these folks when talking about Fritz2). Of course, those mistakes were programming problems that were corrected in later versions. But how does a programmer backtrack to cause his chessplaying creation to make such errors on purpose?

I've been giving this a lot of thought lately, maybe too much. And I've come to a conclusion, possibly an erroneous one, but the comments I've heard from players seems to bear it out. It's really not the "quality" of the errors that's the real issue here -- it's the fact that the players in question want to win a game without feeling like the victory was handed to them.

Hoo-boy. Now we're getting into psychology and another slippery slope. If a player beats a chess program at full strength, he feels like he's accomplished something, that he's beaten the unbeatable. But if he starts a game with a program set to some sort of handicap level, he knows going in that his opponent "won't be playing his best", and I suspect that this knowledge will make a victory feel tainted no matter what to some players.

But I think an important point is being missed here. The purpose of a handicap level is to give the human player a chance to win the game and, should he lose, not make the game a complete rout. The idea isn't to simulate the play of the guys down at the local chess club with 100% pinpoint precision -- it's to give the human player the overall feeling of playing a more evenly-matched game, even if the specifics (i.e. the program's playing style and "quality" of its errors) aren't honed to a razor's edge of accuracy. With that parameter in mind I think that most chessplaying engines (including those produced and sold by our competitors) do a really good job of providing it.

There's also another ingredient we need to dissect here -- the subject of "mistakes" themselves. And this is the portion of the article which will likely generate some hate mail, because I suspect that I'm about to "ruin" chess for a reader or three.

We were talking about takebacks a while ago (when I mentioned why I won't teach chess to adults anymore). Anybody can win a chess game, regardless of the level of their opposition, if they're allowed unlimited takebacks. If I play Fritz at its full strength I'll beat it every single game if I allow myself to take back every error I make. If you play Garry Kasparov and he lets you take back any (or every) move at your whim, you'll beat him.

Many years ago I was playing an offhand game at a local chess club. We had an elderly guy (and I'm being charitable here -- the guy was a couple of weeks older than Methuselah) who consistently adopted a faux "superior" attitude, always harshly critical of other people's games, never losing a game himself except by the cruel hand of fate ("I'm feeling very poorly tonight", "You distracted me", "The light was in my eyes", etc.), and who was always hanging over your shoulder like a buzzard, kibbitzing like a madman, whenever he wasn't playing a game of his own. I was playing a game, with this old guy perched like some deranged Mephistopheles on my shoulder, when my opponent blundered. I took advantage of the error and went on to win the game, after which this old kibbitzer just sniffed and said archly, "Well, you won, but your opponent did help you."

I just looked at him for a long moment, then said, "Well DUH..." I'd finally figured the old codger out. In his world he loses by misfortune: a sudden earth tremor makes him grab the wrong piece or he suddenly contracts bubonic plague at move nine or he has a bad horoscope that morning. But when he wins (in his world anyway), he does it by being brilliant.

Look, earth tremors happen and brilliancies do exist. But the bare naked truth is this: nobody wins a chess game unless his opponent makes a mistake. You're not playing chess in a vacuum -- you have an opponent and he's certainly contributing to the game's outcome. He doesn't have to blunder badly by hanging a piece or walking into mate in three. It might just be a small positional error, a hole in his position that you're able to exploit, but it's a mistake nonetheless.

And that "revelation", I suspect, is going to "wreck" chess for a few readers.

However there's a fair bit of light in this considerably dark tunnel. You know what separates a strong chessplayer from a weak one? The flippant answer, "Better moves", is actually the right one. But why are better moves "better"? Because they minimize a player's own errors while maximizing those of the opponent (there's that old computer chess term "minimax" again, albeit in an altered context). We go through a series of general stages in our chess development (and this connects directly to a previous column I wrote many years ago on Fritz' "Show threat" feature):

  1. Playing without regard to our opponent's moves;
  2. Spotting mistakes by our opponent, but not knowing how to exploit them;
  3. Spotting our opponent's mistakes and knowing how to take advantage of them;
  4. Exercising the ability to induce our opponent to make mistakes.

And the huge jump between 3 and 4 in the above list is exactly what separates a good player from a great one. A good player waits for his opponent to err and then punishes the error. A great player makes moves which cause his opponent to err.

This connects directly to the subject at hand: mistakes made by chessplaying programs. A good player (and even not so good ones) will rely on the software's handicapping functions to provide the mistakes. A great player will, by the moves he makes, cause a program to make mistakes on its own, even when the program is playing at full strength. Either way, a mistake's a mistake, and it's still up to the human player to spot the error and find a way to exploit it.

I'll admit that when a computer plays "giveaway chess" it's not the most satisfying way to win a game. Here's an example of what I'm talking about. It's one of my own games; I'm playing the White pieces:

1. e4 e6 2. d4 d5 3. e5 c5 4. Qg4 cxd4 5. Nf3 Nc6 6. Bd3 Nge7 7. O-O Ng6 8. Re1Qc7 9. Qh5 Nf4 10. Bxf4 Bb4 11. Re2 O-O 12. Qxh7#

Now I'll be the first one to tell you: that's a pretty unsatisfying way to win a game against a computer. I was having a good time, playing my favorite Nimzovitch line in the French Advance, when Black suddenly hung his Knight, then castled into mate a couple of moves later. But, hey, I still had to spot that the Knight was hanging and that the Queen move was mate, so I guess I did work for and earn that win a little bit. After all, I could still have made mistakes that would have evened up the material (it's been known to happen -- I once went into a tournament endgame a full Rook up and still managed to lose) or missed the mate in one (I did that once, too, early in my tournament career). But, though it was a win, it wasn't a brilliancy on my part -- it's not the kind of thing you drink a self-congratulatory beer over later.

Still in all, though, that's a prime example of the kinds of "unintelligent mistakes" you hate to see a computer program make, the kind of "non-human" chess that software users love to complain about.

But here's the kicker: my opponent wasn't a computer. The game's from a 1998 USCF correspondence tournament and my opponent was a Class C postal player.

About a year later I was playing a game against a chess computer set to a handicap mode. It hung a pawn right out of the opening (which I snatched), but then it started playing like its silicon life depended on the outcome. I won that game, too, but I had to work pretty danged hard to pull off the victory. I'm still pretty proud of that game; it was just like playing a master who'd given me pawn odds and then -- saaayyyyyy, wait a minute...

Nobody wins without his opponent's unwilling cooperation. But you still have to exploit his/its error, make none (or at least few) of your own, and use your skills to make the victory happen. The game's not over until the fat lady's a-singin' and, if you have an edge (materially or positionally), it's up to you to utilize your skills to make sure her song's a hymn to victory and not a funeral dirge. An opponent never, ever gives you the game, no matter how many mistakes he makes -- you still have to earn it at least to a small extent.

The mistakes a computer program makes might more often be gross instead of the subtle "intelligent mistakes" that some players long for, but keep in mind that the program will often play very strongly once the "giveaway" material's gone -- you may have to sweat a fair little bit to pull off the victory. That post-giveaway process is what a handicap mode is really all about -- the important part's not the nature of the error, but the skills you exercise and the work you do in pressing home that advantage.

Of course I also hear the flip side of the coin: that a player is always losing to a program even when it's set to a handicap level. But that's another rant for another column...

Until next week, have fun!

© 2005, Steven A. Lopez. All rights reserved.

Topics f8
Discussion and Feedback Join the public discussion or submit your feedback to the editors


Rules for reader comments


Not registered yet? Register