I decided to distribute my chess program with the hope that people enjoy it in the same way I enjoyed using some other programs I downloaded from the internet. I also hope that distributing TCB will be an opportunity to get feedback from users, which may help to improve it. I would be particularly interested in having opinions about its weaknesses from chess players. Games are also welcome.
TCB is distributed with an interface that will allow users to connect it to internet chess servers. If you want to do it, please do not call it TCB nor TheCrazyBishop (I would like to reserve these names for my personal use), and indicate the URL of this page in its "finger" variables, as well as the hardware you are using.
I will not distribute the source code of TCB. I fear that distributing
it can have unpleasant consequences, such as the risk of meeting a modified
version in a tournament. I think that keeping the code secret is a good
way to preserve the fun of competition, and the magic of computer chess.
Syntax for command lines
~~~~~~~~~~~~~~~~~~~~~~~~
<command> <parameters> [< <input>] [>[>] <output>]
[;<comment>]
Universal commands
~~~~~~~~~~~~~~~~~~
x .............. to close this console interface
p .............. to go to the parent interface
children ....... to list children interfaces
child <n> ...... to select a child interface
echo <params> .. to repeat <params> to the output stream
! [<command>] .. to make a system call
prompt [on|off] to show|hide the command prompt
myself ......... to call recursively this user interface
1. n(00:05:00,00)>chesslib
1. n(00:05:00,00)|ChessLib>pos
1. n(00:05:00,00)|ChessLib/Position>setfen k//K w - -
1. n(00:05:00,00)|ChessLib/Position>p
1. n(00:05:00,00)|ChessLib>pos
1. n(00:05:00,00)|ChessLib/Position>p
1. n(00:05:00,00)|ChessLib>children
1 : Position
2 : Position
1. n(00:05:00,00)|ChessLib>child 2
1. n(00:05:00,00)|ChessLib/Position>fen
k7/8/K7/8/8/8/8/8 w - - 0 1
1. n(00:05:00,00)|ChessLib/Position>p
1. n(00:05:00,00)|ChessLib>child 1
1. n(00:05:00,00)|ChessLib/Position>fen
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
1. n(00:05:00,00)|ChessLib/Position>x
1. n(00:05:00,00)|ChessLib>children
1 : Position
1. n(00:05:00,00)|ChessLib>p
1. n(00:05:00,00)>chesslib
1. n(00:05:00,00)|ChessLib>children
1 : Position
1. n(00:05:00,00)|ChessLib>child 1
1. n(00:05:00,00)|ChessLib/Position>fen
k7/8/K7/8/8/8/8/8 w - - 0 1
1. n(00:05:00,00)|ChessLib/Position>movegen
1. n(00:05:00,00)|ChessLib/Position-MoveGenerator>lml
Ka5 Kb5 Kb6
1. n(00:05:00,00)|ChessLib/Position-MoveGenerator>x
1. n(00:05:00,00)|ChessLib/Position>x
1. n(00:05:00,00)|ChessLib>children
1. n(00:05:00,00)|ChessLib>p
1. n(00:05:00,00)>x
1. n(00:05:00,00)>echo Hello everybody !
Hello everybody !
! is used to make a system call. For instance :
1. n(00:05:00,00)>! dir *.htm
Le volume dans le lecteur E est COMPRESSÉ
Le numéro de série du volume est 1D01-253B
Répertoire de E:\REMI\tcb\WWW
REMI HTM
353 31/01/97 21:48 remi.htm
COPYLIB HTM 26
206 27/01/97 18:08 copylib.htm
TCB HTM
4 808 05/02/97 13:20 tcb.htm
TCBUSER HTM
237 08/02/97 18:16 tcbuser.htm
4 fichier(s)
31 604 octets
0 répertoire(s)
28 000 256 octets libres
prompt on shows the command prompt, prompt off hides it.
myself is a very powerful command that, combined with the <
redirection operator, allows the use of command scripts. For instance,
myself <blitz.cui will read the blitz.cui file and execute
all its commands as if they were typed at the prompt.
(@n)EngineControl>
(@i) for infinite gear, (@a) for active gear, (@p) when pondering, ...
All engine listener console interfaces share the same command:
Engine Listener Commands
~~~~~~~~~~~~~~~~~~~~~~~~
wait [on|off] ... set wait mode
The wait mode indicates whether the prompt is printed right away after
the completion of the previous command. If the wait mode is off, the engine
loops until the user has pressed a key before printing the prompt. This
behaviour is the only way to have the GUI work correctly. As soon as a
prompt is printed and the program is waiting for user input on the console,
all other windows of the program freeze. If you want to use windows and
they are frozen, make sure you are in a listener interface (with a @ in
the prompt) and that the wait mode is on. If it is the case then just enter
an empty command in the console and the windows should behave normally.
The tcbxinit.cui file that is distributed with tcb gives an example
of initialization file that can be used to set parameters for a game with
WinBoard. Passing tcbxinit.cui to tcb on the command line (i.e.
calling "tcb tcbxinit.cui") will set search parameters as specified
in the file.
(@n)EngineControl>board
EngineControl-Window>win on
on
EngineControl-Window>x
(@n)EngineControl>tournament
(@n)EngineControl|Tournament>gaum a
Active
(@n)EngineControl|Tournament>gacm p
Ponder
To start the game as White, simply enter moves on the board by dragging
a piece with the mouse or enter a move at the command prompt. To let the
computer play the first move, you can use the setgear a command.
The ? command will give you a list of useful commands that can
be used to set other parameters. Board parameters can be set by right-clicking
on the board window to open a pull-down menu.
(@n)EngineControl>engine
EngineControl-Engine>wtc
Time controls can be set independently for White and Black. This example will set the time control for White only.
EngineControl-Engine-TimeControl>disp
Moves ............: 0
fResetClock ......: 0
Total time .......: 00:05:00,00
Time per move ....: 00:00:07,00
Next time control : no
This is the default time control : all moves in 5 minutes with 7 seconds per move
EngineControl-Engine-TimeControl>setmoves 40
EngineControl-Engine-TimeControl>settotal 01:00:00
EngineControl-Engine-TimeControl>setpermove 00:00:00
EngineControl-Engine-TimeControl>disp
Moves ............: 40
fResetClock ......: 0
Total time .......: 01:00:00,00
Time per move ....: 00:00:00,00
Next time control : no
The time control is now 40 moves in 1 hour, with one more hour of time to play added every 40 moves.
EngineControl-Engine-TimeControl>setreset
EngineControl-Engine-TimeControl>createnext
EngineControl-Engine-TimeControl>next
EngineControl-Engine-TimeControl-TimeControl>setmoves 0
EngineControl-Engine-TimeControl-TimeControl>settotal 00:05:00
EngineControl-Engine-TimeControl-TimeControl>setpermove 0
EngineControl-Engine-TimeControl-TimeControl>disp
Moves ............: 0
fResetClock ......: 0
Total time .......: 00:05:00,00
Time per move ....: 00:00:00,00
Next time control : no
EngineControl-Engine-TimeControl-TimeControl>x
EngineControl-Engine-TimeControl>disp
Moves ............: 40
fResetClock ......: 1
Total time .......: 01:00:00,00
Time per move ....: 00:00:00,00
Next time control : yes
Now, the time control is 40 moves in 1 hour. After 40 moves, the clock
is reset and the rest of the game must be played in 5 minutes.
special
size 10000000
x
This will use approximately 10 megabytes of memory for hash tables.
It is very important to make sure that you have enough memory available
to store the entire hash table. If the hash table is too big then memory
will be swapped to the disk, slowing down the program considerably.
(@n)EngineControl>special
EngineControl-TCB>pgnbook <book.pgn
.....
9512 bytes
EngineControl-TCB>x
(@n)EngineControl>
Loading the book with the pgnbook command may take some time if the file is big. Dots indicate the progress of this operation. When it is over, the number of bytes used by the book in memory is indicated. Note that you should load the opening book before setting hash table sizes, because the operation of loading the book can temporarily use a lot of memory.
Only the first game of the PGN file is read. This game should contain variations and NAGs (Numeric Annotation Glyphs, like ?, ??, ?!, ...) indicating bad moves. Moves without a NAG are considered as good. Moves with a NAG are considered as bad (even if the NAG is !). TCB chooses at random between all good moves in a position, with an equal probability for every move.
TCB provides a lot of functions that can help in building or editing books. Below are some examples of what can be done.
e4 (d4 (a3? e5) d5 (a5? e4)) e5 *
EngineControl|ChessLib-Game>pgn 3 >mybook.pgn
EngineControl|ChessLib-Game>x
EngineControl|ChessLib>p
(@n)EngineControl>
Of course, these commands can be used to edit an existing opening book. For instance, to remove the French defense from book.pgn and write the result in newbook.pgn :
EngineControl|ChessLib-Game>readpgn <book.pgn
EngineControl|ChessLib-Game>cursor
EngineControl|ChessLib-Game-GameCursor 1. d4>nextvar
EngineControl|ChessLib-Game-GameCursor 1. e4>next
EngineControl|ChessLib-Game-GameCursor 1... e5>nextvar
EngineControl|ChessLib-Game-GameCursor 1... c5>nextvar
EngineControl|ChessLib-Game-GameCursor 1... e6>nag 2
EngineControl|ChessLib-Game-GameCursor 1... e6?>x
EngineControl|ChessLib-Game>pgn 3 >newbook.pgn
TCB supports two file formats for endgame databases : the old format by Steven J. Edwards and the new improved format by Eugene Nalimov. You can use both at the same time. TCB will first try to find the file in the new format. If it is not available, it will try to use the old format instead. Note that you should not use files in the old format that have pawns on both sides. They have errors because en passant captures were not handled correctly. The new format is also significantly more compact.
Besides the instructions below, another parameter you can tune (it is the same for both formats) is the search depth in hundredth of a ply at which endgame databases are not used any more. The default should be 400. You should increment this value to 500 or 600 if you read the files from a slow drive or through a network, for instance.
special
tblist
add c:\tb\kqk.tbw
add c:\tb\kqk.tbb
add c:\tb\krk.tbw
add c:\tb\krk.tbb
;(...)
x
x
(@n)EngineControl>chesslib
EngineControl|ChessLib>nalimov
EngineControl|ChessLib-Nalimov>init h:\echecs\nalimov
EngineControl|ChessLib-Nalimov>cache 1000000
1000000
EngineControl|ChessLib-Nalimov>x
EngineControl|ChessLib>p
(@n)EngineControl>
If the cache size is not large enough, tablebases will not be used. 1000000 should be a good default. You might like to use a different value depending on your hardware and the set of tables you have. You can see a commented initialization script in the file tcbxinit.cui which is included in the distribution.
EGTB files can be downloaded from Robert Hyatt's ftp site.
(@n)EngineControl>chesslib
EngineControl|ChessLib>! dir wm*.pgn
Le volume dans le lecteur C est MS-DOS_62
Le numéro de série du volume est 104C-13E8
Répertoire de C:\WINDOWS\Bureau\WMCC
WMCC15 PGN 163 367
02/11/97 15:19 WMCC15.PGN
1 fichier(s)
163 367 octets
0 répertoire(s)
59 047 936 octets libres
EngineControl|ChessLib>pgnfile wmcc15.pgn
EngineControl|ChessLib-GameFile>games
187
EngineControl|ChessLib-GameFile>list
[...]
182 1997.11.02 IsiChess / K6-200 AnMon / K6-200
15th WMCC
183 1997.11.02 MChess 7.0 / K6-2 Shredder 2.0 / Al 15th WMCC
184 1997.11.02 SOS / K6-200 Gandalf
/ K6-200 15th WMCC
185 1997.11.02 Toledo 2000 / P2- Crafty / Alpha 50 15th WMCC
186 1997.11.02 Woodpusher / K6-2 Diep / P2-300
15th WMCC
EngineControl|ChessLib-GameFile>load 183
EngineControl|ChessLib-GameFile-Game>pgn
[Event "15th WMCC"]
[Site "Paris"]
[Date "1997.11.02"]
[Round "11"]
[White "MChess 7.0 / K6-233"]
[Black "Shredder 2.0 / Alpha 533"]
[Result "0-1"]
1. e4 c5 2. Nf3 d6 3. Bc4 Nf6 4. e5 dxe5 5. Nxe5 e6 6. d3 Bd6 7.
Ng4 Nbd7 8.
Bg5 Qb6 9. Nxf6+ gxf6 10. Bc1 Qc6 11. f3 b5 12. Bb3 Qc7 13. Nc3
Ba6 14. g3 c4
15. dxc4 bxc4 16. Ba4 O-O-O 17. Bb5 Bxb5 18. Nxb5 Bb4+ 19. c3 Qe5+
20. Qe2 Qxb5
21. cxb4 Qxb4+ 22. Kf1 Ne5 23. Be3 h5 24. Rc1 Nd3 25. Rc2 Kb8 26.
Rg1 Rhg8 27.
b3 c3 28. Kg2 Rd5 29. Rd1 Rgd8 30. Rb1 Ka8 31. a3 Qb5 32. Kh1 Qc6
33. b4 Rf5
34. Rf1 Qc4 35. Rfc1 Qb3 36. Rxc3 Nxc1 37. Rxc1 Qd3 38. Qf2 Re5
39. Re1 Qxa3
40. f4 Red5 41. b5 Qa5 42. Kg2 Qxb5 43. Ra1 a6 44. Kh3 Rd3 45.
Kh4 a5 46. Qe2
Rb3 47. Qe1 a4 48. Bg1 Kb8 49. Qf2 Qd7 50. Qc2 e5 51. f5 Rb4+ 52.
Kh3 h4 53.
Bc5 Rb3 54. Qe4 hxg3 55. hxg3 Rb2 56. Ba3 Rh8+ 57. Kg4 0-1
EngineControl|ChessLib-GameFile-Game>copy
EngineControl|ChessLib-GameFile-Game>x
EngineControl|ChessLib-GameFile>x
EngineControl|ChessLib>p
(@n)EngineControl>tournament
(@n)EngineControl|Tournament>engcurs
EngineControl|Tournament-EngineCursor>setgame
EngineControl|Tournament-EngineCursor-Game>paste
EngineControl|Tournament-EngineCursor-Game>x
a b c d e f g h
8 r n b q k b n r 8
7 = = = = = = = = 7
6 . . . .
6
5 . . .
. 5
4 . . . .
4
3 . . .
. 3
2 # # # # # # # # 2
1 R N B Q K B N R 1
a b c d e f g h
EngineControl|Tournament-EngineCursor>cursor
EngineControl|Tournament-EngineCursor-GameCursor 1. e4>next 1000
EngineControl|Tournament-EngineCursor-GameCursor 57... >x
a b c d e f g h
8 . k . . . r 8
7 . q =
. 7
6 . . . = .
6
5 . . = # .
5
4 = . Q K
4
3 B . . . # . 3
2 . r . . .
2
1 R . . . .
1
a b c d e f g h
EngineControl|Tournament-EngineCursor>x
(@n)EngineControl|Tournament>
(@n)EngineControl|Tournament>setgear i
00:00:00,00 1 ------
Depth = 1
00:00:00,00 1
-377 57... Qxf5+
00:00:00,00 1
+231 57... Ka7
00:00:00,00 1
+231 57... Ka7
00:00:00,00 1
+236 57... Rg8+
00:00:00,05 1
+419 57... Rg8+
00:00:00,05 2 ------
Depth = 2
00:00:00,05 2
+419 57... Rg8+ 58. Kh3 Rh8+
00:00:00,05 3 ------
Depth = 3
00:00:00,22 3
+493 57... Rg8+ 58. Kh3 Rb3 59. Kh2
00:00:00,27 4 ------
Depth = 4
00:00:00,33 4
+499 57... Rg8+ 58. Kh3 Rb3 59. Bc5 Rgxg3+
00:00:00,55 5 ------
Depth = 5
00:00:01,21 5
+503 57... Rg8+ 58. Kh3 Rb3 59. Bb4 Rgxg3+ 60. Kh2 Rh3+
00:00:01,76 6 ------
Depth = 6
(@i)EngineControl|Tournament>p
(@i)EngineControl>chesslib
EngineControl|ChessLib>epdfile e:\echecs\tests\wac.epd
EngineControl|ChessLib-GameFile>load 1
EngineControl|ChessLib-GameFile-Game>copy
EngineControl|ChessLib-GameFile-Game>x
EngineControl|ChessLib-GameFile>x
EngineControl|ChessLib>p
(@i)EngineControl>tournament
(@i)EngineControl|Tournament>engcurs
EngineControl|Tournament-EngineCursor>setgame
EngineControl|Tournament-EngineCursor-Game>paste
EngineControl|Tournament-EngineCursor-Game>x
a b c d e f g h
8 . . . .
8
7 . . .
= 7
6 . . . k .
6
5 . . =
. 5
4 = = . # .
4
3 # r = # K . 3
2 . # . R . . # 2
1 . . .
. 1
a b c d e f g h
EngineControl|Tournament-EngineCursor>
Note also that if you want to browse a list of games from a big pgn file, you can redirect the output of the list command to a file and browse it with any text viewer. For instance, to view the list of games of the wmcc15.pgn file under Windows95, you can enter the commands below :
EngineControl|ChessLib>pgnfile wmcc15.pgn
EngineControl|ChessLib-GameFile>list >list.txt
EngineControl|ChessLib-GameFile>! start list.txt
Multiple mode commands
~~~~~~~~~~~~~~~~~~~~~~
movelist ........ get the move list
resetlist ....... remove all moves from the move list
addlist <move> .. add <move> to the move list
nbest [n] ....... get [set] number of moves of n-best mode
threshold [eval] get [set] evaluation threshold in centipawns
mflags [flags] .. get [set] multiple mode flags :
1 : n best moves
2 : all moves
4 : moves from the move list
8 : moves > best - threshold
The mflags option can be a combination of these values. It can be interesting in a positionnal test to analyze 1 best move + the key move. For instance, you can analyze the best move of the starting position and 1. f4 like this :
(@n)EngineControl>tournament
(@n)EngineControl|Tournament>engine
EngineControl|Tournament-Engine>addlist f4
EngineControl|Tournament-Engine>nbest 1
1
EngineControl|Tournament-Engine>mflags 5
5
EngineControl|Tournament-Engine>setgear m
EngineControl|Tournament-Engine>x
[...]
00:00:02,64 60 ------
Depth = 4
00:00:02,64 61
+7 1. e4 Nf6 2. Nc3 e5
00:00:02,69 62
+7 1. d4 Nf6 2. Nf3 d5
00:00:02,69 63
+7 1. Nf3 Nf6 2. d4 d5
00:00:02,75 67
-9 1. f4 d5 2. Nf3 Nf6
[...]
You can notice in this example that in case of "1 best" mode, TCB will
analyze more than one best moves if they have the same evaluation.