Crafty 24.0

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Jimbo I
Posts: 148
Joined: Thu Feb 15, 2007 3:34 am
Location: USA

Re: Crafty 24.0

Post by Jimbo I » Sun Jun 01, 2014 12:11 am

bob wrote:
Jimbo I wrote:
bob wrote:
Jimbo I wrote:
Peter Skinner wrote:
Jimbo I wrote:Hi Peter,

Thanks for the compile! Could you also possibly make a full-featured compiled version with the skill switch?

(I still haven't learned how to compile engines myself. How hard would it be for a non-programmer to learn how to do this?)
If you have Visual Studio 2008 or greater, I can upload my makefiles and instructions for you to download. Then isn't just 4 minutes of your time.

Also I am recompiling the previous 24.0 release with the /DSKILL option. I simply had forgotten to re-add it to my makefiles as I don't use it internally for testing.

Peter
I'd love to give it a try. I have Microsoft Visual C++ 2010 Express installed (but never used). Is that what I'd need to do the compile? How would I download the makefiles and instructions? From your web site?

And thanks for recompiling with the /DSKILL option!
I don't think that will work. I use the stdint.h include file and I have heard complaints that this is not included in vs express 2010. I think there is a 2013 express now but I do not know if it includes the stdint.h stuff either...
I'm hoping that this isn't a problem? I did a little Googling and came across a post where someone said Microsoft finally added stdint.h to 2010 Express. (I checked, and it is in one of my Express folders.) So maybe it would work?

Also, I have some bad news for you, Bob. I tried Peter's Crafty 24.0 with Skill=1, and it's doing the same thing that all versions since 23.6 have done: It uses up most of it's time very early in the game, then has just a second or two for a number of moves. It'll forfeit on time for a significant portion of its games (maybe 1 in 6 when using Arena, and even more than that in ChessGui). It's not a big deal for me, since I can still use version 23.5 to play against, but I just hate to see it still be broken in the later versions.
Can you tell me what time control you use? skill=1 is really not for an experienced player, and new players are not going to play bullet-level speeds. It is likely there would be a problem at very fast time controls. One of the intents of skill=small-number is to still use a "normal" amount of time... it feels unnatural (as a beginner) if your opponent moves instantly.
Maybe you have a point. Just for checking a new engine to see if it's playing as expected, I use 40 moves in 4 minutes, repeating, only because it's quick and that's the faster time control for the CCRL rating charts. When I actually play the engine, I usually use blitz settings of game in 10 to 20 minutes per side. (And I can set the difficulty a smidgen higher than Skill=1. Skill=1 is just my testing litmus test.) The problem was with the 40/4 TC, although I've since played a few 20 minute/side blitz games, and it seems to still have time forfeit problems there too. But then again, that's in Arena with no increments. I may install the latest Winboard and see if the problem occurs there too.

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

Re: Crafty 24.0

Post by bob » Sun Jun 01, 2014 4:00 pm

Jimbo I wrote:
bob wrote:
Jimbo I wrote:
bob wrote:
Jimbo I wrote:
Peter Skinner wrote:
Jimbo I wrote:Hi Peter,

Thanks for the compile! Could you also possibly make a full-featured compiled version with the skill switch?

(I still haven't learned how to compile engines myself. How hard would it be for a non-programmer to learn how to do this?)
If you have Visual Studio 2008 or greater, I can upload my makefiles and instructions for you to download. Then isn't just 4 minutes of your time.

Also I am recompiling the previous 24.0 release with the /DSKILL option. I simply had forgotten to re-add it to my makefiles as I don't use it internally for testing.

Peter
I'd love to give it a try. I have Microsoft Visual C++ 2010 Express installed (but never used). Is that what I'd need to do the compile? How would I download the makefiles and instructions? From your web site?

And thanks for recompiling with the /DSKILL option!
I don't think that will work. I use the stdint.h include file and I have heard complaints that this is not included in vs express 2010. I think there is a 2013 express now but I do not know if it includes the stdint.h stuff either...
I'm hoping that this isn't a problem? I did a little Googling and came across a post where someone said Microsoft finally added stdint.h to 2010 Express. (I checked, and it is in one of my Express folders.) So maybe it would work?

Also, I have some bad news for you, Bob. I tried Peter's Crafty 24.0 with Skill=1, and it's doing the same thing that all versions since 23.6 have done: It uses up most of it's time very early in the game, then has just a second or two for a number of moves. It'll forfeit on time for a significant portion of its games (maybe 1 in 6 when using Arena, and even more than that in ChessGui). It's not a big deal for me, since I can still use version 23.5 to play against, but I just hate to see it still be broken in the later versions.
Can you tell me what time control you use? skill=1 is really not for an experienced player, and new players are not going to play bullet-level speeds. It is likely there would be a problem at very fast time controls. One of the intents of skill=small-number is to still use a "normal" amount of time... it feels unnatural (as a beginner) if your opponent moves instantly.
Maybe you have a point. Just for checking a new engine to see if it's playing as expected, I use 40 moves in 4 minutes, repeating, only because it's quick and that's the faster time control for the CCRL rating charts. When I actually play the engine, I usually use blitz settings of game in 10 to 20 minutes per side. (And I can set the difficulty a smidgen higher than Skill=1. Skill=1 is just my testing litmus test.) The problem was with the 40/4 TC, although I've since played a few 20 minute/side blitz games, and it seems to still have time forfeit problems there too. But then again, that's in Arena with no increments. I may install the latest Winboard and see if the problem occurs there too.
I've tried to find a non-looping approach to slowing crafty down. usleep() in unix will work, but it isn't portable to windows. Problem is, Crafty is VERY fast. To slow it down takes a significant loop in Evaluate(), because just screwing with the evaluation itself won't work (Beal effect).

I will look to see what can be done. Is anyone aware of any sort of "short sleep" mechanism in windows that is equivalent to usleep() in unix?

(usleep(n) sleeps for n microseconds.) Not finding something similar, I can look into "educating" the spin loop so that it won't spin past a time loss... I tested it a lot, but not at fast time controls....

Cardoso
Posts: 295
Joined: Thu Mar 16, 2006 6:39 pm

Re: Crafty 24.0

Post by Cardoso » Tue Jun 03, 2014 2:51 pm

bob wrote:
velmarin wrote:
bob wrote:
Mr. Robert, it does exactly, pause(),
I had to remove it so that I compile with Intel.

Moreover if other users make few CPUs, 4,8,16, is indistinct.
Thanks.
I am not sure what you mean by "pause()" and "4, 8, 16 is indistinct"??
He means that if we define CPUS greater than one then in lock.h the code inside the condition #if (CPUS > 1) gets active and so the function "void Pause()" must be compiled but this produces an error "_Pause() already defined in analyze.obj". However if we make "_forceline void Pause()" it compiles successfully because it is ok to have inline functions in header files. I used MS VC++ 2013.
However the function Pause() is empty of code, it does nothing. Is this ok Bob?

regards,
Alvaro

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

Re: Crafty 24.0

Post by mar » Tue Jun 03, 2014 3:04 pm

bob wrote:To slow it down takes a significant loop in Evaluate(), because just screwing with the evaluation itself won't work (Beal effect).

I will look to see what can be done. Is anyone aware of any sort of "short sleep" mechanism in windows that is equivalent to usleep() in unix?
I'm not aware of anything like that in windows, just Sleep (unless you mess with timeBeginPeriod/timeEndPeriod, the granularity is about 16msec anyway).
So... do you really want to sleep in Eval? Why not sleep in ID loop?
What I do is measure how long an iteration takes then sleep as necessary to emulate slowdown.
It's not as smooth but gets the job done.

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

Re: Crafty 24.0

Post by bob » Tue Jun 03, 2014 5:20 pm

mar wrote:
bob wrote:To slow it down takes a significant loop in Evaluate(), because just screwing with the evaluation itself won't work (Beal effect).

I will look to see what can be done. Is anyone aware of any sort of "short sleep" mechanism in windows that is equivalent to usleep() in unix?
I'm not aware of anything like that in windows, just Sleep (unless you mess with timeBeginPeriod/timeEndPeriod, the granularity is about 16msec anyway).
So... do you really want to sleep in Eval? Why not sleep in ID loop?
What I do is measure how long an iteration takes then sleep as necessary to emulate slowdown.
It's not as smooth but gets the job done.
I suppose I could do that. I wanted the output to "flow" rather than being choppy, but that is not exactly a critical issue...

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

Re: Crafty 24.0

Post by bob » Tue Jun 03, 2014 9:05 pm

Cardoso wrote:
bob wrote:
velmarin wrote:
bob wrote:
Mr. Robert, it does exactly, pause(),
I had to remove it so that I compile with Intel.

Moreover if other users make few CPUs, 4,8,16, is indistinct.
Thanks.
I am not sure what you mean by "pause()" and "4, 8, 16 is indistinct"??
He means that if we define CPUS greater than one then in lock.h the code inside the condition #if (CPUS > 1) gets active and so the function "void Pause()" must be compiled but this produces an error "_Pause() already defined in analyze.obj". However if we make "_forceline void Pause()" it compiles successfully because it is ok to have inline functions in header files. I used MS VC++ 2013.
However the function Pause() is empty of code, it does nothing. Is this ok Bob?

regards,
Alvaro
Pause really is pointless, except for those that insist on using hyper threading. If you run 1 thread per physical core, pause offers nothing at all...

Zenmastur
Posts: 779
Joined: Sat May 31, 2014 6:28 am

Re: Crafty 24.0

Post by Zenmastur » Wed Jun 04, 2014 4:51 am

I've been away from computer chess and chess in general for about 17 years. At one time (1990-1997) I had a working chess program that I wrote in Fortran. In 93 I changed jobs and my work prevented me from doing much with my chess program. I'm now retired and just recently began messing around with chess again.

Several weeks ago I bumped into Crafty's web page so I down loaded a copy and a few other programs to play chess with. I still have a copy of version 12.5 that I used to test my program with. At the time I liked the idea of a learning program. I've been playing with version 23.8 for a few weeks and have down loaded version 24.0. A lot has changed since the last time I used Crafty so I took the time to read all the comments in main.c.

I have been experimenting with Crafty's learning abilities. Their function doesn't appear to have changed much in the last 17-18 years, some tweaking here and there but no major structural changes that I could see. I think they could be much improved with some effort. So, I've been pondering the idea of spending some time on this project. I'm on a limited budget so I'm wondering if there is some freeware compilers/linkers etc that I could use to create WIN 64 executables with. If anyone knows of any I would appreciate a heads up.

If anyone has ideas on how they would make Crafty or any other chess engine a more proficient learning student of chess I'm all ears. Or if you have already tried this I would be interested in the details and results. i.e. what data was used, how was it gathered, how was it used, what data structures were implemented, what was learned and at what rate was it learned etc.

Regards,

Forrest
Only 2 defining forces have ever offered to die for you.....Jesus Christ and the American Soldier. One died for your soul, the other for your freedom.

brianr
Posts: 371
Joined: Thu Mar 09, 2006 2:01 pm

Re: Crafty 24.0

Post by brianr » Wed Jun 04, 2014 4:25 pm

Crafty can be compiled with MSVC.
I use the 2008 Express edition. 64 bit support works.
You may have to download a stdint.h and tweak some things a bit.
The executables are not as fast as some profiled builds, but still ok.
Command line args:

Code: Select all

/O2 /Ob2 /Oi /Ot /Oy /GT /GL /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "NT_i386" /D "CPUS=4" /Gm /EHsc /MDd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /nologo /c /Zi /TP /errorReport:prompt
As to learning there are many different types.
Did you mean position and book learning or more like tuning learning?
I have fooled around with Temporal Difference learning (unable to reproduce Beal's results), genetic algorithms, CLOP, Texel/Stockfish type tuning (gradient based somewhat similar to TD), etc.

All take ages to run but once in a while produce an actual improvement.
More often than I would like my test setup turns out to be flawed.
The process is somewhat frustrating, but every now and then I give it another try.

Good luck.

User avatar
Peter Skinner
Posts: 1760
Joined: Sun Feb 26, 2006 12:49 pm
Location: Edmonton, Alberta, Canada
Full name: Peter Skinner
Contact:

Re: Crafty 24.0

Post by Peter Skinner » Thu Jun 05, 2014 3:43 pm

brianr wrote:Crafty can be compiled with MSVC.
I use the 2008 Express edition. 64 bit support works.
You may have to download a stdint.h and tweak some things a bit.
The executables are not as fast as some profiled builds, but still ok.
Command line args:

Code: Select all

/O2 /Ob2 /Oi /Ot /Oy /GT /GL /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "NT_i386" /D "CPUS=4" /Gm /EHsc /MDd /Fo"Debug\" /Fd"Debug\vc90.pdb" /W3 /nologo /c /Zi /TP /errorReport:prompt
As to learning there are many different types.
Did you mean position and book learning or more like tuning learning?
I have fooled around with Temporal Difference learning (unable to reproduce Beal's results), genetic algorithms, CLOP, Texel/Stockfish type tuning (gradient based somewhat similar to TD), etc.

All take ages to run but once in a while produce an actual improvement.
More often than I would like my test setup turns out to be flawed.
The process is somewhat frustrating, but every now and then I give it another try.

Good luck.
Crafty does compile with MSVC. That's what I use, along with the Intel compiler. The issue that I am still trying to figure out is why it crashes on older AMD machines.

I haven't had a single complaint with regards to Intel machines or _newer_ AMD boxes. Doesn't even give me a debug file. It just dies..

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

Cardoso
Posts: 295
Joined: Thu Mar 16, 2006 6:39 pm

MAX_DRAFT

Post by Cardoso » Thu Jun 05, 2014 3:46 pm

Just noticed MAX_DRAFT is no longer used since version 23.8, could it be a new bug?
I mean it is still checked in HashProbe() but during the search you no longer use this value. If I'm not mistaken you used this value to signal an exact EGTB entry, but now you no longer do this.
Could it be because the EGTB probes are so efficient that you don't need to replicate EGTB data in the hash table?

regards,
Alvaro

Post Reply