Page 1 of 1

Glaurung 0.2.1

PostPosted: 05 Feb 2005, 23:20
by Tord Romstad
After working the whole day in a futile attempt to fix the opening book problems with Glaurung 0.2.0 in Windows, I must simply admit defeat and realize that Glaurung's opening book is probably never going to work when the program is built with a real Windows compiler.

I have now updated Glaurung 0.2.0 to the new version 0.2.1. This time the Windows executable is compiled with the Cygwin compiler. This has two unfortunate consequences: The executable is considerably slower than those Dann compiles, and the program requires cygwin1.dll (not included in the download). I am not happy about this, but unfortunately there is no other choice. A slow and somewhat inconvenient Glaurung for Windows is probably better than no Glaurung for Windows.

If somebody wants to try to make Glaurung's book code work in Windows (and especially with the Microsoft compiler), I will gladly try to assist. It doesn't seem to be easy, though.

Apart from the book code, there are no differences between Glaurung 0.2.0 and 0.2.1.

Those of you who downloaded the Windows opening book for 0.2.0 will unfortunately have to download again. The old book file will not work with the new version.

Tord

Re: Glaurung 0.2.1

PostPosted: 05 Feb 2005, 23:38
by Heinz van Kempen
Hi Tord :) ,

please take a look at my proposal in AEGT Subforum.

Best Regards
Heinz

Re: Glaurung 0.2.1

PostPosted: 06 Feb 2005, 00:04
by Tord Romstad
Heinz van Kempen wrote:Hi Tord :) ,

please take a look at my proposal in AEGT Subforum.

Hi Heinz,

I'll consider this tomorrow. I am too tired and frustrated right now.

Tord

Re: Glaurung 0.2.1

PostPosted: 06 Feb 2005, 00:06
by Alessandro Scotti
Tord Romstad wrote:If somebody wants to try to make Glaurung's book code work in Windows (and especially with the Microsoft compiler), I will gladly try to assist. It doesn't seem to be easy, though.



Hi Tord,
I will happily take a break from my KPK recognizer and look into that problem! :) However, if possible you should send me just the bare minimum necessary to reproduce it (or the full code, but configured in a way that it goes straight into the relevant part) as well as a detailed sample of the expected result. It's now 0:09 AM and I can work on it two or maybe three hours at most. After that, it will probably shift to next monday... :-(

Re: Glaurung 0.2.1

PostPosted: 06 Feb 2005, 00:24
by Tord Romstad
Alessandro Scotti wrote:
Tord Romstad wrote:If somebody wants to try to make Glaurung's book code work in Windows (and especially with the Microsoft compiler), I will gladly try to assist. It doesn't seem to be easy, though.



Hi Tord,
I will happily take a break from my KPK recognizer and look into that problem! :) However, if possible you should send me just the bare minimum necessary to reproduce it (or the full code, but configured in a way that it goes straight into the relevant part) as well as a detailed sample of the expected result. It's now 0:09 AM and I can work on it two or maybe three hours at most. After that, it will probably shift to next monday... :-(


Thanks Alessandro,

This is a very generous offer! Don't waste too much time on it if it is boring and frustrating.

Download this special version of the source code. It contains a "book" command which can be used to print book statistics for the current position. Compile the program, run it from the command line, and type "book" (without the quotes, of course). The correct output is the following:
Code: Select all
book
e2e4 (+42980, =55832, -30896), 54%, n=129708, p=0.417905
d2d4 (+37420, =50441, -23817), 56%, n=111678, p=0.359814
g1f3 (+10305, =16488, -6813), 55%, n=33606, p=0.108275
c2c4 (+10094, =14052, -6311), 56%, n=30457, p=0.098128
g2g3 (+1101, =1531, -747), 55%, n=3379, p=0.010886
b2b3 (+264, =337, -246), 51%, n=847, p=0.001819
f2f4 (+166, =242, -188), 48%, n=596, p=0.001280
b1c3 (+101, =114, -103), 49%, n=318, p=0.000683
b2b4 (+73, =60, -60), 53%, n=193, p=0.000621
g2g4 (+16, =8, -6), 66%, n=30, p=0.000322
d2d3 (+14, =31, -21), 44%, n=66, p=0.000095
e2e3 (+12, =16, -15), 46%, n=43, p=0.000062
c2c3 (+8, =7, -8), 50%, n=23, p=0.000049
a2a3 (+5, =9, -12), 36%, n=26, p=0.000039
h2h3 (+3, =1, -10), 25%, n=14, p=0.000021

