Crafty 23.6 released

Discussion of anything and everything relating to chess playing software and machines.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
Peter Skinner
Posts: 1760
Joined: Sun Feb 26, 2006 12:49 pm
Location: Edmonton, Alberta, Canada
Full name: Peter Skinner
Contact:

Crafty 23.6 released

Post by Peter Skinner » Thu Jun 20, 2013 4:02 am

Hello everyone,

The Crafty Team quietly released Crafty 23.6 yesterday.

The source can be downloaded from: Here or here

Changes:

Code: Select all

 *******************************************************************************                                                                  *
 *    23.6   Minor tweak to "adaptive hash" code + a fix to the usage warning  *
 *           that failed to explain how many parameters are required.  New way *
 *           of timing the search, replacing the old "easy move" code that was *
 *           simply too ineffective.  Now Crafty computes a "difficulty" level *
 *           after each iteration.  If the best move doesn't change, this      *
 *           level is reduced by 10% of the current value, until it reaches    *
 *           60% where it stops dropping.  If the best move changes during an  *
 *           iteration, it adjusts in one of two ways.  If the current         *
 *           difficulty level is less than 100%, it reverts to 100% + the      *
 *           number of different best moves minus 1 times 20%.  If the current *
 *           difficulty level is already >= 100% it is set to 80% of the       *
 *           current value + (again) the number of different best moves - 1    *
 *           times 20%.  Repeated changes can run this up to 180% max.  As the *
 *           search progresses this difficulty level represents the percentage *
 *           of the nominal target time limit it should use.  It still tries   *
 *           to complete the current iteration before quitting, so this limit  *
 *           is a lower bound on the time it will use.  Restored an old idea   *
 *           from earlier Crafty versions (and even Cray Blitz), that of       *
 *           trying the killers from two plies earlier in the tree, once the   *
 *           killers for the current ply have been tried.  Was a +10 Elo gain, *
 *           added to about +10 for the new time control logic.  Old fail-high *
 *           restriction removed.  At one point in time, a fail-high on the    *
 *           null-window search at the root would cause problems.  Crafty was  *
 *           modified so that the fail-high was ignored if the re-search       *
 *           failed low.  Removing this produced an 8 Elo gain.                *
 *                                                                             *
 *******************************************************************************

My personal testing shows an increase of roughly +52 elo. Enjoy.

Peter
I got kicked out of Chapters because I moved all the Bible's to the fiction section.

User avatar
Graham Banks
Posts: 33941
Joined: Sun Feb 26, 2006 9:52 am
Location: Auckland, NZ

Re: Crafty 23.6 released

Post by Graham Banks » Thu Jun 20, 2013 4:17 am

Peter Skinner wrote:Hello everyone,

The Crafty Team quietly released Crafty 23.6 yesterday.
Hi Peter,

any compiles available yet?

Graham.
My email addresses:
gbanksnz at gmail.com
gbanksnz at yahoo.co.nz

User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 6:43 pm

Consideration of a C++ Crafty

Post by sje » Thu Jun 20, 2013 4:36 am

Has there been any consideration regarding a Crafty re-write in C++?

In addition to the obvious benefits of C++ vs C, there is also the idea that most new coders are taught C++ instead of C. Also, I'll guess that work on improving compilers, debuggers, and other developer tools is progressing faster for C++ than for C.

bob
Posts: 20887
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: Consideration of a C++ Crafty

Post by bob » Thu Jun 20, 2013 5:34 am

sje wrote:Has there been any consideration regarding a Crafty re-write in C++?

In addition to the obvious benefits of C++ vs C, there is also the idea that most new coders are taught C++ instead of C. Also, I'll guess that work on improving compilers, debuggers, and other developer tools is progressing faster for C++ than for C.
Too much work, IMHO. There are some syntactic things I like about C++, but it would be a really big effort for no improvement in speed/play...

User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 6:43 pm

Re: Consideration of a C++ Crafty

Post by sje » Thu Jun 20, 2013 7:16 am

bob wrote:
sje wrote:Has there been any consideration regarding a Crafty re-write in C++?

In addition to the obvious benefits of C++ vs C, there is also the idea that most new coders are taught C++ instead of C. Also, I'll guess that work on improving compilers, debuggers, and other developer tools is progressing faster for C++ than for C.
Too much work, IMHO. There are some syntactic things I like about C++, but it would be a really big effort for no improvement in speed/play...
Certainly it would be a significant amount of work. And, as you say, there would be little strength improvement, at least at first.

But not all the work need be done at once. The process could start with just renaming the sources from ".c" to ".cpp" and verifying that there was no functional change. From that point, classes could be added one at a time starting with (say) Board, Bitboard, Hash, Move, Position, etc. Chunk by chunk the old C stuff would disappear until the program became a modern example of abstraction and encapsulation that's not possible with C.

