1command synopsis 2 3!command....................... passes command to a shell. 4adaptive NPS a b c d........... enables adaptive hash mode. 5alarm on|off................... turns audible alarm on/off. 6analyze........................ analyze a game in progress. 7annotate....................... annotate game 8autotune....................... SMP search tuning (help autotune for details) 9batch on|off................... on disables async I/O for batch file usage 10bench.......................... runs performance benchmark. 11black.......................... sets black to move. 12book........................... controls book 13cache=n........................ sets tablebase cache size. 14clock.......................... displays/adjusts chess clock times. 15display........................ displays chess board. 16display [n].................... sets display options 17draw accept|decline............ decline always declines. 18draw offer|nooffer............. nooffer never offers a draw. 19draw dynamic <0|1>............. enables/disables dynamic draw scores. 20echo........................... echos output to display. 21edit........................... edit board position. 22egtb........................... enables endgame database probes. 23egtbd.......................... set min remaining depth to allow probes. 24epdhelp........................ info about EPD facility. 25end............................ terminates program. 26evaluation..................... adjust evaluation terms. 27exit........................... restores STDIN to keyboard. 28force move..................... forces specific move. 29hash n......................... sets transposition table size. 30 (n bytes, nK bytes or nM bytes). 31hashp n........................ sets pawn hash table size. 32history........................ display game moves. 33import filename................ imports learning data (.lrn files). 34info........................... displays program settings. 35input filename................. sets STDIN to filename, reverts back on exit. 36kibitz n....................... sets kibitz mode n on ICS. 37learn n|clear.................. enables/disables learning (100 = default). 38 clear clears all learned information 39level moves time inc........... sets ICS time controls. 40linelength n................... sets line length to n. A really large value 41 will produce 1 line PVs, making parsing easier 42list........................... update/display GM/IM/computer lists. 43lmp base scale................. LMP pruning move counts 44lmr min max bias moves scale... LMR reduction matrix generator 45load file title................ load a position from problem file, starting 46 with line containing title, ending on exit. 47log on|off..................... turn logging on/off. 48mode normal|tournament......... toggles tournament mode. 49move........................... initiates search (same as go). 50name........................... sets opponent's name. 51new............................ initialize and start new game. 52null m n....................... null move R = M + depth / n. 53noise n........................ no status until n nodes searched. 54operator seconds............... sets operator time per move. 55output long|short.............. sets move display format to long or SAN 56perf........................... times the move generator/make_move. 57perft.......................... tests the move generator/make_move. 58personality save|load fn....... saves/loads a personality file. 59pgn option value............... set PGN header information. 60phash n........................ sets path hash table size. 61ponder on|off.................. toggle pondering off/on. 62ponder move.................... ponder "move" as predicted move. 63rating a b..................... sets Crafty rating to a, opponent to b 64 (affects draw score/contempt) 65read [filename]................ read moves in (from [filename] if given.) 66reada [filename]............... read moves in (from [filename]]) and append. 67 (appends to current game history.) 68reset n........................ reset game to move n. 69resign......................... ends current game recording Crafty as winner. 70resign m n..................... set resign threshold to m pawns. 71 n = # of moves before resigning. 72savegame [filename]............ saves game in PGN format (to filename). 73savepos [filename]............. saves position in FEN string (to filename). 74score.......................... print evaluation of position. 75screen [filename] margin....... screen a file of EPD positions by searching them 76 and culling positions with score outside the 77 window {-margin, margin} (use st=n to set time) 78sd n........................... sets absolute search depth. 79search move.................... search specified move only. 80selective min max.............. set null move depths. 81setboard FEN................... sets board position to FEN position. 82settc.......................... set time controls. 83show book...................... toggle book statistics. 84skill n........................ set skill level to n 85smp............................ sets SMP parameters (help smp for details) 86sn n........................... sets absolute search node limit. 87speech on|off.................. enables (disables) audio output. 88st n........................... sets absolute search time. 89swindle on|off................. enables/disables swindle mode. 90tags........................... list PGN header tags. 91test file [N].................. test a suite of problems. 92time........................... time controls. 93timebook....................... out of book time adjustment 94trace n........................ display search tree below depth n. 95usage percentage............... adjusts Crafty's time usage up or down. 96whisper n...................... sets ICS whisper mode n. 97white.......................... sets white to move. 98wild n......................... sets ICS wild position (7 for now). 99xboard......................... sets xboard compatibility mode. 100 101Type "help command" to see more detailed help information, if it is 102available. Note that help is not available for all possible commands. 103<end> 104 105<analyze> 106The analyze command puts Crafty into a mode where it will search forever 107in the current position. When a move is entered, crafty will make that 108move, switch sides, and again compute, printing analysis as it searches. 109You can back up a move by entering "back" or you can back up several 110moves by entering "back n". Note that n is the number of moves, counting 111each player's move as one (ie n plies, not n full moves). 112<end> 113 114<annotate> 115annotate[h|t] filename side moves margin time [n] 116 117Filename is the input file with game moves, while the output will be 118written to filename.can. The input file is PGN-compatible with one 119addition, the ability to request that alternative moves also be 120analyzed at any point. To do this at the point where you have 121alternative moves, simply include them in braces {move1, move2}, 122and Crafty will then search them also. 123 124Side can be b/w/bw to indicate whether to annotate only the white 125side (w), the black side (b) or both (bw). Side can also be the 126players name, where Crafty will then use the players name and the 127PGN tags to discover which you want the annotation done for. 128 129Moves indicates which moves to annotate. A single value says start 130at the indicated move and go through the entire game. A range (20-30) 131annotates the given range only. 132 133Margin is the difference between the search value for the move played 134in the game, and the best move crafty found, before a comment is 135generated (pawn=1.0). 136 137Time is the time limit per move in seconds. 138 139If the optional "n" is appended, this produces N best moves/scores/PV's, 140rather than just the very best move. It won't display any move that 141is worse than the actual game move played, but you can use -N to force 142Crafty to produce N PV's regardless of how bad they get. 143 144Using 'annotateh' produces an HTML file with bitmapped board displays 145where analysis was displayed. 146 147Using "annotatet" will cause the output to be written in a LaTex (.tex) 148format. 149<end> 150 151<autotune> 152The autotune command can be used to configure various SMP search parameters 153for your specific hardware and target time limit. Note that before you run 154this command, you MUST set the max number of threads you want to use (most 155likely the number of physical processor cores on your machine.) Crafty 156actually runs a parallel search over a small set of positions repeatedly, and 157to properly tune things, it needs to use the max configuration you will ever 158want to use. If you forget, autotune will refuse to run. The command is: 159 160autotune <time> <accuracy> 161 162The <time> argument tunes the parallel search stuff for this time limit. The 163only real place where this might be useful is for very fast vs very slow time 164limits, since a fast search probably needs to be a bit more aggressive if it 165is going to have any hope of using multiple threads. Once you get to a time 166limit of 30 - 60 seconds, going further wont help at all and can GREATLY 167increase the run-time of the automatic tuning code. 168 169<accuracy> is simply a number that tells Crafty how many times to run a test 170for a specific tuning option. It will run this many tests and then use the 171average of the run times for the timing value. Four (4) provides pretty 172good accuracy, anything less than four often runs afoul of SMP non-determinism 173and it can make wrong decisions. 8-16 are better but these will take some time 174to run so be prepared. Crafty will give you an estimate of the expected run- 175time once it calibrates the benchmark to the time limit you specified. 176 177Once AutoTune() finishes, it will append the necessary commands to the .craftyrc 178file to set the optimal values for each option. If you run this multiple times, 179you will accumulate cruft at the bottom of the .craftyrc file. Since the last 180commands override the earlier ones, it will work, but if you do run it more than 181once you might consider an edit to clean it up. 182 183This can burn some time so it is an ideal command to run overnight where you can 184crank up accuracy and get pretty optimal settings. 185 186Note: This is more effective for larger numbers of threads/cores. On a machine 187with 8 or fewer cores, the default values are probably as good as anything. But 188as the number of cores climbs, autotune can find better settings depending on 189the hardware. 190<end> 191 192<book> 193You can use the following commands to customize how the program uses 194the opening book(book.bin and books.bin). Typically, book.bin contains 195a large opening database made from GM games. Books.bin is a short, 196customized book that contains selected lines that are well-suited to 197Crafty's style of play. The flags can further refine how this small 198book file is used to encourage/avoid specific lines. 199 200binfile create filename [maxply] [mp] [wpc] 201 202This command creates a new book by first removing the old binary file. 203it then will parse filename and add the moves to the binary book 204filename given as binfile. 205 206maxply is the max length of book moves stored from any single PGN 207game in the input file. 208 209mp means a particular move must appear in at least that many games 210to be stored in the book file. 211 212wpc is the relative winning percentage. 50 means exclude any book move 213that doesn't have at least 50% as many wins as losses. 214 215book mask accept chars 216 217Sets the accept mask to the flag characters in chars (see flags below.) 218Any flags set in this mask will include either (a) moves with the flag 219set, or (b) moves with no flags set. 220 221book mask reject chars 222 223Sets the reject mask to the flag characters in chars (see flags below.) 224Any flags set in this mask will reject any moves with the flag set (in 225the opening book.) 226 227book off turns the book completely off. 228 229book random 0|1 disables/enables randomness. Book random 0 takes the set 230of book moves and searches them for about 1/10th of the normal search time 231and lets the search choose which move to play. Any move not in the book 232file will not be considered or played. 233 234bookw weight v 235 236Sets weight for book ordering. (Weights are freq (frequency), eval 237(evaluation) and learn (learned scores). 238 239book width n 240 241Specifies how many moves from the sorted set of book moves are to be 242considered. 1 produces the best move from the set, but provides little 243randomness. 99 includes all moves in the book move set. 244 245Flags are one (or more) members of the following set of characters: {?? ? 246= ! !! 0 1 2 3 4 5 6 7 8 9 A B C D E F} Normally, ?? means never play, ? 247means rarely play, = means drawish opening, ! means good move, !! means 248always play, and 0-F are user flags that a user can add to any move in the 249book, and by setting the right mask (above) can force the program to either 250always play the move or never play the move. The special character * means 251all flags and is probably dangerous to use. Flags are added to a move by 252entering the move and a / or \ followed by the flags. / means add the flags 253to the move preserving other flags already there while \ means replace any 254flags with those following the \. 255 256The format of the book text (raw data) is as follows: 257 258[title information] (required) 2591. e4 e5 2. Nf3 Nc6 3. ... (a sequence of moves) 260[title information for next line] (required) 2611. e4 e6 ... 262end (optional) 263<end> 264 265<clock> 266clock crafty-time [opponent-time] 267 268clock is primarily intended to be used in a computer chess tournament 269where the games are played on a real chess board using a real chess 270clock, rather than through some automatic interface that manages the 271time automatically. 272 273crafty-time is the amount of time left on Crafty's clock, expressed in 274minutes, or in hh:mm format. Crafty will convert this to its internal 275representation correctly. 276 277opponent-time is the amount of time left on the opponent's clock, 278expressed in the same way. This is option and is not required as 279Crafty does not use this information during the game although it 280does keep up with it. 281 282After entering this command, you should probably type "clock" to be 283sure things look correct. 284 285Note that the "operator" command sets a time per move overhead for the 286operator, and that this affects the actual time used as expected. IE in 287the above clock setting, assuming the operator has allowed 10 seconds per 288move, crafty will "hide" 35 * 10 seconds and not use it for searching, which 289gives the operator time to actually make the moves and press the real clock 290button. It is CRITICAL that the clock command be used from time to time to 291keep Crafty's internal clock in sync with the real clock. If you use the 292operator command, the clock value should match the real chess clock exactly, 293if you choose to not use the operator time and fudge the chess clock time 294yourself, that will work as well, but it is more prone to errors. 295<end> 296 297 298<display> 299display moveinfo -> display move time/results/etc. 300display pv -> display principal variation. 301display fail -> display fail high / low moves. 302display stats -> display search statistics. 303display moves -> display root moves as they are searched. 304display info -> display general information messages. 305display ply1 -> display ply-1 move list/sorting info. 306display movelist -> display move list after each iteration. 307 308For the above options, they can be preceded by a "no" to disable them, or 309omit the "no" to enable them. "display all" will show all current display 310settings 311<end> 312 313<draw> 314draw offer|nooffer determines whether Crafty will automatically offer 315draws when it believes that result is appropriate. 316 317draw accept|decline determines whether Crafty will automatically accept 318draw offers when they are made, or if it will automatically decline them 319no matter what the current score is. 320 321draw dynamic 1|0 enables(disables) dynamic draw score computation based on 322the rating difference between Crafty and the opponent (usually obtained by 323the "rating" command from xboard. If set to 0, this is disabled and the 324default draw score (aka contempt factor) is set to zero (0). 325<end> 326 327<lists> 328list name +name -name ... 329 330The lists are as follows: 331 332AK Auto-Kibitz list. If crafty plays any opponent named in this list 333while playing on a chess server, it will kibitz the usual analysis as 334the game is played. Not advised for human opponents as they do not 335like the "noise". 336 337B Blocker list. If you notice a player repeatedly trying to block the 338position to get easy draws, put his name in this list. Players in this 339list get special "anti-human" scoring turned up louder than usual to 340combat this strategy. 341 342C Computer list. This is not needed on ICC as xboard/winboard both 343tell crafty it is playing a computer opponent. However, if your GUI 344does not do this, you can put the name of the computer opponents you 345frequently play in this list and if the GUI sends the "name" command 346properly, crafty will figure out that it is playing a computer. 347 348GM/IM lists are obvious. This identifies players that are strong 349enough that Crafty should resign or offer draws sooner than normal, 350rather than hoping for a blunder in lost or drawn positions. 351 352SP Special Player list. Names in this list can be used to specify 353a unique opening book (to replace books.bin, not book.bin) for this 354particular opponent, as well as specifying a personality file to use 355rather than the default crafty.cpf. The format of this particular 356list is: 357 358list SP +name [book=filename] [personality=filename] 359 360<end> 361 362<lmp> 363 364lmp base scale 365 366This commands tunes the LMP move count thresholds. The array it produces 367is indexed by depth, and defines the number of moves at that remaining 368depth that must be searched before late move pruning can kick in. 369 370The basic formula looks like this: 371 372moves = base + depth ^ scale 373 374Bigger valuse for base and scale make LMP more conservative, smaller values 375make it more aggressive and risky. 376 377<lmr> 378 379lmr min max dscale mscale scale 380 381This command tunes the LMR reduction matrix. The values are used to 382set the reduction matrix, which is indexed by depth remaining and moves 383searched so far at this ply. This is an array of 32 rows, 64 columns, 384where the rows correspond to remaining depth and the columns correspond 385to total moves searched so far at this ply. 386 387The basic calculation looks like this: 388 389 r[depth][moves] = (log(depth) * dscale + log(moves) * mscale) / scale 390 391Increasing dscale makes the reduction amount favor depth more, increasing 392mscale makes the reduction amount favor moves searched more. The "scale" 393value is used to limit the speed at which the reductions grow. 394 395Note that NO reduction can be less than min nor greater than max, from 396the lmr command. When you use this command, it will display a compressed 397version of the 32x64 array like this: 398 399 400 401 LMR reductions[depth][moves] 402 ----------------------moves searched----------------- 403 | 2 6 10 14 18 22 26 30 34 38 42 46 50 54 58 62 404 | 3: 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 405 | 5: 1 1 2 2 2 2 2 2 3 3 3 3 3 3 3 3 406 d 7: 1 1 2 2 2 3 3 3 3 3 3 3 3 3 4 4 407 e 9: 1 1 2 2 3 3 3 3 3 3 4 4 4 4 4 4 408 p 11: 1 2 2 3 3 3 3 3 4 4 4 4 4 4 4 4 409 t 13: 1 2 2 3 3 3 4 4 4 4 4 4 4 4 4 5 410 h 15: 1 2 2 3 3 3 4 4 4 4 4 4 5 5 5 5 411 17: 1 2 3 3 3 4 4 4 4 4 4 5 5 5 5 5 412 l 19: 1 2 3 3 3 4 4 4 4 4 5 5 5 5 5 5 413 e 21: 1 2 3 3 4 4 4 4 4 5 5 5 5 5 5 5 414 f 23: 1 2 3 3 4 4 4 4 5 5 5 5 5 5 5 5 415 t 25: 1 2 3 3 4 4 4 5 5 5 5 5 5 5 5 6 416 | 27: 1 2 3 3 4 4 4 5 5 5 5 5 5 6 6 6 417 | 29: 1 2 3 4 4 4 4 5 5 5 5 5 5 6 6 6 418 | 31: 1 2 3 4 4 4 5 5 5 5 5 5 6 6 6 6 419 420Notice that the depth (# of rows) only displays every other row to make 421the display fit on a normal screen. The moves searched show every fourth 422value since there are 2x as many columns as rows. However, even though 423you don't see the missing rows/columns, the values are there. 424<end> 425 426<mode> 427 428This command influences how the book is used. 429 430mode normal is the default. 431 432mode tournament tells crafty to behave differently while in book. 433Specifically, when it is pondering, it generates all of the opponent 434moves and looks them up in the opening book. If it finds a book 435reply, it eliminates that opponent move from the list. It then does 436a 1/10th normal time search for the opponent, but ONLY considers those 437moves it did not have a book reply for. It then takes the result of 438that search and ponders that move, so that hopefully if the opponent 439plays a move not in our book, we will already be thinking. 440 441The more useful place, however, is where we play a book move that takes 442the opponent out of book, and he spends a significant amount of time 443thinking and plays a pretty obvious move. Since we ponder the best move 444of his that we don't have a book move for, we have a good chance of 445pondering the right move and saving time on our clock. 446<end> 447 448<mode> 449null <min> <divisor> 450 451This command allows you to customize the null-move search parameters. The 452formula Crafty uses is as follows: 453 454 R = <min> + depth / <divisor> 455 456The default values are 3 and 10. When remaining depth is < 10, the R value 457is 3. If remaining depth is > 10 and < 19, R=4, and so forth. Smaller 458divisor values make R ramp up quicker and the null-move pruning will become 459more aggressive. Overall depth will increase pretty quickly, but this can 460also hide certain types of tactics as well, so going too far turns out to 461be dangerous. 462<end> 463 464<personality> 465personality load|save filename <or> personality n v 466 467perspath path-to-personality-directory 468 469Crafty "personality" files (.cpf files) contain information that 470affects three components of Crafty. 471 472You can use the "selective" command to adjust the null-move R (min 473and max) values. The default values are 2 and 3, and reducing them 474will reduce Crafty's playing strength to some fairly significant 475degree. 476 477You can use the "extension" command to adjust the search extension 478values. Reducing these will "dumb down" the search and make crafty 479tactically (but not positionally) weaker. They can be set all the 480way down to 0.00 if you choose. 481 482You can use the evaluation command to adjust some global evaluation 483weights (ie turn down total pawn scoring, or king safety, etc.) or 484you can use this command to adjust individual scoring values, from 485the value of pieces, to specific scoring terms for each piece such 486as the value of a doubled pawn or whatever. 487 488Once you find settings you like, you can use "personality save 489filename" to save all of the above settings in one file. Later you 490can use "personality load filename" to restore those settings prior 491to playing a game. 492 493One final note is that you can save to the specific file "crafty.cpf" 494and your settings will become the _default_ each time you start 495Crafty, until you either remove the file, load another personality, 496or save a new default personality. 497 498You can have as many different personality files as you want, and to 499keep them from getting jumbled up, you can put them in a separate 500directory and add the "perspath" to your .craftyrc/crafty.rc file to 501point Crafty to the directory where the personality files belong. 502 503personality item# value [value ... value] 504 505The personality command allows you to change specific evaluation 506or search numbers when you want. The first thing you should do is 507type "personality list" to show all the possible values. The format 508looks like this when displayed: 509 510White(1): personality list 511 512 513================================================== 514= search options = 515================================================== 516 1 check extension 1 517 2 null-move reduction 3 518 3 null-move adaptive divisor 10 519 4 LMR min distance to frontier 1 520 5 LMR min reduction 1 521 6 LMR max reduction 7 522 7 LMR formula depth bias 2.00 523 8 LMR formula moves searched bias 1.00 524 9 LMR scale factor 2.65 525================================================== 526= search options (continued) = 527================================================== 528 11 prune depth 6 529 12 prune margin [remain_depth] 530 0 100 100 200 200 300 300 400 531================================================== 532= raw piece values = 533================================================== 534 21 pawn value -100 (mg) 100 (eg) 535 22 knight value -325 (mg) 325 (eg) 536 23 bishop value -325 (mg) 325 (eg) 537 24 rook value -500 (mg) 500 (eg) 538 25 queen value -1050 (mg) 1050 (eg) 539================================================== 540= miscellaneous scoring values = 541================================================== 542 31 wtm bonus 5 (mg) 8 (eg) 543 32 draw score 1 544 ... etc 545 546The first number is the personality term ID #. To change the 547value of a pawn from the default 100 to 50, you would type 548the following command: 549 550pers 21 50 50 551 552 553And now pawns are worth 1/2 of what they were prior to the 554command. Note that unless you specifically save the setting 555with the "personality save" command, once you exit Crafty 556the pawn value will return to 100 the next time you start it 557up. You can, of course, put such commands in the .craftyrc/ 558crafty.rc file, but it is simpler to use the personality 559command instead (type "help personality" for more information). 560 561Note that some evaluation terms have a list of numbers as they 562are indexed by something. When you change one of these terms, 563you must give _exactly_ the correct number of values, or the 564command will produce an error without changing anything. 565 566Some of the values are 8 X 8 matrices of values, where the 567values correspond to the chess board as viewed with square 568a1 on the bottom left. You must type the values in in order 569as they appear on the screen. Crafty will shift things as 570needed. IE for a piece/square table for knights, the first 571value displayed is for a8, so the first value you enter must 572also be for a8. Many of these matrices have black/white 573counter-parts. You enter the white values, Crafty will 574mirror those to reflect the _same_ values but from the black 575side of the board. This will be done automatically. 576 577Non 8 X 8 matrices are just dumped in order from element zero 578to N. You enter those the same way. IE the way it prints them 579out is the way you enter them, reading from top-to-bottom, and 580left-to-right. 581 582If you come up with an interesting personality, feel free to make 583it available to everyone, and if it is particularly attractive, it 584can become part of the "distributed" crafty personalities once this 585has been released. 586<end> 587 588<settc> 589settc moves crafty-time opponent-time 590 591settc is primarily intended to be used in a computer chess tournament 592where the games are played on a real chess board using a real chess 593clock, rather than through some automatic interface that manages the 594time automatically. 595 596moves is the number of moves left to the next time control from Crafty's 597perspective. IE if the time control is 60 moves in 120 minutes (a normal 598time control for the WCCC) and crafty has actually made 25 moves in the 599current game, then the correct "moves" value would be 35, as there are 600exactly 35 moves to be made before the next time control is reached. 601 602crafty-time is the amount of time left on Crafty's clock, expressed in 603minutes, or in hh:mm format. Crafty will convert this to its internal 604representation correctly. 605 606opponent-time is the amount of time left on the opponent's clock, 607expressed in the same way. 608 609After entering this command, you should probably type "clock" to be 610sure things look correct. 611 612Note that the "operator" command sets a time per move overhead for the 613operator, and that this affects the actual time used as expected. IE in 614the above clock setting, assuming the operator has allowed 10 seconds per 615move, crafty will "hide" 35 * 10 seconds and not use it for searching, which 616gives the operator time to actually make the moves and press the real clock 617button. It is CRITICAL that the clock command be used from time to time to 618keep Crafty's internal clock in sync with the real clock. If you use the 619operator command, the settc value should match the real chess clock exactly, 620if you choose to not use the operator time and fudge the chess clock time 621yourself, that will work as well, but it is more prone to errors. 622<end> 623 624<smp> 625smp commands are used to control the SMP search. 626 627smpaffinity <n> <p> is used to enable or disable processor affinity. "-1" 628disables affinity and lets threads run on any available core. If you use an 629integer <n> then thread zero will bind itself to cpu <n> and each additional 630thread will bind to the next higher cpu number. This is useful if you try to 631run two copies of crafty on the same machine, now you can cause one to bind 632to the first <n> cores, and the second to the last <n> cores. For the first 633instance of Crafty, you would use smpaffinity=0, and for the second 634smpaffinity=8, assuming you are running 8 threads per copy on a 16 cpu machine. 635If you get this wrong, you can have more than one thread on the same cpu which 636will significantly impact performance. 637 638The second parameter is used to help Crafty identify physical vs logical cores. 639On a typical 20 core intel machine, processors 0 - 19 are on physical cores, 640then 20-39 map back to those same physical cores, but different logical 641(hyperthreaded) processors. "1" is the correct value for this system. For an 642IBM Power 8 machine with dual 10-core chips, processors 0 through 7 are on 643physical core 0, then 8 through 15 are on physical core 1, etc. A value of "8" 644will map threads to physical cores correctly as each thread is spaced on the 645current processor core + 8, which is correct. 646 647smpmt <n> sets the total number of allowable threads for the search. The 648default is one (1) as Crafty does not assume it should use all available 649resources. For optimal performance this should be set to the number of 650physical cores your machine has, which does NOT include hyperthreaded cores. 651 652smpgroup <n> sets the maximum number of threads at any single split point to 653<n>, with the exception of split points fairly close to the root where ALL 654threads are allowed to split together ignoring this limit. Note that this is 655ignored in the first 1/2 of the tree (the nodes closer to the root). There 656it is actually good to split and get all active threads involved. 657 658smpmin <n> avoids splitting when remaining depth < n. This is used to balance 659splitting overhead cost against the speed gain the parallel search produces. 660The default is currently 5 (which could change with future generations of 661Intel hardware) but values between 4 and 8 will work. Larger values allow 662somewhat fewer splits, which reduces overhead, but it also increases the 663percentage of the time where a thread is waiting on work. 664 665smpnuma <n> enables (a) or disables (0) NUMA mode. This defaults to zero, 666which is best for most users. If you have a multiple-socket machine, or one 667that is NUMA even though it only has one socket, you should enable this. This 668will cause Crafty to split the hash tables across all NUMA nodes to prevent 669the formation of "hot spots" that would cause unnecessary conflicts. 670 671smproot <n> enables (1) or disables (0) splitting the tree at the root. This 672defaults to 1 which produces the best performance by a signficiant margin. 673But it can be disabled if you are playing with code changes. 674 675smpnice <1/0> enables or disables the "nice facility". With smpnice=1, at the 676end of a search (non-pondering) the extra threads will terminate rather than sit 677in a busy spin loop burning cpu cycles. smpnice=0 is slightly more efficient 678but will result in 100% of the machine being used whether the search is running 679or waiting on input. 680 681smpnodes <n> sets the number of NUMA nodes on your hardware. This is used to 682try to split with threads on the same node when practical, to improve memory 683access time. 684 685smpgsd sets the minimum depth required to allow a gratuitous split. A 686gratuitous split is a split done when no threads are idle, and is a sort of 687preemptive attempt to have work ready for processors as they become idle. If 688this value is set too small, overhead will climb, if it is set too large, then 689gratuitous splits will be rare and thread wait time will climb. 690 691smpgsl sets the maximum number of gratuitous splits allowed per thread. There 692is little point in having many split points that are not really being used, it 693adds to overhead without any real benefit. If you are running on 32 cores, 694then setting this beyond 4 will really be massive overkill since any of the 32 695threads will be able to spontaneously split up to N times each, for a total of 69632 * N gratuitous splits. That's probably excessive. 697<end> 698 699<test> 700test filename [N] [unsolved_file] 701 702Test is used to run a suite of test positions in a batch run. filename is 703the name of the file in crafty test format. [N] is an optional parameter 704that is used to shorten the test time. If crafty likes the solution move 705for [N] consecutive iterations, it will stop searching that position and 706consider it correct. This makes a Win At Chess 60 second run take just a few 707minutes, for example. 708 709The "crafty format" requires three lines per position. The first line must 710be a "title" line and is used to identify each position. The second line is 711a "setboard" command to set the position. The third line is a line that 712begins with "solution", and then is followed by one or more solution moves. 713If a position is correct only if a particular move or moves is *not* played, 714enter the move followed by a "?", as in Nf3?, which means that this position 715will be counted as correct only if Nf3 is not played. 716 717Note that this command may refer to a normal EPD test file as well and 718Crafty will run that test in the same way, but Crafty will notice it is an 719EPD test file rather than a "crafty" test file and handle it appropriately. 720 721A new option to this command is of the form "test filename <margin>" where 722<margin> is greater than 10 (which means it will not be an early exit counter.) 723In this case, Crafty takes that value as a score margin. It will read in the 724FEN/EPD records silently, do a search, and if the absolute value of the final 725score is less than <margin>, the FEN/EPD is written to a new file, 726"filename.screened". I use this to create an opening position file for 727cluster testing where I can create a set of positions using the -DPOSITIONS 728compile option, and then test the resulting "openings.epd" file that creates 729to cull those that are too unbalanced so that the same side wins no matter 730what the skill level. 731 732The [unsolved_file] parameter is optional. If specified, any position that is 733not solved is written to this file so that you can extract "hard" positions and 734use just those for testing later to save time. At one second per move on a 735slow machine, the WAC test positions (300) will produce maybe 15 unsolved 736positions. On good hardware, it might miss five or less. At 5 seconds per 737move, it will usually miss maybe 2-3. At 60 seconds per move, it will 738generally only miss #230 which appears to have no solution after much computer 739analysis (the supposed winning move also draws). 740<end> 741 742<time> 743Time controls whether the program uses CPU time or wall-clock time for 744timing. For tournament play, it is safer to use wall-clock timing, for 745testing it may be more consistent to use CPU timing if the machine is 746used for other things concurrently with the tests being run. (Note that 747this is not recommended when using a multiprocessor machine, CPU time in 748a parallel search increases at N times the normal time rate where N is the 749number of processors being used). 750 751Time is also used to set the basic search timing controls. The general 752form of the command is as follows: 753 754time nmoves/ntime/[nmoves/ntime]/[increment] 755 756nmoves/ntime represents a traditional first time control when nmoves is 757an integer representing the number of moves and ntime is the total time 758allowed for these moves. The [optional] nmoves/ntime is a traditional 759secondary time control. Increment is a feature related to ICS play and 760emulates the Fischer clock where increment is added to the time left 761after each move is made. 762 763As an alternative, nmoves can be "sd" which represents a sudden death 764time control of the remainder of the game played in ntime. The optional 765secondary time control can be a sudden-death time control, as in the 766following example: 767 768time 60/30/sd/30 769 770This sets 60 moves in 30 minutes, then game in 30 additional minutes. 771An increment can be added if desired. 772<end> 773 774<timebook> 775This command is used to adjust the time crafty uses for the first few 776moves out of book. The first few non-book moves are often critical, 777but the usual search time limit will be somewhat short since Crafty 778wants to average the time left over the moves remaining until the 779next time control. This command allows the user to influence how the 780time is allocated on the first few moves out of book. 781 782timebook <factor> <moves> 783 784factor is a number expressed as a percentage, and specifies how much 785extra time (in terms of the normal target time) to use. For example, 786a value of 100 says use 100% extra time, which essentially doubles 787the target time limit. A value of 50 says use 50% extra time, or 7881.5X the normal target time. This applies to the first move out of 789book. 790 791moves indicates the number of moves this extra time will be used. The 792extra time is uniformly "decayed" over those moves. For example a value 793of 10 says use the "factor" extra time on the first non-book move, then 7949/10 of that extra time on the next move, 8/10 on the next move, until 795after 10 moves out of book, where this is turned off. 796 797timebook 100 10 therefore says use 200% of the normal time target for 798the first move out of book, 190% for the next move out of book, until 799it drops back to 100% where it will stick for the remainder of the 800game after the first ten non-book move searches have been completed. 801<end> 802 803<tournament> 804playing in a manually-operated tournament 805 8061. Starting Crafty. This is the easiest part of the whole process. 807All that's needed is to simply type the command "crafty". 808 8092. display. This command displays the chess board using the standard 810chess server style#1 board display. 811 812This is most often used to confirm that the board has been set to the 813proper position in the event that you can't continue an old game and 814have to set up the position from scratch (explained later). Note that 815white is always at the bottom, regardless of whether Crafty is playing 816black or white. 817 8183. read. This command is used to read in a list of moves and make them 819on the game board prior to using crafty to play that game. There are 820two ways this can be used: (a) read. This will prompt you for a 821white move, a black move, over and over until you type "exit" to terminate 822read mode. The side to move will be set according to the number of moves 823entered, so that the next move will be for the correct side. (b) read file. 824This command reads, but the input comes from "file" rather than from the 825keyboard. Note that superfluous text is ignored, as is line numbers, times, 826etc. This will read in a PGN game and cull everything but the moves. 827 8284. setboard. This command is used to set up a specific board position 829when it's impossible to restart a game using the "crafty c" command, and 830too many moves have been made, making the read command an unattractive 831alternative. This command parses a FEN-like position description (a 832Forsythe-like notation) and sets the current board to that position. 833 834The notation uses a string of alpha characters to represent the chess 835position. In this notation, uppercase K Q R B N P represents a white 836piece, lowercase k q r b n p represents a black piece. for empty 837squares, you can use numbers 1-8 to indicate consecutive empty squares. 838A "/" must terminate each rank after defining at most 8 square on that 839rank, and the ranks are entered in descending order 8..1. In this 840notation, then, the first square you enter is a8, then b8, .., h8, 841followed by a "/", then back to a7 and repeating. After all 8 ranks 842are entered, you need to indicate whether or not one side can castle 843kingside or queenside by inserting at least one space character, followed 844by a K (white can castle kingside) Q (white can castle queenside) k (black 845can castle kingside) or Q (black can castle queenside). After this, add 846one more space, followed by the square of a pawn that just moved two ranks 847and is subject to an en passant capture. Note that if there is no 848en passant capture possible, you do not enter this field. 849 850For the above board position (display command), here's the setboard 851command to set that position up: 852 853setboard r2q1knr/pp2bppp/4b3/1BPp4/6PP/2N1P3/PP3P2/2RQK1NR/ K 854 855Note that after entering the last piece on a rank, a number for the 856remaining empty squares is *not* needed, so this could be shortened 857to: 858 859setboard r2q1knr/pp2bppp/4b/1BPp/6PP/2N1P/PP3P/2RQK1NR/ K 860 861One unfortunate effect of this command is that you have just lost the 862ability to detect repetitions of prior positions in the game, which can 863be a critical issue. It is _always_ better to use the read command to 864re-enter the moves if the hardware crashes. If you accidentally type 865^C and terminate Crafty, you can type "crafty c" and it will continue 866the last game, although you will need to set the time control information, 867and anything else that is not in the .craftyrc file. 868 8695. reset <n>. This command is used to back the game up if a different 870move is to be tried, or if an incorrect move was entered by mistake. It 871depends on the current side to move, and the command "reset 13" will back 872the game up to move 13, where the current side on move is still on move, 873and Crafty will be positioned to read in move 13 for that side. Note 874that this affects the game, but not the clock or time or level, so that if 875you back up more than a move or two, you also need to adjust the clock. 876 877If you want to first change the side to move, use the "white" or "black" 878command to set the side to move, then use the reset command to back up 879to the move for that side. 880 8816. time. This command is used to set the time control. There are 882several ways to use it, depending on the type of time control desired. 883(a) time sd/n sets the game to sudden-death in n minutes. such as 884game/10, game/30. time sd/30 would set game in 30 time control. 885(b) time moves/time smoves/stime sets the game to "moves" in "time" 886minutes, then "smoves" in "stime" minutes. A common setting is 887time 40/120/20/60 for 40 moves in 2 hours, then 20 moves in one hour. 888(c) time moves/time/sd/sdtime sets a standard first time control, 889followed by a sudden death time control. For example time 60/60/sd/30 890is 60 moves in 60 minutes followed by game in 30 minutes. (d) for any 891of these, an optional 5th parameter can be added, which is the famous 892"Fischer clock" increment that is added to each players time remaining 893after he makes a move. The increment is given in seconds rather than 894minutes. Note that the default should be right unless the tournament 895modifies the T/C after the tournament starts for some reason. 896 8977. settc. This command is used to correct time-control info after a 898restart. it will prompt you for how much time is left on both Crafty's 899and the opponent's clock, and for how many more moves until crafty makes 900the next time control. Again, usually not needed, but there for serious 901circumstances. After restarting, type "clock" to display this info and 902if it's wrong in any way, this settc command is the quickest way to fix 903it up. 904 9058. clock. This command is used to adjust the internal clock time as it 906drifts away from the real chess clock as a game progresses. The format 907is simply "clock mins" to adjust Crafty's clock. Or "clock cmins omins" 908to adjust both Crafty's time and Crafty's internal time that the opponent 909has left. Since the current version doesn't really need the opponent's 910clock time, it can be ignored with no side-effects. 911 912Common problems and how to solve them: 913 9141. Is crafty searching or pondering? I was not watching the screen, 915and the window size is small enough that all I see is analysis scrolling 916up the screen. This is easy. Look at the bottom line on the screen, and 917you will see a line that keeps changing, showing the depth, time used so 918far, how many moves have been searched and the PV. Look at the third 919column what shows something like 12/30, which says that at the current 920depth crafty has already searched 12 of the 30 legal moves at the root. 921You will notice that there is an extra character after the 30, either a 922"*" or "?". If an "*" is showing, Crafty is thinking about its move. If 923a "?" is showing, crafty is pondering and thinks it is the opponent's move. 924 925If it shows a "?" but you know it is Crafty's move, you simply missed it. 926Scroll back up using whatever scroll mechanism your text window uses, to 927find the move Crafty made. Hopefully this won't happen often, but on the 928occasional "emergency" men's room break, anything can happen. Just remember 929that "?" means I am pondering and it is my opponent's move, "*" means I 930am searching and it is my move. 931 9322. I entered the wrong move, how do I fix this? You are playing in a 933game and at move 37, you enter Rfe1 rather than Rae1. To correct this, 934you have to do a couple of things. First, Crafty is now searching, and 935if you try to reset the position, it won't accept this command. To stop 936the search, type ? (followed by a <RETURN> of course) to tell Crafty to 937"move now". Once it displays the move it would play in response to the 938incorrect move, it will start its "ponder search" but now the reset 939command will work. Simply type "r 37" to back up to move 37, then type 940Rae1 and Crafty will continue as though nothing happened. Pay attention 941to the clock time after it moves and adjust if necessary (if you lost any 942time while correcting an incorrect move.) 943 944Note: You can also use the "remove" command, which will unmake the last 945move by each side. Crafty has to be pondering or waiting on input for 946this to work, just like the reset command, so if *you* typed the wrong 947move, type "?" to make it move, then "remove" which backs up one move 948for each side, followed by the opponent's move. If the opponent makes 949the wrong move on the board, and you enter it, do this same thing. Note, 950if the opponent screws up, you should notice whether or not crafty had 951predicted the right move. If it had, you should probably call the TD 952over, back the game up one move with the remove command, then use the 953"ponder xxx" command to tell crafty to ponder "xxx" (the move it was 954pondering before the wrong move was made by the opponent) and then it 955should be allowed to "sit" until the same amount of time elapses before 956you enter the correct move. The idea is that if the opponent screws up, 957it should not wipe out any searching crafty did while waiting. 958 9593. The machine dies (power failure maybe). How do I recover? First, you 960can stop the clock for such failures, so do that *first*. Then, reboot the 961machine and start crafty by typing "crafty c". Next, type the "history" 962command and carefully check the last move it displays against the score 963sheet you are maintaining by hand. If they are the same, you are ready to 964enter a move and continue. If there are moves missing, use the "reada" 965command to re-enter these moves and append them to the moves already 966present. 967 968If the continue option won't work due to a corrupted history file, you have 969two choices. The best choice is to restart crafty without the "c" option, 970and then use the "read" command and enter the moves by hand so that if you 971screw up later, the "reset" command will work correctly to let you back up. 972If you are 100 moves into a game, this might not be practical. In this 973case, use the "setboard" command to enter the position. Be careful to 974check the position after entry using the display command, and be careful 975to not enter the wrong move since you can't use the "reset" command to 976back up after using the setboard command. 977 978After either of the above problems, you need to set the proper time 979control (if this is in your .craftyrc this is not needed) and then you 980need to adjust the clock to show the proper amount of time remaining. 981The command to display the clock is "clock". To adjust the clock 982use the command form "clock c-time o-time" where c-time is Crafty's 983time remaining, and o-time is the opponent's time remaining. These 984can be entered as simply the number of minutes left, or in the hh:mm 985format if preferred. "clock 60 50" sets Crafty's clock to 60 minutes 986left, opponent's clock to 50 minutes left. "clock 1:15 45" sets 987Crafty's clock to 75 minutes remaining, opponent's clock to 45. 988Crafty pays attention to how much time the opponent has used, 989so be sure and get them both correct. You should subtract 5 minutes 990from the actual time left on the clock to give yourself a cushion. Of 991course, you should *never* enter "0" time left, or even worse, a negative 992number, because Crafty will go south for the Winter if you do. :) 993 994Note that there is a "settc" command that simplifies getting the time 995control right after a restart... It's explained above. 996<end> 997