Compiling Crafty

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.
Robert Pope
Posts: 510
Joined: Sat Mar 25, 2006 7:27 pm

Compiling Crafty

Post by Robert Pope » Mon Apr 16, 2007 12:08 am

I decided to try compiling Crafty in Windows, and I got it to run except that it basically uses zero time for its own search. Every move it makes, it gives the exact same odd time message:

time limit 575469:28 (+0.00) (575469:28)

Is there a #define or something I am missing to get the time to work? Basically all I did was #undef UNIX and #define NT_i386.

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

Re: Compiling Crafty

Post by bob » Mon Apr 16, 2007 4:16 pm

That should be all you need. Sounds like it is somehow getting the wrong type of time value. Hopefully someone that compiles under windows can speak up...

GetTickCount() should work correctly, and NT_i386 makes it use that...

Robert Pope
Posts: 510
Joined: Sat Mar 25, 2006 7:27 pm

Re: Compiling Crafty

Post by Robert Pope » Tue Apr 17, 2007 3:24 am

It's definitely using GetTickCount(), and that seems to be returning values okay. I'll have to dig around the shared->time_limit stuff and see if I can figure it out.

Tony

Re: Compiling Crafty

Post by Tony » Tue Apr 17, 2007 5:54 am

Did you use the level command to set the time ?

Tony

Robert Pope
Posts: 510
Joined: Sat Mar 25, 2006 7:27 pm

Re: Compiling Crafty

Post by Robert Pope » Wed Apr 25, 2007 1:30 am

Well, I found the problem, but I don't see why I seem to be the only one with issues:

"shared->search_time_limit" only seems to be changed when you annotate or use the "st" option. In my compile, it is never initialized, so it had a nonzero value in it. And in TimeSet(), we have

Code: Select all

  if (shared->search_time_limit) {
    shared->time_limit = shared->search_time_limit;
    shared->absolute_time_limit = shared->time_limit;
  }
I added "shared->search_time_limit=0;" to InitializeSharedData(void) and the problem went away.

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

Re: Compiling Crafty

Post by bob » Wed Apr 25, 2007 7:00 pm

Then something is broken. Unitialized global variables are supposed to be initialized to zero automatically. What compiler are you using??? I'll make sure everything in "shared" is initialized, but that should already be done.

Robert Pope
Posts: 510
Joined: Sat Mar 25, 2006 7:27 pm

Re: Compiling Crafty

Post by Robert Pope » Thu Apr 26, 2007 12:12 am

I'm using MS Visual C++ 2005 Express.

NJDenson
Posts: 75
Joined: Tue May 23, 2006 5:01 pm

Re: Compiling Crafty

Post by NJDenson » Mon Oct 08, 2007 6:04 pm

Did you ever get crafty to compile via Visual Studio 2005. If so can I get your assistance.

Robert Pope
Posts: 510
Joined: Sat Mar 25, 2006 7:27 pm

Re: Compiling Crafty

Post by Robert Pope » Tue Oct 09, 2007 12:16 am

I did. I haven't thought about it much recently, but here's what I think I did:
Start new project
import all .c files except dgt.c and dgtdrv.c
import all .h files.
In chess.h, I may have had to do a few defines. It looks like maybe I set:
#undef UNIX
#define NT_i386

I think once I had done that, I got it to compile okay, except for having to add in the variable initialization we discussed above.

Where are you getting hung up?

NJDenson
Posts: 75
Joined: Tue May 23, 2006 5:01 pm

Re: Compiling Crafty

Post by NJDenson » Tue Oct 09, 2007 2:09 am

Dan usually has a blob.c file that calls all the c's the h usually go in the header section. Its the studio settings for the prodject thats getting me ... sometimes depending what you have in it allows you to compile. I will be using 64 bit, 6 man tb's and 8 cores. Dan had extra little tweaks which he called via the blob. Also profiling helps to speed it up as well. I have the lates Intel compiler ver 10.27

Post Reply