debian/0000775000000000000000000000000012132326604007167 5ustar debian/crafty.60000664000000000000000000001720411475172007010557 0ustar .TH crafty 6 "December 22, 2003" "Crafty 19.8" "" .SH NAME crafty - chess engine .RE \fB .SH SYNOPSIS .nf .fam C \fBcrafty\fP [\fBbookpath=\fP<\fIdirectory\fP>] [\fBlogpath=\fP<\fIdirectory\fP>] [\fBtbpath=\fP<\fIdirectory-list\fP>] .RE .PP .fam T .fi .SH DESCRIPTION \fBCrafty\fP is a chess "engine". That is, the program concerns itself with playing chess and not with providing a graphic user interface. Thus \fBCrafty\fP is commonly invoked indirectly via \fBXBoard\fP, and current versions of these programs generally work very well together. Some noteworthy features of \fBCrafty\fP are: .IP * 3 Source code, provided, is unusually deserving of study. The author has sought to provide a starting point for others writing chess-playing programs, leading to clean and portable code. Another objective has been to maintain a state-of-the-art chess engine, with the result that some parts of the source code may be challenging to understand. .IP * 3 Flexible and powerful command-line interface. About the only thing that can \fInot\fP be done within the CLI is changing various paths determining where \fBCrafty\fP reads and writes various files. This manual page focuses on explaining these paths. .IP * 3 Easy graphic user interface via \fBxboard\fP(6). .IP * 3 Informative log files. Writes "game.nnn" file storing current game in PGN format, and also writes "log.nnn" file recording what the engine was "thinking". .IP * 3 Intelligent opening play. \fBCrafty\fP learns from experience, and makes appropriate modifications to its opening book. The "book" command allows generation of an opening book (from PGN data), and customization of how it is used. The learning facilities synthesize several different approaches, and allow various ways for the user to customize and follow what is being learned. Additional commands allow easy creation of files to customize how \fBCrafty\fP plays the opening against humans and against other computer programs. .IP * 3 Uses endgame tablebases. Precompiled tablebases in the appropriate format are freely downloadable from ftp://ftp.cis.uab.edu/hyatt/TB. .IP * 3 Polished and powerful facilities for Internet play (for which the program continues to be extensively used). Note that the licencing forbids concealing Crafty under another name, or unauthorized entry of it in a tournament in which other computer programs have been invited to compete. .IP * 3 Annotation. Generates either PGN or HTML files, in a manner made very flexible by choosing appropriate aptions to the "annotate | annotateh" command. .RE .PP .SH OPTIONS In the command line arguments, <\fIdirectory-spec\fP> is a path to a directory, whereas <\fIdirectory-list\fP> is a non-empty sequence of paths to directories. For portability, several different characters are taken as path separators: the colon (:), the semicolon (;), and the comma (,). .PP There are actually four of these: \fBbookpath\fP is where Crafty seeks its opening books and writes learned knowledge; \fBlogpath\fP is where Crafty normally writes a pair of files "game.nnn" and "log.nnn" for each game it plays; \fBrcpath\fP is where Crafty looks for a run control file to be read only; and \fBtbpath\fP is where Crafty looks for endgame tablebase files to be read only. .PP The four path specifications have a number of things in common: each has a default value set when \fBCrafty\fP is compiled, which can then be modified by the appropriate environment variable, and can then again be modified by an invocation argument, but can \fInot\fP be modified after the engine has been initialized (thus, in particular, it is not possible to modify the paths by editing a run control file). Possibly the best procedure is to avoid the invocation options, experiment with the environment variables, and then perhaps recompile the program with different defaults. Note that if the program is compiled "out of the box" then all four values default to "./" (the directory in which \fBCrafty\fP has been launched). .PP Crafty can be invoked with other arguments (such as "xboard" to indicate that Crafty is being invoked through \fBxboard\fP(6)) which would not usually be used directly. .RE .PP .SH COMMANDS \fBCrafty\fP's extensive command-line interface is defined in "option.c", discussed in "crafty.doc", and briefly described by the command "help". .RE .PP .SH FILES .SS Run control Crafty tries to read a run control file \fBrcpath\fP/.craftyrc. (On a non-Unix system, ".craftyrc" changes to "crafty.rc".) Such a file should contain a sequence of valid Crafty commands, terminated by the command "exit" to restore standard input to the keyboard. See \fBcraftyrc\fP(5) for a skeletal example. .RE .PP .SS Logging When a game is played, Crafty normally writes "\fBlogpath\fP/game." and "\fBlogpath\fP/log.". Details of what is written are modifiable by the `log' command. Because $CRAFTY_LOG_DIR defaults to "./" (the directory in which Crafty is launched), trouble can occur if the program is launched in a directory to which it is unable to write. Note that the "log." file normally contains all output that would be visible if \fBCrafty\fP were run from the command line but is usually hidden when it is run from a GUI. .RE .PP .SS Opening books Crafty is designed to maintain its chess opening knowledge in a file "book.bin", and to modify this file as it learns from its mistakes. Refer to the documentation for the "book" command for information on generating and customizing usage of "book.bin". .PP Further, files "books.bin" and "bookc.bin" allow easy customization of Crafty's opening play (against humans and computer, respectively). See the documentation for the "books" command. .PP Finally, there are several files "*.lrn" for synopses of what Crafty has been learning. See the documentation for the "learn" command. .RE .PP .SS Endgame tablebases When normally configured, Crafty reads late endgame knowledge from "*.emd" files, which are distance-to-mate tablebases. See the documentation for the "egtb" command. .RE .PP .SH ENVIRONMENT VARIABLES .SS CRAFTY_BOOK_PATH If \fB$CRAFTY_BOOK_PATH\fP is set, it overrides the compiled value of \fBbookpath\fP, the path to directory containing "book.bin" and friends. Unless learning has been disabled, Crafty will be writing in this directory. .RE .PP .SS CRAFTY_LOG_PATH If \fB$CRAFTY_LOG_PATH\fP is set, it overrides the compiled value of \fBlogpath\fP, the path to directory for writing, but not reading, the log files. .RE .PP .SS CRAFTY_RC_PATH If \fB$CRAFTY_RC_PATH\fP is set, it overrides the compiled value of \fBrcpath\fP, the path to directory for reading, but not writing, a run control file (".craftyrc" or "crafty.rc"). .RE .PP .SS CRAFTY_TB_PATH If \fB$CRAFTY_TB_PATH\fP is set, it overrides the compiled value of \fBtbpath\fP, the sequence of paths to directories for reading, but not writing, endgame tablebase files. .RE .PP .SH SEE ALSO \fBcraftyrc\fP(5), \fBxboard\fP(6), /usr/share/doc/crafty .RE .PP .SH HISTORY \fBCrafty\fP is the son of \fBCray Blitz\fP, also written by Bob Hyatt. The subsequent history of \fBCrafty\fP is detailed in the source file "main.c". Opening books appeared in version 1.9. log files in 1.11, endgame tablebases in 8.24, run control files in 9.22, and environment variables in 16.5. .RE .PP .SH BUGS In the interests of portability, \fBCrafty\fP deals with files in a simple manner, at the cost of robustness. Very long or incorrect paths may result in a "segmentation fault" when a file writing operation fails. This manual page itself will probably always be flagrantly incomplete in that many essential, powerful, and interesting aspects of \fBCrafty\fP are not even mentioned. .SH AUTHOR Robert Hyatt (hyatt@cis.uab.edu). .RE .PP debian/patches/0000775000000000000000000000000012132326500010611 5ustar debian/patches/01-Makefile.dpatch0000664000000000000000000000526611645644171013761 0ustar #! /bin/sh /usr/share/dpatch/dpatch-run ## 01-Makefile.dpatch by Oliver Korff ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: This patch adds a linux-generic target to be used in other architectures. ## DP: The linux target was patched to include the -DINLINE32 switch ## DP: Some variables used in the binary were preset, for detailes see line 17ff ## DP: Disabled profiling -pg switch for the linux target @DPATCH@ --- a/Makefile +++ b/Makefile @@ -38,6 +38,38 @@ # -DTRACE N This enables the "trace" command so that the search tree # can be dumped while running. +#Edited for Debian GNU/Linux +DESTDIR = +BIN = $(DESTDIR)/usr/games +BOOKS = $(DESTDIR)/var/lib/crafty +DOC = $(DESTDIR)/usr/share/doc +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) + CFLAGS += -g +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL += -s +endif + +# Next option allows to build the package with debugging information. +# DEB_BUILD_OPTIONS=debug # This allows the generation of a build tree with +# debugging information. + +#Edited for Debian GNU/Linux +DESTDIR = +BIN = $(DESTDIR)/usr/games +BOOKS = $(DESTDIR)/var/lib/crafty +DOC = $(DESTDIR)/usr/share/doc +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) + CFLAGS += -g +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL += -s +endif + +# Next option allows to build the package with debugging information. +# DEB_BUILD_OPTIONS=debug # This allows the generation of a build tree with +# debugging information. + default: $(MAKE) linux-64 help: @@ -129,13 +161,21 @@ linux: $(MAKE) target=LINUX \ CC=gcc CXX=g++ \ - CFLAGS='-pg -Wwrite-strings -Wcast-qual -Wshadow \ - -Wconversion -W -Wall -ansi -pedantic -pipe' \ + CFLAGS='-pg -Wwrite-strings -Wcast-qual -Wshadow -Wconversion -W -Wall -pedantic -pipe' \ CXFLAGS='' \ - LDFLAGS='$(LDFLAGS) -pg -lstdc++ -lpthread' \ - opt='$(opt) -DTRACE -DINLINE64 -DCPUS=2' \ + LDFLAGS='$(LDFLAGS) -lstdc++ -lpthread' \ + opt='$(opt) -DTRACE -DINLINE32 -DCPUS=2' \ crafty-make +linux-generic: + $(MAKE) target=LINUX \ + CC=gcc CXX=g++ \ + CFLAGS='$(CFLAGS) -Wall -pipe -O3 -fno-gcse' \ + CXFLAGS='$(CFLAGS)' \ + LDFLAGS='$(LDFLAGS) -lpthread -lstdc++' \ + opt='$(opt) -DCPUS=2' \ + crafty-make + linux-profile: $(MAKE) target=LINUX \ CC=gcc CXX=g++ \ @@ -335,7 +375,7 @@ crafty.o: *.c *.h crafty: $(objects) egtb.o - $(CC) $(LDFLAGS) -o crafty $(objects) egtb.o -lm $(LIBS) + $(CC) -o crafty $(objects) $(LDFLAGS) egtb.o -lm $(LIBS) egtb.o: egtb.cpp $(CXX) -c $(CXFLAGS) $(opts) egtb.cpp debian/patches/95-spelling-thanks-lintian.dpatch0000664000000000000000000000103611513146650017000 0ustar #! /bin/sh /usr/share/dpatch/dpatch-run ## 95-spelling-thanks-lintian.dpatch by Oliver Korff ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Spelling correction, thanks to litian for annoing everybody @DPATCH@ --- a/option.c +++ b/option.c @@ -1514,7 +1514,7 @@ nargs--; targs++; } else - printf("error, name must be preceeded by +/- flag.\n"); + printf("error, name must be preceded by +/- flag.\n"); nargs--; targs++; } debian/patches/20-use-g++.patch0000664000000000000000000000073012132326500013217 0ustar Index: crafty-23.4/Makefile =================================================================== --- crafty-23.4.orig/Makefile 2013-04-13 15:05:28.000000000 -0400 +++ crafty-23.4/Makefile 2013-04-13 15:08:43.607764247 -0400 @@ -375,7 +375,7 @@ crafty.o: *.c *.h crafty: $(objects) egtb.o - $(CC) -o crafty $(objects) $(LDFLAGS) egtb.o -lm $(LIBS) + $(CXX) -o crafty $(objects) $(LDFLAGS) egtb.o -lm $(LIBS) egtb.o: egtb.cpp $(CXX) -c $(CXFLAGS) $(opts) egtb.cpp debian/patches/10-crafty-hlp.patch0000664000000000000000000000107311645645552014145 0ustar Description: Use FHS compliant paths by default Author: Oliver Korff Last-Update: 2011-10-13 --- a/option.c +++ b/option.c @@ -1093,9 +1093,9 @@ char *readstat = (char *) -1; int lines = 0; - helpfile = fopen("crafty.hlp", "r"); + helpfile = fopen("/usr/share/doc/crafty/crafty.hlp", "r"); if (!helpfile) { - printf("ERROR. Unable to open \"crafty.hlp\" -- help unavailable\n"); + printf("ERROR. Unable to open \"/usr/share/doc/crafty/crafty.hlp\" -- help unavailable\n"); return (1); } if (nargs > 1) { debian/patches/03-numacompat1.dpatch0000664000000000000000000000065511513264771014466 0ustar #! /bin/sh /usr/share/dpatch/dpatch-run ## 03-numacompat1.dpatch by ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: A missing include for numacompat1.h is set by this patch. @DPATCH@ --- a/main.c +++ b/main.c @@ -7,6 +7,7 @@ #endif #if defined(NUMA) && defined(LINUX) # include +# include #endif #include /* last modified 11/05/10 */ debian/patches/01-annotate.patch0000664000000000000000000000133211645645643013704 0ustar Description: Use FHS compliant paths by default Author: Oliver Korff Last-Update: 2011-10-13 --- a/annotate.c +++ b/annotate.c @@ -568,7 +568,7 @@ for (rank = RANK8; rank >= RANK1; rank--) { fprintf(annotate_out, "\n"); for (file = FILEA; file <= FILEH; file++) { - (void) strcpy(filename, "bitmaps/"); + (void) strcpy(filename, "/usr/share/crafty-bitmaps/"); if ((rank + file) % 2) (void) strcat(filename, "w"); else @@ -628,7 +628,7 @@ strcpy(alt, " "); break; } - strcat(filename, ".gif"); + strcat(filename, ".png"); fprintf(annotate_out, "\"%s\"\n", alt, filename); } debian/patches/02-security-203541.dpatch0000664000000000000000000000332611513264771014641 0ustar #! /bin/sh /usr/share/dpatch/dpatch-run ## 02-security-203541.dpatch by ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Don't strcpy argv[1] @DPATCH@ --- a/main.c +++ b/main.c @@ -3954,7 +3954,10 @@ if (argc > 1) { for (i = 1; i < argc; i++) { if (strstr(argv[i], "path") || strstr(argv[i], "log")) { - strcpy(buffer, argv[i]); + //This is a security flaw (see http://bugs.debian.org/203541 + //strcpy(buffer, argv[i]); + memset(buffer,'\0',sizeof(buffer)); + strncpy(buffer,argv[i],sizeof(buffer)-1); result = Option(tree); if (result == 0) printf("ERROR \"%s\" is unknown command-line option\n", buffer); @@ -4033,7 +4036,10 @@ for (i = 1; i < argc; i++) if (strcmp(argv[i], "c")) if (!strstr(argv[i], "path")) { - strcpy(buffer, argv[i]); + //This is a security flaw (see http://bugs.debian.org/203541 + //strcpy(buffer, argv[i]); + memset(buffer,'\0',sizeof(buffer)); + strncpy(buffer,argv[i],sizeof(buffer)-1); result = Option(tree); if (result == 0) printf("ERROR \"%s\" is unknown command-line option\n", buffer); @@ -4062,11 +4068,16 @@ */ #if defined(UNIX) input_stream = fopen(".craftyrc", "r"); - if (!input_stream) + if (!input_stream) { if ((pwd = getpwuid(getuid()))) { sprintf(path, "%s/.craftyrc", pwd->pw_dir); input_stream = fopen(path, "r"); } + if (!input_stream) { + sprintf (path, "%s/crafty.rc", rc_path); + input_stream = fopen (path, "r"); + } + } if (input_stream) #else sprintf(crafty_rc_file_spec, "%s/crafty.rc", rc_path); debian/patches/series0000664000000000000000000000023412132326277012040 0ustar 01-Makefile.dpatch 02-security-203541.dpatch 03-numacompat1.dpatch 95-spelling-thanks-lintian.dpatch 01-annotate.patch 10-crafty-hlp.patch 20-use-g++.patch debian/docs0000664000000000000000000000015411475172007010047 0ustar crafty.hlp debian/doc/FAQ.txt debian/doc/readme.txt debian/doc/documentation.txt debian/doc/setup_crafty.sh debian/doc/0000775000000000000000000000000011475172007007741 5ustar debian/doc/FAQ.txt0000664000000000000000000002547611475172007011127 0ustar Frequently asked questions (FAQ) on Crafty. Last modified on 1996.06.17 Send corrections/additions/comments to: Anil Mungal (amungal@vnet.ibm.com) ----- [1] What is Crafty? [1.1] What platforms can Crafty run on? [1.2] What is Crafty's rating/strength? [1.3] Where can I get Crafty? [1.4] How do I build Crafty? [1.5] How do I build Crafty's Book? [1.6] How can I maximize Crafty's performance? [1.7] What are "tablebases" and how do I use 'em? [1.8] How can I get a graphical interface with Crafty? [1.9] How can I use both Crafty and XBoard to analyze positions/games? ----- [1] What is Crafty? Crafty is a chess program written by Bob Hyatt (hyatt@cis.uab.edu). It is modeled after Cray Blitz (also written by Bob). Crafty has the following features: - written in C - can be compiled with the GNU C compiler on various platforms - has a customizable opening book - supports tablebases (Steven Edward's endgame database) - text interface Crafty is a work in progress, and is frequently updated/enhanced by Bob. ----- [1.1] What platforms can Crafty run on? The decision to write Crafty so that it compiles with the GNU C compiler allows it to run on many platforms without the hassle of porting. (Thanks Bob) Currently Crafty runs on: - DEC alpha running OSF/1-Digital Unix - any Cray-1 compatible architecture including XMP, YMP, C90, etc. - HP workstation running HP_UX operating system (unix) - PC running DOS, Windows, or OS/2 Warp, using DJGPP port of gcc to compile - RS/6000 running AIX (unix) - Sun SparcStation running Solaris (SYSV/R4) Unix - Sun SparcStation running SunOX (BSD) Unix - Any architecture running the Linux operating system - Microsoft Win95/WinNT, when compiled with Microsoft Visual C++ - Macintosh and other MacOS-compatible computers Storage requirements range from 1Mb (small book and no tablebase) to 60Mb (largest book and no tablebases) to 300Mb (largest book and all tablebases). ----- [1.2] What is Crafty's rating/strength? Crafty's strength is directly dependant upon processor speed, hash table size, size and content of it's opening book, and it's use of an endgame database. Versions of Crafty running on ICC and FICS have ratings around 2500-2700. This does not necessarily mean that Crafty will perform at this level under tournament conditions. Crafty's computational power in nodes/sec has been measured as follows: Platform Nodes/sec -------- --------- DEC alpha running OSF/1-Digital Unix 75,000 Cray-1 XMP, YMP, C90, etc. ?????? HP workstation running HP_UX operating system 35,000 80X86 architecture running LINUX (unix) 30,000 (P5/133) Pentium 100 PC 24,000 Pentium Pro 200 PC 75,000 RS/6000 running AIX (unix) ?????? Sun SparcStation running Solaris (SYSV/R4) Unix 30,000 (Sparc-20) According to the Louget Chess test, Crafty has been given the following ratings: Platform Hash table Louget rating (comparable to FIDE rating) ======== ========== ============= Crafty v9.21 PP200 56 MB 2395 Crafty v9.21 PP150 56 MB 2365 Crafty v9.21 P133 14 MB 2305 Crafty v9.21 P90 7 MB 2235 Where the platforms were: PP200 = Pentium Pro 200 Mhz, 16+256KB internal caches, Aurora Intel motherboard PP150 = Pentium Pro 150 Mhz, 16+256KB internal caches, Asustek motherboard P133 = Pentium 133 Mhz, 256 KB pipeline burst synchronous L2 cache P90 = Pentium 90 Mhz, 256 KB asynchronous cache (Intel Zappa, Triton Chipset) For more info on the Louget Chess test, you can contact: Frederic Louguet (louguet@worldnet.net) ---- [1.3] Where can I get Crafty? You can get Crafty by anonymous FTP at: ftp://news.cis.uab.edu/pub/hyatt Here is a description of the files that you will probably see. read.me : Read me file that Bob updates crafty.exe : PC DOS executable. (needs DPMI) craftyt.exe : PC DOS executable with tablebases support. (needs DPMI) crafty.faq : this file crafty.linux : Linux executable crafty.sun : Sun Sparc-20 executable crafty.zip : Crafty source code crafty.tar.Z : Crafty source code crafty.tar.gz : Crafty source code cwsdpmi.exe : DPMI provider large1.zip : Large PGN file used to create an opening book (1/4) large2.zip : Large PGN file used to create an opening book (2/4) large3.zip : Large PGN file used to create an opening book (3/4) large4.zip : Large PGN file used to create an opening book (4/4) medium.zip : Medium PGN file used to create an opening book small.zip : Small PGN file used to create an opening book start.zip : Tiny PGN file used to create an opening book probs.Z : A test suite of chess problems wcrafty.exe : Windows executable. wcraftyt.exe : Windows executable with tablebases support. The Macintosh port of Crafty is available from . The Mac versions are supported from . ----- [1.4] How do I build Crafty? If you wish to build Crafty for yourself, you need a copy of the source and the GNU C compiler (or the djgpp compiler for DOS) to compile. a) Unzip/uncompress the source code. b) Follow the instructions in the Makefile. You will probably have to: - comment/uncomment sections based on your hardware platform. - edit the directory paths. - add whatever optimization flags that you want. c) type make ----- [1.5] How do I build Crafty's Book? You need an executable version of Crafty and a PGN file to build it's book. Choose between large (unzip large1.zip, large2.zip, large3.zip, large4.zip and append them into one file), medium (unzip medium.zip), or small.zip (unzip small.zip). Large produces a 90Mb-60Mb opening database with 100K GM games; medium produces a 30Mb database, and small will produce a 1Mb database. Note that you will need at least double this space to create the files, since temporary files are written to disk, and then later deleted. Use the following commands to build the book: crafty book create 60 quit should be replaced by the PGN filename that is created when you unzip the book file of your choice. Start.zip contains a small file that is used to create books.bin. books.bin is created as follows: crafty books create start.pgn 60 quit This file contains suggested openings that fit Crafty's "open" style of play better. You can edit/modify this at will, and it takes a fraction of a second to re-build after modification, so the big book file can be left alone. Note that the "60" is arbitrary, and is used to cut book lines off at roughly 60 plies. You "can" say 500, so that the entire games will be stored, but you need even more disk space. You can also reduce this number to 30 (15 moves for each side) to conserve disk space as needed, since the book will contain far fewer positions. ----- [1.6] How can I maximize Crafty's performance? a) Compile with different combinations of the following options: -DCOMPACT_ATTACKS, and -DUSE_SPLIT_SHIFTS. Then check the performance of Crafty. The best test is to simply let it search to a fixed depth (say sd=8 for example) from the opening position and pick the compiler /optimizer options that minimize this time. Pick SD=n so that the search takes at least 2 minutes. b) Increase the size of hash and hashp based on the following observations: - hash is more important that hashp. the only guidance is that you don't want to make hash so large things slow down due to excessive paging or swapping. - there's a compile option -DFAST. if you use this, crafty won't report any hashing statistics, making it harder to decide when to make things bigger. ----- [1.7] What are tablebases and how do I use 'em? tablebases are endgame databases distributed freely by Steven Edwards (former sje@mv.mv.com, actual email unknown). If you are downloading an executable, for dos you'll want craftyt.exe, and for Win95/WinNT, you'll want wcraftyt.exe. If you compile your own, -DTABLEBASES will do the trick. Once you have an executable that expects tablebases, you typically put them in a sub-directory TB that should be in the directory where you normally run crafty. You can change this by editing the Makefile and changing TBDIR to point to where you want 'em. Next, you need the tablebase files. These are available from chess.onenet.net and other ftp sites. The files are named like this: KBNK.tbb and KBNK.tbw for the KBN vs K tablebases. On some ftp machines the "." is replaced by a "_". after downloading them, rename them to replace the _ by . or crafty will not recognize them. These files are also available from the primary Crafty site ftp.cis.uab/edu/pub/hyatt/TB. The complete set takes about 260Mb, for all 4-man endings. We are working on new ones for frequently encountered endings like KRP vs KR. These will be made available as they are completed. There are 10 5-piece files now available, KRPKR, KRNKR, KRBKR, KRRKR and KQRKR, where each has a .tbb and .tbw pair. These files require about 500mb zipped, but will expand to about 2.3 gigabytes when unzipped. So be prepared for a large disk space requirement. Note that these databases are "mate in n" type databases, so you'll see some interesting mate announcements from Crafty, with Mate in 30 a very common occurrence. :) Endgame tablebases are available for all three-piece and almost all four-piece endgames. Because of the way chess programs work, you should install all of the tablebases with the same number of pieces. Therefore, you can either: * forget about the tablebases (0 MB to ftp, 0 MB on disk) * install one side of every three-piece tablebase (32K to ftp, 208K on disk) * install both sides of every three-piece tablebase (69K to ftp, 416K on disk) * install one side of every three- and four-piece tablebase (14 MB to ftp, 123 MB on disk) * install both sides of every three- and four-piece tablebase (34 MB to ftp, 245 MB on disk) You can also connect to a Nalimov Tablebase Webservice containing 7 GB of all 3,4 and 5 man endgames. See http://www.lokasoft.nl/uk/tbapi.htm ----- [1.8] How can I get a graphical interface with Crafty? On Unix systems, you can use XBoard with Crafty. On Windows systems, you can use WinBoard. For more information on XBoard and WinBoard, check out: http://www.research.digital.com/SRC/personal/Tim_Mann/chess.html ----- [1.9] How can I use both Crafty and XBoard to analyze positions/games? It is now possible to use XBoard and Crafty together to perform interactive analysis of positions and stored (PGN, etc.) games. To do this, you need a recent version of Crafty (12.3 or up) and xboard/winboard version 3.6.1 or later. For instructions, see the winboard/xboard faq, which explains how to use this powerful and interesting facility. ----- ** End of Crafty FAQ ** debian/doc/documentation.txt0000664000000000000000000023347611475172007013372 0ustar Crafty Command Documentation (version 18) ----------------------------------------------- Crafty is nothing more than a long-time hobby of mine, dat- ing back to Blitz and later Cray Blitz. People ask me how I keep doing this, and that is the one question that generally leaves me at a loss for words. Perhaps the most common question I'm asked is "is this ver- sion of Crafty some dumbed-down version of what you play on ICC or what you use at a computer chess event?" The answer is a resounding *NO*. The current version is *exactly* what is running on ICC under this version number. Note that a new version can, on occasion, introduce weaknesses or out- right bugs that were not present in previous "gold" ver- sions. As a result, you should be careful to back up your "favorite" before trying the latest and greatest. If you aren't satisfied with the new version, you can then go back to what you believe is a better version. If you are looking for the strongest playing computer chess program available, you should likely look to Fritz, Rebel, Tiger, and the other commercial entries. There you will find strong opponents with polished interfaces that have been tested in a systematic and careful way. If you are looking for a program that plays good chess, has a reason- able set of features for you to use, is available in source form, and one where the author welcomes feedback, code or suggestions, then you are at the right place. I welcome comments and suggestions, and also feedback from ideas you try yourself that seem to work. Crafty is a state-of-the-art computer chess program, and uses all of the search algorithms you have probably read about, negascout search, killer/history move ordering, SEE (Static Exchange Evaluation) quiescence move ordering and pruning, hash (transposition/refutation) tables as well as evaluation caches, selective extensions, recursive null-move search, and a host of other features that have been used and are still being used in most computer chess programs. If it's not in Crafty, either it is on the "to do" list, or it has been tried, found wanting, and discarded. Chess Knowledge is growing, and suggestions (or even better, real code) are welcome. This is the best place to con- tribute your ideas, because knowledge can be used to sup- plant search and make it play better. The evaluation is probably the easiest place to start studying Crafty because of the comments and simplicity of using bitmaps, *once* you get "into" them. My purpose for doing this is an exercise in computer chess efficiency. I can't begin to count the number of people I know that started from scratch to write a chess program. Even larger is the group that started from scratch, and gave up before finishing, because of the basic size of the pro- ject. Crafty offers everyone a very clean starting point, if you are fascinated by the bitmap chess board implementation (as I am). The search and quiescence code is reasonably straightforward, as is the evaluation, It offers a great starting point, so that if you are inter- ested in trying a new search extension, you can be testing tomorrow, rather than next year, because you start with a fully functional chess engine that is not a "toy" applica- tion, but is a functional and "dangerous" chess player. It offers a rapid start, although you can certainly replace it piece by piece until it is "yours" if you want. It also offers a fairly complete set of commands and an interface for a GUI as well as support for chess server play, so that testing and debugging your new ideas is greatly simplified. If you'd like more information, please check out the read.me document and the crafty.FAQ that are distributed with Crafty. These contain recent news and specific instructions for commonly asked questions, like "where can I obtain tablebase files and how do I use them?" How to play a game. ------------------- When you execute Crafty, you will immediately be greeted by the prompt string "white(1): " and Crafty will wait for com- mands. This prompt means it is white on move, and we are at move #1 for white. You can first use any of the commands from the alphabetic command listing below to tailor the game to your liking (time control, hash table size, book random- ness, etc.) and then you have two choices. If you want to play white, just enter your move, and Crafty will take it from there and make a move in response. You will then be prompted by "white(2):" and it is your move again. If you would prefer to play black, just enter either "move" or "go" at the prompt and crafty will move for that side rather than accepting a move from you. After it makes its move for white, you will then see the prompt "black(1): " indicating it is now time for blacks first move. You can enter a move, or you can once again enter "move" or "go" and Crafty will again move for the current side, change sides, and prompt you for what to do next. If you find yourself continually using a set of commands to configure crafty to play as you want, you can put these com- mands in a startup file called .craftyrc (Unix) or crafty.rc (DOS/Windows). The format for this file is just like you would type the commands at the keyboard, with the require- ment that the last line of the file must be "exit" on a line by itself. Using this, each time you start Crafty, it will first execute the commands from this file before it prompts you for input. While Crafty is running, you can control what it displays, but here's a couple of samples to explain what it is saying and why: depth time score variation (1) book moves {d4, c3, Nc3, d3, b3, c4, g3, b4, Be2, Bb5} book 0.0s 70% d4 White(3): d4 time used: 0.01 This is the normal output for those cases where Crafty is in book. The book moves line gives the set of book moves that made the first selection cut (see the book selection expla- nation given later), followed by the move actually played, in this case d4. If Crafty is out of book, then the output looks somewhat different as given below: depth time score variation (1) 4-> 0.81 2.09 6. dxe4 Bxe4 7. Rad8 Qf2 8. Qb5 5 1.37 2.41 6. dxe4 Bxe4 7. Ne5 Qf4 8. Bxe4+ Qxe4 9. f5 5-> 1.88 2.41 6. dxe4 Bxe4 7. Ne5 Qf4 8. Bxe4+ Qxe4 9. f5 6 7.38 -- 6. dxe4 6 11.90 1.97 6. dxe4 Bxe4 7. Rab8 Qf2 8. Qc7 Nc5 9. Qe5 6 12.92 ++ 6. Ne5 6 13.71 2.23 6. Ne5 Qg2 7. Ng6 h5 8. Nh4 Qg4 6-> 15.59 2.23 6. Ne5 Qg2 7. Ng6 h5 8. Nh4 Qg4 time: 15.60 cpu:99% mat:1 n:246565 nps:15927 ext-> checks:4706 recaps:1336 pawns:0 1rep:301 nodes full:45951 quiescence:200614 evals:104657 endgame tablebase-> probes done: 0 successful: 0 Let's take this stuff one line at a time. Lines that have something like 4-> in the depth column are printed when that iteration (depth) is completely finished. The time and score columns should be obvious as to their meaning as is the PV, the sequence of moves that led to this score. One note about the "score" column. As of version 18, Crafty displays the score with + values good for white, - values good for black, no matter which side it is playing in the game. All output now follows this convention, from playing, to analysis mode, to annotating your games, to whisper- ing/kibitzing on the chess servers, and so forth. This is unlike other engines, but once you get used to it, it is much less confusing when you remember that negative scores are good for black and bad for white, and vice-versa. the line that has -- in the score column means that when we started depth 6, dxe4 turned out to be worse than we thought (notice score dropped from 2.411 last search to 1.972 for this move this search.) To resolve this, Crafty lowers the lower search bound (alpha) and re-searches the move to find the score. The line with ++ means that this move (Ne5) is better than the best move so far, so Crafty raises the upper search bound (beta) and re-searches this move to find the new score. the first line of statistics gives the total time taken for this search, the cpu percentage which should stay at 98-100% unless your machine is heavily loaded or unless Crafty is in an endgame that is having lots of contact with endgame databases. If this drops below 98%, it means that Crafty is not getting full CPU usage and will be playing weaker than normal. The mat:1 is simply the true material score, since Crafty's positional scores are often larger than a pawn. Alphabetic Listing of Commands ------------------------------ 1. alarm on|off This command is used to control Crafty's "beep" after it makes a move. Turning this off will make Crafty "quiet" when it plays, but also makes it easy to miss a move if you are using crafty to play in a tournament. This is primarily designed to make Crafty tolerable during late night matches. 2. analyze This command puts crafty into analyze mode. In this mode, Crafty starts computing for whichever side is on move, and it continues computing and showing its analysis until a move is entered. This move is made, Crafty changes sides, and starts thinking and printing analysis all over, but for the other side now. This command is useful to play through a game, because you get instant feedback when you try a move. If you want to try a different move from the one you just entered, use the "back" command to back up one move, or use "back " to back up moves. Note that one move is a single move for the last player, not a move for both sides. To unmake the most recent 2 moves (one for black, one for white) use "back 2". 3. annotate|annotateh