Subversion Repositories Games.Chess Giants

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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