Crafty

a portable open source engine supporting the Chess Engine Communication Protocol written by Robert Hyatt in C|ANSI C starting in the early 90s, loosely derived from Cray Blitz, winner of the 1983 and 1986 World Computer Chess Championships. Crafty pioneered in using Rotated bitboards, parallel search and probing Nalimov Tablebases. It performs a principal variation search, null move pruning, LMR as well as a SEE swap algorithm for move ordering and to prune "bad" captures in quiescence search. In 2006/2007, Crafty switched from rotated to Magic bitboards, according to Robert Hyatt because it was not faster but simpler. Crafty **25.1**, released in October 2016, not only includes an increase in playing strength but support for Syzygy bases by Ronald de Man aided by the coding contributions of Basil Falcinelli. Crafty **25.3** features playing strength adjustment between 800 and 2600 Elo. || toc =Team Members= as mentioned at WCRCC 2010 and CCT15, 2013
 * Home * Engines * Crafty**
 * [[image:CraftyOwl.jpg width="200" link="http://twogirlsbeingcrafty.blogspot.de/2011/04/owl-pin-cushion.html"]] ||~  || **Crafty**,
 * Crafty Owl ||~  ||^   ||
 * Peter Berger, Crafty's book author at WCCC 2004, WCCC 2005 and WCCC 2006
 * Michael Byrne
 * Robert Hyatt
 * Tracy Riegle
 * Peter Skinner

=Tournaments= Crafty participated at four World Microcomputer Chess Championships, the WMCCC 1996, WMCCC 1997, WMCCC 2000, and WMCCC 2001, three World Computer Chess Championships, the WCCC 2004, WCCC 2005 and WCCC 2006, the ACCA Americas' Computer Chess Championships, the ACCA World Computer Rapid Chess Championships, CCT and various other tournaments. Crafty won the CCT1 in 2000, CCT5 in 2003 and CCT6 in 2004. At the Fifth Annual ACCA Americas' Computer Chess Championships in 2010 Crafty was runner-up behind Thinker.

=Descriptions=

1997
from the ICGA page :

||

2008
from a CCC post :

||

Generation II
Crafty **25.0**, Generation II, December 2015 

Leading or Trailing Zeros
Crafty had always mapped square-index 0 to square 'a1', 7 to 'h1', and 63 to 'h8' respectively, but recently (crafty-20.6) reversed the bit-index versus square-index mapping from leading to trailing zero count based little-endian rank-file (LERF), using bitscan forward (LSB) to retrieve squares in **a1-h8** order, as most often used in CPW bitboard samples.

LSB
Trailing zero count aka bitscan forward for non empty sets as used in bitboard serialization for move generation and evaluation purposes, is implemented with x86-64 bsf instruction via intrinsic or inline assembly if available (there are also 32-bit x86 bsf versions), and a conditional 16-bit byte lookup approach otherwise - Windows 64, Linux 64 and lookup versions with preprocessor instructions for conditional compiles omitted : code format="cpp" int LSB(BITBOARD arg1) { unsigned long index; if (_BitScanForward64(&index, arg1)) return index; else return 64; }

int static __inline__ LSB(long word) { long dummy, dummy2;

asm("         bsfq    %1, %0     " "\n\t"    "          jnz     1f         " "\n\t"    "          movq    $64, %0    " "\n\t"    "1:                           " "\n\t"
 * "=&r"(dummy), "=&r" (dummy2)
 * "1"((long) (word))
 * "cc");

return (dummy); }

unsigned char lsb[65536];

int LSB(BITBOARD arg1) { if ( arg1       & 65535) return (lsb[ arg1        & 65535]); if ((arg1 >> 16) & 65535) return (lsb[(arg1 >> 16) & 65535] + 16); if ((arg1 >> 32) & 65535) return (lsb[(arg1 >> 32) & 65535] + 32); return (lsb[arg1 >> 48] + 48); } code