I am not sure it is an easy task, though. My book code is basically just a quick hack, and is poorly commented and not very readable.

Tord

Re: Glaurung 0.2.1

PostPosted: 06 Feb 2005, 00:56
by Alessandro Scotti
Hi Tord,
try fopen( ..., "rb" );
:D

Re: Glaurung 0.2.1

PostPosted: 06 Feb 2005, 01:30
by GeoffW
Hi Tord

I have been tinkering :D . I dont understand the code logic in the hour or so I spent on it but this might give you a few ideas for when you are rested and fancy tackling the problem again.

I know this probably doesnt make sense but my guess was that it was more of a logic problem than a weird compiler version problem.
With my MS VS6 compile I was seeing Arena choke as it was getting 2 best moves from Glaurung ?

Experimenting I had a hack in think.c to add a global flag
Code: Select all
  if(!inf && GPly < 60) {
    move_t book_move;
    book_move = pick_book_move(Book, Pos.key);
    if(book_move != 0)
   {
      printf("bestmove ");
     print_move(book_move);
     printf("\r\n");
     gotBookMove = TRUE;    /*#GW */
     return;
    }
  }

then in uci.c

 if (!gotBookMove && RootPV[0] != 0)   /* #GW */
  {
            printf("bestmove ");
            print_move(RootPV[0]);
  }
  else
  {
           /* it was set as it was a book move, so clear it */
           gotBookMove = FALSE;
  }

//  #GW remove this to simplify the problem 
//  if(RootPV[1]) {
//    printf("ponder "); print_move(RootPV[1]);
//  }


As it was all guesswork I didnt expect it to work, but it does seem to fix the problem here. Glaurung does seem to be using its book now for both black and white. Didnt test it for too long though as it is getting late.

Hope this helps

Regards Geoff

Re: Glaurung 0.2.1

PostPosted: 06 Feb 2005, 05:50
by Jon Kreuzer
I compiled Glaurung 0.2.0 with MSVC6.0 for windows and played it a few games against Slow Chess. It seems to work okay, but I can't be sure. I barely have the patience to actually test things with my own chess engine =).

Changes:
-uses __int64
-whenever a book entry is read, the order of the bytes are reversed
-fopen uses "rb" instead of "r"
-if a move is in the book, sets PV to book move and returns instead of sending it with a printf.

In case this hasn't already been done, here's a link for Tord (you can put it on your website if it does work and I didn't mess anything up.):
http://www.3dkingdoms.com/chess/Glaurung20.zip

Re: Glaurung 0.2.1

PostPosted: 06 Feb 2005, 05:54
by Pallav Nawani
Hi

This is unrelated to the topic here, but why don't you add your website to your profile (And signature)? Makes it easier to get to your website. :D

Best regards,
Pallav

Re: Glaurung 0.2.1

PostPosted: 06 Feb 2005, 10:42
by GeoffW
Hi

Just a quick confirmation for Tord, Jon's version seems to work fine for me too. Jon's last fix was in essense the same as my tweak except Jon had done it the tidy way.

Can somebody stick a sneaky Sleep(10) in somewhere and send Tord the source code back, Glaurung is beating my program far too easily :mrgreen:

Geoff

Re: Glaurung 0.2.1

PostPosted: 06 Feb 2005, 11:16
by Anonymous
A 10% faster G4 executable is on its way to you. The G5 version should also be faster but I cannot test it!

Re: Glaurung 0.2.1

PostPosted: 06 Feb 2005, 18:54
by Tord Romstad
[quote="GeoffW"]Can somebody stick a sneaky Sleep(10) in somewhere and send Tord the source code back,[/code]

No need to do that, I think. I seem to manage to do something equivalent myself, without any help from others. Glaurung is getting slower all the time. Below 200 kN/s on my G5 1.8 GHz now. :(

Tord