Home

Chess Tiger

ChessBase 10

ChessBase 8.0

Deep Rybka 3

Fritz 7

Fritz11

Mega Database

playchess.com

Pocket Fritz

Pocket Fritz 3

Rybka 3

Shredder 7

T-Notes 1998

T-Notes 1999

T-Notes 2000

T-Notes 2001

T-Notes 2002

T-Notes 2003

Zap!Chess

 

 

 

 

Search in this category
 

ELECTRONIC T-NOTES FOR THE WEEK OF MARCH 10, 2002

OPTIMIZING A CHESS ENGINE'S STRENGTH

by Steve Lopez

It's a common tech support question and one that's impossible to answer in twenty-five words or less: "What's the strongest setting for Fritz/Junior/Tiger/Shredder/etc.?" In this week's ETN, I'm going to make an attempt at an answer. Hopefully, the answer will shed more light than heat; but I expect to get some arguments on several points.

First of all, there is no "best/strongest" setting for any chess engine. As long as you've not selected some sort of handicap mode ("Sparring", "Friend", "Handicap and Fun", or used the ratings slider in Rated Game mode to reduce the engine's strength), a chess engine will always play the best it can within the parameters you've set for it. Among these parameters are:

  • Time control
  • Tablebase access
  • Opening book choice and options
  • Engine parameters
  • Permanent brain (also known as "pondering")
  • Hash table settings

We'll look at each of these parameters in this issue, as well as some other factors that can affect your program's strength.

First, let's examine some motivations people have for wanting to optimize their engine's strength:

Post-game analysis. In my opinion, the single most important feature of a chessplaying program is the ability to analyze games; I've harped on this repeatedly over the last five years in these columns. You can feed a chess program one of your own games (from a tournament, a game you've played at the chess club, one you've played against a computer, or the buttwhipping you took from Uncle Morty at the last family reunion) and have it show you what you did wrong. Obviously, you want the program to give you good suggestions rather than superficial ones, so you want it to analyze as best it can.