Last One
Earlier Crafty versions prior to 20.6 had a leading zero count compliant, big-endian rank-file mapping. Left-bottom square (from White's point of view) 'a1' with square-index 0 was mapped to the leftmost, arithmetical most significant bit of an unsigned 64-bit integer with bit-index 63, while square 'h8' with square-index 63, was mapped to the rightmost, arithmetical least significant bit with bit-index 0. Bitscan forward and found index reversal was used in LastOne, to retrieve squares in **h8-a1** order : code format="cpp" int LastOne(BITBOARD arg1) { unsigned long index; if (_BitScanForward64(&index, arg1)) return 63 - index; else return 64; } code This one was found in 15.17 with MAC OS support code format="cpp" int LastOne(register BITBOARD a) { register unsigned long i; if (i = a & 0xffffffff) return(__cntlzw(i ^ (i - 1)) + 32); if (i = a >> 32) return(__cntlzw(i ^ (i - 1))); return(64); } code

=Selected Games=

WCCC 2004
WCCC 2004, round 9, Falcon - Crafty code [Event "WCCC 2004"] [Site "Ramat Gan, Israel"] [Date "2004.07.11"] [Round "9"] [White "Falcon"] [Black "Crafty"] [Result "0-1"]

1.e4 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26.Qd8+ Ne8 27.Qe7 Bc6 28.Bc4 Nf6 29.Bxf7+ Kh8 30.Nd3 b2 31.Rd8+ Rxd8 32.Qxd8+ Be8 33.Bxe8 Qc2+ 34.Ke3 Nd5+ 35.Kd4 Qc3+ 36.Ke4 Qc7 37.Qxc7 Nxc7 38.Nxb2 a3 39.Bf7 axb2 40.Ba2 Nb5 41.Kd3 Na3 42.g5 b1=B+ 43.Bxb1 Nxb1 44.h4 Kg8 45.h5 Kf8 46.f4 Ke7 47.Kd4 Nd2 48.Ke3 Nc4+ 49.Kd4 Nd6 50.Ke5 Nf7+ 51.Kd5 h6 52.f6+ gxf6 53.g6 Nd8 54.f5 Nb7 55.Kc6 Na5+ 0-1 code

=Copyright= Many programmers did not grasp Crafty's [|Copyright] statement, but apparently took remarks by Robert Hyatt like in his reply to Ren Wu, January 26, 1999, concerning [|code reuse] and not [|reinventing the wheel] as alibi for their chess programming :

||

Robert Hyatt further on the copyright problem :

|| =Crafty Clones= > include component="pageList" hideInternal="true" tag="craftyclone" limit="20"

=See also=
 * Cray Blitz
 * Nalimov Tablebases
 * Open Source Engines

=Publications=
 * Robert Hyatt, Monroe Newborn (**1997**). //CRAFTY Goes Deep//. ICCA Journal, Vol. 20, No. 2
 * Ernst A. Heinz (**2001**). //Modeling the “Go Deep” Behaviour of CRAFTY and DARK THOUGHT.// Advances in Computer Games 9 » Depth, DarkThought
 * Levente Kocsis, Jos Uiterwijk, Eric Postma, Jaap van den Herik (**2002**). //[|The Neural MoveMap Heuristic in Chess]//. CG 2002, [|pdf] » Neural MoveMap Heuristic
 * Albert Xin Jiang (**2003**). //Implementation of Multi-ProbCut in Chess//. CPSC 449 Thesis, [|pdf]
 * Jan Renze Steenhuisen (**2005**). //New Results in Deep-Search Behaviour//. ICGA Journal, Vol. 28, No. 4, [|pdf]
 * Matej Guid, Ivan Bratko (**2007**). //Factors affecting diminishing returns for searching deeper//. CGW 2007 » Crafty, Rybka, Shredder, Diminishing Returns
 * Matej Guid, Ivan Bratko (**2007**). //Factors affecting diminishing returns for searching deeper//. ICGA Journal, Vol. 30, No. 2, [|pdf]
 * Matej Guid, Aritz Pérez, Ivan Bratko (**2007**). //How trustworthy is Crafty's analysis of world chess champions//? CGW 2007
 * Matej Guid, Aritz Pérez, Ivan Bratko (**2008**). //How trustworthy is Crafty's analysis of world chess champions//? ICGA Journal, Vol. 31, No. 3, [|pdf]
 * Robert Hyatt (**2014**). //A Solution to Short PVs Caused by Exact Hash Matches//. ICGA Journal, Vol. 37, No. 3 » Transposition Table, Separate TT for the PV
 * Monroe Newborn, Robert Hyatt (**2014**). //Computer Chess Endgame Play with Pawns: Then and Now//. ICGA Journal, Vol. 37, No. 4 » Peasant, Pawn Endgame
 * Guy Haworth (**2015**). //Chess Endgame News//. ICGA Journal, Vol. 38, No. 1 » FinalGen

=Forum Posts=

1995 ...

 * [|Re: Crafty version 8.7] by Robert Hyatt, rgcc, October 05, 1995
 * [|Crafty V9.22] by Robert Hyatt, rgcc, April 05, 1996
 * [|Crafty V9.26] by Robert Hyatt, rgcc, May 08, 1996
 * [|Crafty's opening book - technical details] by Robert Hyatt, rgcc, October 04, 1996
 * [|Crafty 11.15] by Robert Hyatt, rgcc, January 30, 1997
 * [|Repetitions in Crafty] by Martin Borriss, rgcc, January 30, 1997 » Repetitions
 * [|quiescence search] by Andrew Tridgell, rgcc, April 16, 1997 » Quiescence Search, Check
 * [|Crafty and fastest Cray: question to Bob] by Jouni Uski, CCC, December 01, 1997
 * [|Parallel Crafty] by Robert Hyatt, CCC, March 19, 1998
 * [|Current Crafty strength on SMP?] by Charlton Harrison, rgcc, April 29, 1998
 * [|crafty copyright problem] by Robert Hyatt, rgcc, February 17, 1999 » Voyager
 * [|Crafty Modifications MUST be made available to Robert Hyatt] by KarinsDad, CCC, February 17, 1999
 * [|Crafty implications ...] by Chris Whittington, rgcc, March 4, 1999
 * [|Do have the Crafty the Assembler written core?] by Leonid, CCC, November 01, 1999

2000 ...

 * [|Crafty internal iterative deepening] by Tijs van Dam, CCC, January 26, 2000 » Internal Iterative Deepening
 * [|Crafty 17.13 - re-importing FEN files?] by Wieland Belka, CCC, November 02, 2000
 * [|Crafty 17.13 - using game archives by engines?] by Wieland Belka, CCC, November 02, 2000
 * [|razoring in crafty version 16.9, mid 1999] by Vincent Diepeveen, August 21, 2002
 * [|Crafty SMP questions] by Matthew Hull, CCC, August 05, 2003 » SMP
 * [|Crafty 19.08 SE 2004 released ...] by Michael Byrne, Winboard Forum, January 01, 2004 » Wb2UCI
 * [|Re: Crafty 1910 SE vs Ruffian2 I hate this, but] by Peter Skinner, CCC, February 04, 2004 » Ruffian
 * [|is this a sign of broken smp] by Michael Byrne, CCC, March 09, 2004 » SMP
 * [|Question about Crafty and Bishop Pair] by Renze Steenhuisen, CCC, July 13, 2004 » Bishop Pair

2005 ...

 * [|Re: need help in compiling Crafty] by Joshua Haglund, CCC, February 19, 2005
 * [|Crafty and assembly code] by Alain Zanchetta, CCC, May 08, 2005
 * [|Re: BitBoard Tests Magic v Non-Rotated 32 Bits v 64 Bits] by Robert Hyatt, CCC, August 25, 2007 » Magic Bitboards
 * [|crafty-22.0] by Robert Hyatt, CCC, February 18, 2008
 * [|Crafty questions] by Pablo Vazquez, CCC, May 16, 2008
 * [|Re: Lemming Poll] by Robert Hyatt, CCC, September 22, 2008 » Tapered Eval, LearningLemming
 * [|Crafty - no analysis output near mate?] by cyberfish, December 03, 2008

2010 ...

 * [|old crafty vs new crafty on new hardware] by Robert Hyatt, CCC, September 11, 2010
 * [|Crafty tests show that Software has advanced more] by Don Dailey, CCC, September 12, 2010
 * [|Final results - Crafty - hardware vs software] by Robert Hyatt, CCC, September 13, 2010
 * [|hardware doubling number for Crafty] by Robert Hyatt, CCC, September 15, 2010
 * 2011**
 * [|On Crafty...] by Robert Hyatt, CCC, May 22, 2011
 * [|Re: Robert - How did you came up with the name Crafty] by Robert Hyatt, CCC, June 16, 2011
 * [|Re: Still waiting on Ed] by BB+, OpenChess Forum, July 07, 2011 » on 22.1 vs. 23.4. differences
 * [|Re: Still waiting on Ed] by Robert Hyatt, OpenChess Forum, July 07, 2011 » on 22.1 vs. 23.4. differences
 * [|ICGA rule #2 / opening books / Diep-Crafty, Turino 2006] by Peter Berger, CCC, October 22, 2011 » Opening Book, WCCC 2006
 * 2012**
 * [|Crafty source] by Robert Hyatt, CCC, September 26, 2012
 * 2013**
 * [|Crafty 23.6 released] by Peter Skinner, CCC, June 20, 2013
 * [|interesting SMP bug] by Robert Hyatt, CCC, September 24, 2013 » Parallel Search
 * [|Crafty 23.8] by Robert Hyatt, CCC, November 11, 2013
 * 2014**
 * [|Crafty 24.0] by Robert Hyatt, CCC, May 26, 2014
 * [|Crafty 24.1] by Daniel José Queraltó, CCC, October 01, 2014
 * [|Threads test incl. Crafty 24.1] by Andreas Strangmüller, CCC, October 15, 2014 » Thread, Parallel Search

2015 ...
> [|Re: Around Crafty dev. ...] by Robert Hyatt, CCC, September 01, 2016
 * [|Grafty vs Crafty] by Marcel van Kervinck, Rybka Forum, April 21, 2015 » Stockfish
 * [|parallel speedup and assorted trivia] by Robert Hyatt, CCC, June 05, 2015 » Parallel Search
 * [|Crafty UCI version] by Marek Soszynski, July 10, 2015 » UCI
 * [|An interesting parallel search non-bug] by Robert Hyatt, CCC, November 05, 2015 » Parallel Search
 * [|Crafty 25.0 Release] by Michael B, CCC, December 25, 2015
 * [|Crafty 25.0 announcement] by Robert Hyatt, CCC, December 28, 2015
 * 2016**
 * [|crafty eval cache] by Alvaro Cardoso, CCC, January 01, 2016 » Evaluation Hash Table
 * [|NUMA 101] by Robert Hyatt, CCC, January 07, 2016 » NUMA
 * [|Crafty 25.0.1] by Robert Hyatt, CCC, January 15, 2016
 * [|Crafty's four hash tables] by Louis Zulli, CCC, January 17, 2016 » Hash Table
 * [|Crafty c questions] by J. Wesley Cleveland, CCC, March 10, 2016 » C
 * [|Crafty chess engine] by Krzysztof Grzelak, CCC, March 20, 2016
 * [|Crafty SMP measurement] by Robert Hyatt, CCC, April 04, 2016 » Parallel Search
 * [|Around Crafty dev. ...] by Frank Quisinsky, CCC, August 31, 2016
 * [|Crafty 25.1 Release] by Michael B, CCC, October 04, 2016
 * [|Crafty v25.2 Release] by Michael B, CCC, October 29, 2016
 * 2017**
 * [|Crafty Play By Elo ( Crafty v25.3)] by Michael B, CCC, January 23, 2017 » Playing Strength

=External Links=

Chess Engine

 * [|GitHub - MichaelB7/Crafty]
 * [|Crafty Chess] managed by Tracy Riegle
 * [|Index of /downloads/source]
 * [|Crafty from Wikipedia]
 * [|Crafty Documentation]
 * [|Crafty's ICGA Tournaments]
 * [|The chess games of Crafty (Computer)] from [|chessgames.com]
 * [|Crafty] from WBEC Ridderkerk
 * [|How Far We've Come: 20 Years of Personal Computing] by [|Blake Linton Wilfong], November 05, 2000 » ACM 1981, Sargon, Cray Blitz
 * [|186.crafty: SPEC CPU2000 Benchmark Description]
 * [|Crafty Versions] at CCRL 40/40

Misc
> media type="youtube" key="D57fYwyhajk" width="560"
 * [|crafty - Wiktionary]
 * [|Craft from Wikipedia]
 * [|American craft from Wikipedia]
 * [|Arts and Crafts movement from Wikipedia]
 * [|American Craftsman from Wikipedia]
 * [|Guitar Craft from Wikipedia]
 * Robert Fripp and the League of Crafty Guitarists, [|YouTube] Video

=References= =What links here?= include page="Crafty" component="backlinks" limit="280"
 * Up one level**