CPW-Engine

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Dann Corbit, Harvey Williamson

PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

CPW-Engine

Post by PK »

I'm glad to announce a beta release of the CPW-Engine code, constituting a part of the Chessprogramming Wiki. It can be viewed at:

http://chessprogramming.wikispaces.com/CPW-Engine

I consider this code a public domain, not even a GPL.

CPW-Engine is a didactic project, undertaken by myself and Edmond Moshammer a couple of months ago. Its strength is comparable to Gerbil and Faile (it scored the same 5,5/11 in ChessWar XIII F, albeit earning slightly lower rating). Its philosophy, however, is quite different.

CPW-Engine was meant to be a showcase, presenting various techniques without making full use of their potential. Special care has been taken to show, comment and explain things that some time ago were rather lacking in resources. That was the reason for adding futility pruning and some quiescence search stuff

Features:

- 0x88 board
- alpha-beta search with null move, transposition table, PVS and futility pruning
- handling of a SAN opening book
- delta pruning in quiescence search
- code of two different evaluation functions: one with king tropism and lazy eval, the other with a real king safety and eval hashtable

I'd be glad to see some code reviews and ideas how to simplify some parts of the program.

regards,
User avatar
Andres Valverde
Posts: 557
Joined: Sun Feb 18, 2007 11:07 pm
Location: Almeria. SPAIN

Re: CPW-Engine

Post by Andres Valverde »

Good work Pawel & al, cg !
Saludos, Andres
User avatar
Jim Ablett
Posts: 1343
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: CPW-Engine

Post by Jim Ablett »

Image
C.P.W build 050908 by the C.P.W Team

Windows win32 Intel compiler 10 p.g.o build.

http://www.mediafire.com/?lwgz0nmmjtr

Nice work Pawel, and everyone on C.P.W team. :)

Jim.
Carey
Posts: 313
Joined: Wed Mar 08, 2006 8:18 pm

Re: CPW-Engine

Post by Carey »

Jim Ablett wrote:Image
C.P.W build 050908 by the C.P.W Team

Windows win32 Intel compiler 10 p.g.o build.

http://www.mediafire.com/?lwgz0nmmjtr

Nice work Pawel, and everyone on C.P.W team. :)

Jim.
Jim;

Are you sure your build is working right?

I'm running some perft's from it and the time its reporting isn't even close to being accurate.

Real time clock is close to a minute and it's reporting 1341.

Assuming that's milliseconds, that'd be 1.3 seconds.

Assuming that's centi-seconds, that'd be 13.4 seconds.

There's nothing else running on the system, and even if there was, there's an extra core to take care of stuff and it still wouldn't be close.

So it can't be cpu time because on such a lightly loaded dual core system, there is nothing to effect the timing that much.


Looking at their code, it doesn't look too complicated. Assuming their Windows specific clock function works, of course.

It looks like it's supposed to be milliseconds. Meaning I should have gotten a timing closer to 58000 instead of 1340.


Any ideas?


(No, I haven't cut & pasted their code from the web site and compiled it myself yet. I just downloaded the windows build and tried it. I wont get a chance to compile it myself until at least tonight.)
User avatar
Jim Ablett
Posts: 1343
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: CPW-Engine

Post by Jim Ablett »

Hi Carey,

Looks like a time bug in the code.

Replace with this one (in util.cpp)

Code: Select all


#include <time.h>


void perft_start&#40;char * command&#41; &#123;

	clock_t begin, end;
	begin = clock&#40;);

	int depth;
	sscanf&#40;command + 6, "%d", &depth&#41;;

	printf&#40;"Performance Test\n");
	for &#40;int d=1;d<=depth;d++) &#123;
        end = clock&#40;)-begin;
		printf&#40;"%d&#58;\t%6.3f\t%d\n",d,end*&#40;1./CLOCKS_PER_SEC&#41;,perft&#40;d&#41;);
	&#125;
&#125;
Jim.
Carey
Posts: 313
Joined: Wed Mar 08, 2006 8:18 pm

Re: CPW-Engine

Post by Carey »

Jim Ablett wrote:Hi Carey,

Looks like a time bug in the code.

Replace with this one (in util.cpp)
Nope, that doesn't work either.

Now that I have time to look at the code more carefully I see that the original problem was the order of evaluation of parameters.

Code: Select all

	for &#40;int d=1;d<=depth;d++) &#123;
		printf&#40;"%d&#58;\t%d\t%d\n",d,gettime&#40;)-starttime,perft&#40;d&#41;);
	&#125;
It's putting the ending time onto the param stack before it's doing the perft.

C doesn't specify the order of evaluation, so it's perfectly acceptable for the perft to be done after the timing stuff.

Not sure if this is a one time bug or there might be similar issues in the rest of it.


That'll need to be done differently, of course.

I'm not sure how they'd want it done (a running total like the do now, or the more normal individual timing), but it would need to be something like:

Code: Select all

	for &#40;int d=1;d<=depth;d++) &#123;double p;
	    starttime = gettime&#40;);
	    p = perft&#40;d&#41;;
	    starttime = gettime&#40;)-starttime;
		printf&#40;"%d&#58;\t%d\t%d\n",d,starttime,p&#41;;
	&#125;
Also I see a couple of == issues in quiescence.cpp. It's concerning promotions. Not sure if it's intended or a bug.
Carey
Posts: 313
Joined: Wed Mar 08, 2006 8:18 pm

Re: CPW-Engine

Post by Carey »

Minor issue for my fix....

I thought perft was returning a double, in spite of it saying U64 just a few lines down...

Either way the printf format string needs to change, since a %d is inappropriate for either param type.

Considering the annoyances of trying to portably print out 64 bit integers, I'd suggest just doing it as a "%.0f" double.


All this is obvious. I just didn't want people to complain my fix was buggy on something so obvious. (It was... I just don't want people to point it out.... :) )


I wonder how CPWE would fare being run through SPLint....