The mere thought of multi-threading in C was scary enough... the realization that it will be the best approach for implementing the Winboard interface was very depressing. After some careful reading from various sites, I was pleasantly surprised. It it not hard after all (actually I find it as easy as Java's multi-threading!). Refer to the excellent tutorial by Adrian Worley.
It basically boils down to passing a function (Java eat your heart out!) to another function, which will then execute the function as a thread. Other elements such as critical sections, waiting for threads and juggling information between threads are straight forward and provided by the Windows API. The only drawback of this approach is the fact that my current implementation will not be platform independent (i.e. between Unix and Windows) as the Java implementation is (...here C will eat its heart out :)).
I have implemented crude move ordering, but I am not yet satisfied with speed increase I gained. I also got Arena to work for testing, once my WinBoard protocol (UCI later) is up and running.
2 comments:
hello jacko ! I write a chess engine in C too . Your blog is very interresting for me because I'm so beginer in C but my chess program named "Jars" play (so badly for the moment!)
For winboard , why don't you study the TSCP method (tom kerrigan chess program) ? It's relatively simple for interfacing your engine whith winboard (winboard forum will help you)
Good continuation in your engine , it's so dificult but really ecxiting ! Bye!
Hi anonymous - thanks for the post. Knowing I have readers is a great inspiration. I only wish I had more time to spend on my engine. I did have a look at TSCP, but I do not like the idea of blocking I/O, which means that I can't do pondering (which I want to add later). Regardless, the threading works like a charm. Good luck with your engine! Are you blogging it too?
Post a Comment