Engine research. In the last few years, a whole new chess subculture has arisen around engine vs. engine matches and tournaments. Many people (including a sizable number who don't play much chess themselves) have made a hobby of pitting chess engines against each other, replaying the games, and analyzing the strengths and weaknesses of the varying programs. This includes (but is definitely not limited to) people who pit chess engines against each other in online games.

Strong players looking for a competitive game or a good challenge. A lot of masters and grandmasters use chessplaying programs as sparring partners, but find the handicap levels to be too easy. They want to be challenged by a program that plays at their level, so they want to know how to maximize the strength of their available chess engines. With today's fast processors and better chess engines, this has become a very viable way for strong players to test their ideas or just get in some practice time.

Internet and correspondence chess cheaters. The less said here the better. I spend entirely too much phone time with these folks, time which would be better spent helping other people who have questions concerning improving their own chess play by using our software. If somebody's happy with using a program to take some poor unwitting player off for a few rating points, I guess the rest of us will just have to live with that. But one of my motives for writing this week's article is to help try to clear the phones for people who really need some help with their own chess, rather than help some guy squeeze out ten more rating points for his Fritz account on the Yahoo server.

So let's get down to business and examine ways to maximize your program's strength.

1. Kill anything running on your computer that you don't need

Even though chess programmers have made great strides in making their engines inherently stronger over the last few years, the single most important factor in a chess engine's strength is still the computer's processor. Fritz7 running on a Pentium IV will still whip up on Fritz7 running on a Pentium I most of the time (nothing is 100% dead certain -- I creamed a 1900 player in a tournament back when I was rated 1100, and upsets are always possible when chess programs are playing, too). But if you have a lot of unnecessary junk running on your computer when it's also trying to play chess, you're draining its strength (much like me trying to drink a frosty one, eat some hot wings, yell to my friend over at the jukebox, and talk about Kasparov to a bystander when I'm playing chess down at the corner pub -- no wonder I often find myself playing like a complete fish).

So the first step is to check your Windows Taskbar and make sure you have no other programs running, aside from your chess program (an obvious exception is when you're online, playing on a chess server). But you also need to check the Tray, that little box on the righthand side of the Taskbar, the box that also displays your computer's clock. You'll often see a bunch of little icons in the Tray, signifying that you have "terminate and stay resident" (TSR) programs (also called "background" programs) running. These often include anti-virus programs, "crash guard" programs, AOL or Yahoo "Instant Messengers", and the like. You can typically deactivate these programs by right-clicking on their icons to get a popup menu -- you'll usually see a command to shut them off. Note that there will be some icons that can't be shut off -- like your Sound icon or the Display icon -- which are usually Windows shortcuts to various system settings.

Also shut off any screen savers or power savers.

2. Time controls

Barring any handicap modes being used, a chess program will always play the best it can within the time parameters you've set. I wrote an extended rant on this subject in the January 9, 2000 issue of ETN, which I'll quote here:

Generally speaking, there's no way to handicap Fritz in a timed game; the program will play as strong as it can in the time you've given it. While you can tweak the program various ways using the "engine parameters" function, the engine will still play the toughest game possible given the time settings.

In broad terms, the more time you give a computer to think, the stronger it will play. But there's a paradox here: in general, computers do better at blitz chess than at long time controls. This oxymoron is pretty easy to explain: it's not because computers are good at blitz -- it's because humans are bad at it. Computers are lightning-fast calculators; even a slow engine will calculate to a depth of five or six ply in just a few seconds -- and it sees nearly everything out to that depth. Humans are still looking at (or even searching for) their first candidate move during the first few seconds when it's their turn to play. The basic fact is that you will almost always be outthought by a computer in a blitz game -- it sees an awful lot awfully quickly.

When you play at longer time controls, the odds even out a bit. Although a computer can do a deeper search in a game at tournament time controls, it's not deeper by a huge amount. Every ply you add to a computer's search exponentially increases the number of positions it must consider and each ply takes longer to consider than the last. It takes a computer longer to search just the eleventh ply alone than it did to search the first six or seven plies combined.

This is what evens the odds: computers don't get significantly stronger at longer time controls, but humans do. We have more time to consider our options and to make those hazy long-term strategic plans that computers are incapable of devising. Computers only see the short range possibilities. Humans consider the long term objectives -- but we need a little time to do it. That's why computers have the advantage at blitz chess, while humans do well at longer time controls (40/2 or other tournament controls). Our abilities are the ones that change with the clock settings, not the computer's.

Either way, the computer plays as tough as it can in the time you've allotted, so keep this in mind. This is why I'm baffled when I receive a tech support call in which a user asks me for the "strongest" setting for Fritz. Unless you're using one of the modes we discussed last week (in which you limit Fritz' thinking ability or alter its style of play), any timed setting is essentially its "strongest" setting.

Obviously, that article was geared toward users who are playing games against the program. But what about engines against other engines or using a program for analyzing games?

In the latter case, longer is better. The more time you give an engine in an overnight analysis, the better results you should see. For extensive information on the various analysis modes in our playing programs, see the ETN issues for March 12, 19, and 26, 2000.

For engine vs. engine games, the point becomes moot. As long as both engines are operating under the same time constraints (such as both engines playing a sudden death game at a 5 minute time control), they're both operating within the same framework. Some engines are naturally better than others at blitz chess and, if they're being operated on two different computers, the engine on the faster machine will enjoy an advantage due to the processor speed. But the time settings themselves won't come into play here as long as both engines are given the same time control.

So what time control is "best"? It's an unanswerable question. An engine that's given two hours to chew on a position will likely come up with a better move than one that's given only five seconds to analyze. In general, more time equals a better move. It's ultimately up to you to decide how long you want to sit around and play a game against your computer. But also keep in mind the "blitz paradox" that I mentioned in italics above.

3. Set the hash tables properly

That's a recent rant. See ETN for February 24, 2002 for more info than you can shake a stick at.

And, as a related rant, I've received a few letters and phone calls from users who say, "I don't want to have to do the math!" That's OK -- I can't make you do the math. But if you want to get maximum performance from your chess engine, you're going to have to bite the bullet, break out the pocket calculator, and plug in the numbers. Sorry -- that's just the way it is.

4. Give your engine access to endgame tablebases

The ETN for July 2, 2000 gives you what you need to know about endgame tablebases. As noted in that article, you can buy sets of tablebases, download them (if you have a high speed modem), or generate them yourself (if you have the computer that ate Toldeo). What the article doesn't tell you (because it's a new feature of the Fritz7/Shredder6 interface) is that you no longer need to edit the chssbase.ini file to tell your program what folder your tablebases are in. Just go to the Tools menu, select "Options", click the "Tablebases" tab, click the "Browse" button next to "Path 1", and point your program to the folder where you put the tablebases. It's that ridiculously easy.

Note that tablebases do make your chess engine stronger in the late middlegame and endgame by giving it access to perfect endgame knowledge in the three, four, and five piece endings (and remember that the Kings do count as pieces for tablebase purposes). This is in stark contrast to opening books, which do not necessarily make a chess program "stronger" per se...

5. Load an opening book and configure it for maximum performance

Contrary to popular belief, opening books in and of themselves do not increase an engine's playing strength. An opening book is just a library of moves that an engine can use when deciding what to play or how to respond to a move its opponent makes. But saying that an opening book itself makes a program stronger is like saying that the King's Indian Defense is a stronger opening than the Bogo-Indian -- it's not the opening, it's what you do with it that counts. If a chess engine plays an opening that generally leads to closed positions, it's not going to be able to utilize the very things that computers excel at: tactical accumen and great use of piece mobility. This is why opening books lean toward open games -- to help the program get to positions where it can really flex its muscles. But the book itself doesn't make the program "strong" or "weak" -- it only guides it to a point where the book moves run out and the engine takes over, and that position may or may not be one at which computers specialize and excel.

However, this does suggest that there are some vital opening book issues that can affect your chess engine's overall performance. First of all, make sure that you have an opening book loaded, so that the engine doesn't have to "reinvent the wheel" by calculating everything right from move one each game. See ETN for February 20, 2000 for details on how to load the opening book.

Next, be sure to load the opening book that came with the engine in question. Different chess engines have different playing styles (just as different people do). An engine's programmer is very familiar with the strengths and weaknesses of his own creation; each engine's opening book is designed to lead to positions that allow that particular engine to maximize its unique strengths while minimizing its deficiencies. This book may or may not work well when used with a different engine; it's possible (sometimes even likely) that the latter will be the case. So use the Shredder opening book when playing with Shredder, the Fritz opening book when playing with Fritz, etc. For more on this, see ETN for June 20, 1999.

Hitting F4 will bring up a dialogue that allows you to tweak the way the program uses the opening book. Obviously, "Use book" must be checked in order for the book to be used at all. "Tournament book" should be checked -- this causes the program to avoid gambits and "side lines", preferring to play the "tried and true" main lines from top level human play instead. The sliders control the long-term learning functions. If you enable these, the program (over time) will tend to repeat openings that it's done well in while avoiding openings with which it hasn't been too successful. While this doesn't affect "strength", it will tend to improve the program's results over the long haul (it's an artificial way of giving the program the benefit of "experience"). "Variety of play" is a double-edged sword. Cranking it up means that the program will play a lot of varied openings, even though some of them may not have good statistical results. Turning it down will cause the program to stick to openings that have been played a lot in human chess and have a good statistical percentage. For specifics on these parameters, see ETN for February 27, 2000.

When in doubt, just hit the "Optimize" button in the Book Options dialogue. This adjusts the parameters to the settings that the programmers have found best for serious ("best") play.

Many people ask if they should import boatloads of games into their programs' opening books. I advise against it for "strongest" play, simply because it's easy to add lots of games that will adversely affect the book (games which contain opening errors played by weaker players or games that used "closed" openings which lead to positions that computers traditionally handle poorly). The latter third of the ETN article for April 15, 2001 explains this extensively as part of the discussion of Powerbook 2001.

6. Allow the engine to think on its opponent's time

Chess engines never stop thinking -- if you've permitted them to do so. When you hit F3, you get the engine selection dialogue which allows you to pick and configure an engine. You'll see a check box called "Permanent brain". Make sure that this box is checked; this will allow the engine to keep thinking even when it's the opponent's turn to move. The engine will look at the opponent's possible replies and analyze its own future responses to them. Unchecking the box makes the engine "go to sleep" when it's the opponent's move and results in weaker play.

7. Use the default engine parameters

Each engine has its own set of special tweaks that allow you to adjust the algorithm (the formula the engine uses when evaluating positions). However, the engine's programmer has devised a set of default parameters that he's judged best, that will result (in most positions) in strongest play from his engine. When you hit F3 to load an engine, you can click the "Engine parameters" button to bring up a dialogue containing these tweaks. Click the "Default" button to set the parameters that the programmer has deemed best.

I'll be brutally frank here: a lot of chess engines have parameters that require the user to be dang near a Botvinnik to be able to change properly, without unexpected (and frequently unfortunate) side effects to the program's performance. For a discussion of reassigning piece values, see the ETN for June 4, 2000. The ETN for March 9, 1999 describes the engine parameters for Fritz5.32, which are still present (with a lot of additions) in Fritz7. Even after reading those articles, you still might have trouble with accurately reassigning parameters -- it's almost impossible to predict the results without a lot of trial and error. Unless you want to spend a lot of time experimenting with these parameters, it's best to just use the defaults; in the majority of cases, the defaults work better than a "tweaked up" version anyway.

8. "Optimize strength" -- no way!

The "Optimize strength" command will set your hash tables for you. The problem is that it doesn't consider the game's time controls. It only looks at your machine's available RAM and sets the hash size accordingly. Consequently, this can have bad results at games with shorter time controls, especially when you're using a machine with a slower processor and a truckload of RAM. Use the formula and suggestions I gave you two weeks ago in ETN to set the hash tables manually. You'll get better results by fine-tuning the hash size yourself than by relying on the menu command to do it for you.

9. Give your computer a rest once in a while

It's just physics -- the longer a processor runs, the more it heats up and the less efficient it becomes. Your program will play better chess right after you turn your computer on than it will after the machine's been running for hours or even days. I can prove this by using a competitor's chess program that provides "personalities" to play against and assigns ratings to these imaginary opponents based on your hardware and its performance. I can turn on my computer, launch the program, and check a personality's rating, then let the computer run for 12 hours, launch the program again, check the rating a second time, and see that it's dropped by anywhere from three to ten points.

If you're in the habit of letting your machine run for days at a time, turn it off once in a while to let the processor cool down. You'll get better chess performance on a machine with a cooler processor than from one that you can toast weenies over.

And finally...

10. Be prepared for the times when the engine loses

Nobody wins 100% of the time and this also applies to chess programs. If you're playing an online game, your opponent might have a faster computer than you do (no matter what he's telling you). He might be Karpov using an alias. Or, most likely, your engine just wound up in a middlegame that it's not all that good at. I remember a customer who could beat Fritz3 at will -- he found a "hole" in the opening book, played to that same position, locked up the center pawns, and whacked Fritz with a King-shredding, pawn cover-denuding piece sacrifice game after game. And this was right after Kasparov lost ten grand in a tournament final against Fritz (1994, for those keeping score). Guess what? The customer in question wasn't even a titled player -- he was Class B or C, if memory serves. The ETN for November 8, 1998 gives another example of a position at which computers just ain't no dang good (illustrating the "horizon effect" in action).

Chess programs lose. When you bought Fritz/Shredder/etc., you didn't buy what I like to call a "divine oracle" (or what a friend of mine calls, somewhat less charitably and perhaps even offensively, "God on a disk", or what I've called in lighter moments "Leonid Shamkovich on a Ritz cracker"). What you got was a strong partner/analyst, but you didn't get perfection. There's a lot of room for improvement in every chess program; if they were perfect, we'd all own one and I'd have a different hobby and part-time job. Computer programs are great at tactics, but they have a long way to go in the area of strategy and they certainly can't devise a long-range plan the way even an average human player can. So even if you follow all of the tips in the article, you may still find situations in which a long-term plan is required or a bit of strategic finesse is called for -- and in which your program falls short of the mark. It'll happen, trust me. But following the suggestions in this article will help minimize the risk of it happening by maximizing the potential of your chess engine.

Until next week, have fun!



© 2002, Steven A. Lopez. All rights reserved.
Back issues of Electronic T-Notes from 1997 and 1998 are available on the ChessBase USA web page