C++ allows you to get rid of 90% of the preprocessor stuff, replacing it with scoped enumerations, inline routines, and inline methods, all of which get full type checking. That alone is a good justification. Another benefit: no need for global variables which clutter the namespace.

A lot of code can be stolen from public sources like the C++ Standard Template Library. Such can be used as a temporary measure pending the development of faster, more specific tempates.

User avatar
lucasart
Posts: 3096
Joined: Mon May 31, 2010 11:29 am
Full name: lucasart
Contact:

Re: Consideration of a C++ Crafty

Post by lucasart » Thu Jun 20, 2013 12:39 pm

sje wrote:Has there been any consideration regarding a Crafty re-write in C++?

In addition to the obvious benefits of C++ vs C, there is also the idea that most new coders are taught C++ instead of C. Also, I'll guess that work on improving compilers, debuggers, and other developer tools is progressing faster for C++ than for C.
Steven, is that you ? Do you realize that the entire Linux based operating system you're running is almost entirely written in C ? Or do you prefer C++ Windows ?

After having done both, I can assure you that there are absolutely no benefits of C++ over C that are useful in a chess engine, at least.

The thing is that people bave a misconception of C, because they only know C89 (thanks to the Microsoft propaganda). C has evolved and you should look into C99 and C11 standard to see what has become of it.

As for C++ tools being more available than C, and C being slowly deprecated, this is again propaganda, orchestrated by Microsoft. They're the ones who are trying to drop support for C in their crappy compiler, but in reality C is much simpler to learn and to write compilers and tools for, and support for C is often better than C++.

For example, my experience with DiscoCheck, is that cross compiling and portability are much easier to achieve in C than in C++. Version 1.0 to 3.7.1 of DC were in C, and I had the stupid idea to rewrite it in C++, probably after drinking too much C++ kool-aid. Now I regret it, but anyway, it's done, and I can't be bothered to rewrite it in C, now that everything depends on the C++ syntactic-sugar abstraction-crap.

Why use commercial and sucky Microsoft compiler, when one can use superior and free GNU compiler ?
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.

mar
Posts: 2108
Joined: Fri Nov 26, 2010 1:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Consideration of a C++ Crafty

Post by mar » Thu Jun 20, 2013 1:22 pm

lucasart wrote: Or do you prefer C++ Windows ?
Please stop spreading BS Lucas. It's written in C.
As for the rest, who are you trying to convince? Yourself? :)

User avatar
Evert
Posts: 2929
Joined: Fri Jan 21, 2011 11:42 pm
Location: NL
Contact:

Re: Consideration of a C++ Crafty

Post by Evert » Thu Jun 20, 2013 2:03 pm

sje wrote:Another benefit: no need for global variables which clutter the namespace.
You don't need to write C code that depends on global variables either.
In fact, the only stuff that is global in Jazz (Sjaak, Leonidas) is read-only (or write-once on startup, read many times afterwards) data.

bob
Posts: 20887
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: Consideration of a C++ Crafty

Post by bob » Thu Jun 20, 2013 5:24 pm

Evert wrote:
sje wrote:Another benefit: no need for global variables which clutter the namespace.
You don't need to write C code that depends on global variables either.
In fact, the only stuff that is global in Jazz (Sjaak, Leonidas) is read-only (or write-once on startup, read many times afterwards) data.
If you have a threaded program for SMP search, you will ALWAYS have global data. Whether it is declared as normal C globals, or stuck in a shared memory block (which is still global).

If one is a reasonable coder, global variables are not necessarily a bad thing.

User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 6:43 pm

Re: Consideration of a C++ Crafty

Post by sje » Thu Jun 20, 2013 8:50 pm

bob wrote:If you have a threaded program for SMP search, you will ALWAYS have global data. Whether it is declared as normal C globals, or stuck in a shared memory block (which is still global).
It's possible to have variable data shared among C++ objects without requiring that data to be global. There are two basic ways of doing this:

1. Static class variables, declared private. Each instance of the class will have access, but no other objects will have access. In some cases, a mutex might be needed to prevent the usual chaos.

2. A container class instance holds the variables needed by objects of subsidiary class instances. Example: A TreeSearch class object could contain pointers to MAX_THREAD Search objects, each of which runs on a separate thread and handles a separate branch of the entire search tree. The storage for all of the branch data is constructed and initialized by a TreeSearch object and then parceled out to its Search objects at the time they are constructed. Each Search object can access only its chunk of the branch data; only the parent TreeSearch object can see all of the branch data at the same time.

Post Reply