Page 1 of 3

Compiling Crafty

Posted: Mon Apr 16, 2007 2:08 am
by Robert Pope
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.

Re: Compiling Crafty

Posted: Mon Apr 16, 2007 6:16 pm
by bob
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...

Re: Compiling Crafty

Posted: Tue Apr 17, 2007 5:24 am
by Robert Pope
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.

Re: Compiling Crafty

Posted: Tue Apr 17, 2007 7:54 am
by Tony
Did you use the level command to set the time ?

Tony

Re: Compiling Crafty

Posted: Wed Apr 25, 2007 3:30 am
by Robert Pope
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.

Re: Compiling Crafty

Posted: Wed Apr 25, 2007 9:00 pm
by bob
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.

Re: Compiling Crafty

Posted: Thu Apr 26, 2007 2:12 am
by Robert Pope
I'm using MS Visual C++ 2005 Express.

Re: Compiling Crafty

Posted: Mon Oct 08, 2007 8:04 pm
by NJDenson
Did you ever get crafty to compile via Visual Studio 2005. If so can I get your assistance.

Re: Compiling Crafty

Posted: Tue Oct 09, 2007 2:16 am
by Robert Pope
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?

Re: Compiling Crafty

Posted: Tue Oct 09, 2007 4:09 am
by NJDenson
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