Crafty Command Documentation (version 18) ----------------------------------------------- Crafty is nothing more than a long-time hobby of mine, dat- ing back to Blitz and later Cray Blitz. People ask me how I keep doing this, and that is the one question that generally leaves me at a loss for words. Perhaps the most common question I'm asked is "is this ver- sion of Crafty some dumbed-down version of what you play on ICC or what you use at a computer chess event?" The answer is a resounding *NO*. The current version is *exactly* what is running on ICC under this version number. Note that a new version can, on occasion, introduce weaknesses or out- right bugs that were not present in previous "gold" ver- sions. As a result, you should be careful to back up your "favorite" before trying the latest and greatest. If you aren't satisfied with the new version, you can then go back to what you believe is a better version. If you are looking for the strongest playing computer chess program available, you should likely look to Fritz, Rebel, Tiger, and the other commercial entries. There you will find strong opponents with polished interfaces that have been tested in a systematic and careful way. If you are looking for a program that plays good chess, has a reason- able set of features for you to use, is available in source form, and one where the author welcomes feedback, code or suggestions, then you are at the right place. I welcome comments and suggestions, and also feedback from ideas you try yourself that seem to work. Crafty is a state-of-the-art computer chess program, and uses all of the search algorithms you have probably read about, negascout search, killer/history move ordering, SEE (Static Exchange Evaluation) quiescence move ordering and pruning, hash (transposition/refutation) tables as well as evaluation caches, selective extensions, recursive null-move search, and a host of other features that have been used and are still being used in most computer chess programs. If it's not in Crafty, either it is on the "to do" list, or it has been tried, found wanting, and discarded. Chess Knowledge is growing, and suggestions (or even better, real code) are welcome. This is the best place to con- tribute your ideas, because knowledge can be used to sup- plant search and make it play better. The evaluation is probably the easiest place to start studying Crafty because of the comments and simplicity of using bitmaps, *once* you get "into" them. My purpose for doing this is an exercise in computer chess efficiency. I can't begin to count the number of people I know that started from scratch to write a chess program. Even larger is the group that started from scratch, and gave up before finishing, because of the basic size of the pro- ject. Crafty offers everyone a very clean starting point, if you are fascinated by the bitmap chess board implementation (as I am). The search and quiescence code is reasonably straightforward, as is the evaluation, It offers a great starting point, so that if you are inter- ested in trying a new search extension, you can be testing tomorrow, rather than next year, because you start with a fully functional chess engine that is not a "toy" applica- tion, but is a functional and "dangerous" chess player. It offers a rapid start, although you can certainly replace it piece by piece until it is "yours" if you want. It also offers a fairly complete set of commands and an interface for a GUI as well as support for chess server play, so that testing and debugging your new ideas is greatly simplified. If you'd like more information, please check out the read.me document and the crafty.FAQ that are distributed with Crafty. These contain recent news and specific instructions for commonly asked questions, like "where can I obtain tablebase files and how do I use them?" How to play a game. ------------------- When you execute Crafty, you will immediately be greeted by the prompt string "white(1): " and Crafty will wait for com- mands. This prompt means it is white on move, and we are at move #1 for white. You can first use any of the commands from the alphabetic command listing below to tailor the game to your liking (time control, hash table size, book random- ness, etc.) and then you have two choices. If you want to play white, just enter your move, and Crafty will take it from there and make a move in response. You will then be prompted by "white(2):" and it is your move again. If you would prefer to play black, just enter either "move" or "go" at the prompt and crafty will move for that side rather than accepting a move from you. After it makes its move for white, you will then see the prompt "black(1): " indicating it is now time for blacks first move. You can enter a move, or you can once again enter "move" or "go" and Crafty will again move for the current side, change sides, and prompt you for what to do next. If you find yourself continually using a set of commands to configure crafty to play as you want, you can put these com- mands in a startup file called .craftyrc (Unix) or crafty.rc (DOS/Windows). The format for this file is just like you would type the commands at the keyboard, with the require- ment that the last line of the file must be "exit" on a line by itself. Using this, each time you start Crafty, it will first execute the commands from this file before it prompts you for input. While Crafty is running, you can control what it displays, but here's a couple of samples to explain what it is saying and why: depth time score variation (1) book moves {d4, c3, Nc3, d3, b3, c4, g3, b4, Be2, Bb5} book 0.0s 70% d4 White(3): d4 time used: 0.01 This is the normal output for those cases where Crafty is in book. The book moves line gives the set of book moves that made the first selection cut (see the book selection expla- nation given later), followed by the move actually played, in this case d4. If Crafty is out of book, then the output looks somewhat different as given below: depth time score variation (1) 4-> 0.81 2.09 6. dxe4 Bxe4 7. Rad8 Qf2 8. Qb5 5 1.37 2.41 6. dxe4 Bxe4 7. Ne5 Qf4 8. Bxe4+ Qxe4 9. f5 5-> 1.88 2.41 6. dxe4 Bxe4 7. Ne5 Qf4 8. Bxe4+ Qxe4 9. f5 6 7.38 -- 6. dxe4 6 11.90 1.97 6. dxe4 Bxe4 7. Rab8 Qf2 8. Qc7 Nc5 9. Qe5 6 12.92 ++ 6. Ne5 6 13.71 2.23 6. Ne5 Qg2 7. Ng6 h5 8. Nh4 Qg4 6-> 15.59 2.23 6. Ne5 Qg2 7. Ng6 h5 8. Nh4 Qg4 time: 15.60 cpu:99% mat:1 n:246565 nps:15927 ext-> checks:4706 recaps:1336 pawns:0 1rep:301 nodes full:45951 quiescence:200614 evals:104657 endgame tablebase-> probes done: 0 successful: 0 Let's take this stuff one line at a time. Lines that have something like 4-> in the depth column are printed when that iteration (depth) is completely finished. The time and score columns should be obvious as to their meaning as is the PV, the sequence of moves that led to this score. One note about the "score" column. As of version 18, Crafty displays the score with + values good for white, - values good for black, no matter which side it is playing in the game. All output now follows this convention, from playing, to analysis mode, to annotating your games, to whisper- ing/kibitzing on the chess servers, and so forth. This is unlike other engines, but once you get used to it, it is much less confusing when you remember that negative scores are good for black and bad for white, and vice-versa. the line that has -- in the score column means that when we started depth 6, dxe4 turned out to be worse than we thought (notice score dropped from 2.411 last search to 1.972 for this move this search.) To resolve this, Crafty lowers the lower search bound (alpha) and re-searches the move to find the score. The line with ++ means that this move (Ne5) is better than the best move so far, so Crafty raises the upper search bound (beta) and re-searches this move to find the new score. the first line of statistics gives the total time taken for this search, the cpu percentage which should stay at 98-100% unless your machine is heavily loaded or unless Crafty is in an endgame that is having lots of contact with endgame databases. If this drops below 98%, it means that Crafty is not getting full CPU usage and will be playing weaker than normal. The mat:1 is simply the true material score, since Crafty's positional scores are often larger than a pawn. Alphabetic Listing of Commands ------------------------------ 1. alarm on|off This command is used to control Crafty's "beep" after it makes a move. Turning this off will make Crafty "quiet" when it plays, but also makes it easy to miss a move if you are using crafty to play in a tournament. This is primarily designed to make Crafty tolerable during late night matches. 2. analyze This command puts crafty into analyze mode. In this mode, Crafty starts computing for whichever side is on move, and it continues computing and showing its analysis until a move is entered. This move is made, Crafty changes sides, and starts thinking and printing analysis all over, but for the other side now. This command is useful to play through a game, because you get instant feedback when you try a move. If you want to try a different move from the one you just entered, use the "back" command to back up one move, or use "back " to back up moves. Note that one move is a single move for the last player, not a move for both sides. To unmake the most recent 2 moves (one for black, one for white) use "back 2". 3. annotate|annotateh