Stockfish search function

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

whittenizer
Posts: 85
Joined: Sun May 29, 2011 11:56 pm
Location: San Diego

Stockfish search function

Post by whittenizer »

Hi all,

I've looked at the search.cpp and the first line in the "think" method as this:

static Book book;

The Book object is only used in this method, and the Book class is not static as far as I could see. Why is it static in this context? I got the stockfish source to work in a Silverlight project Im working on but only by removing the static keyword as this was the only error I was getting. Removing this keyword seems to have not created any issues.

Thanks for any feedback on this.

David
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Stockfish search function

Post by mcostalba »

whittenizer wrote:Hi all,

I've looked at the search.cpp and the first line in the "think" method as this:

static Book book;

The Book object is only used in this method, and the Book class is not static as far as I could see. Why is it static in this context? I got the stockfish source to work in a Silverlight project Im working on but only by removing the static keyword as this was the only error I was getting. Removing this keyword seems to have not created any issues.

Thanks for any feedback on this.

David
See Book's constructor and you will realize that if you define the book object as a local variable, book moves will be deterministic instead of pseudo-random.

BTW defining book object as static id _not_ an error in C++.
whittenizer
Posts: 85
Joined: Sun May 29, 2011 11:56 pm
Location: San Diego

Re: Stockfish search function

Post by whittenizer »

Ill have to look again then at the Book class. Thanks for your input.
whittenizer
Posts: 85
Joined: Sun May 29, 2011 11:56 pm
Location: San Diego

Re: Stockfish search function

Post by whittenizer »

Hi, one thing just wnated to clear up, I didnt mean to say that in general having the Book class static is an error, I was only getting that error in the context of what I was doing.

Anyways, I'm not a C++ person at all. I know enough though to create this wrapper so I can use it in my Silverlight project. Anyways, I think I'm on a good path now, and do appreciate your reply.

Thanks again.