## reproducing scan's eval function

Discussion about development of draughts in the time of computer and Internet.
MichelG
Posts: 244
Joined: Sun Dec 28, 2003 20:24
Contact:

### reproducing scan's eval function

Today, i used dragon to recreate the eval function of scan, using dragon's implementation.

For the test, i generated about 1 million games, and used the learning technique to learn the same 16 8-field patterns as scan does. Some differences though:
- dragon patterns includes kings.
- dragon uses 4 game fases

A 1000 game match at 6 ply between scan and dragon yielded 270 wins for scan, 289 for dragon and 441 draws. Which means scan's evaluation result is fairly easy to reproduce.

It's not close to being as strong as the 6x6 patterns though.

If anyone is interested i can post the bitboard code for evaluating these patterns

BertTuyt
Posts: 1477
Joined: Wed Sep 01, 2004 19:42

### Re: reproducing scan's eval function

Michel, thanks for posting.
Yes I would be interested in the bitboard code.
What learning algorithm did you use?
And last but not least, the match you are referring to, was that Dragon with the learned evaluation (but Dragon search)?
Or id you modify the Scan code so it can play a DXP game?
Or .... ?

Bert

MichelG
Posts: 244
Joined: Sun Dec 28, 2003 20:24
Contact:

### Re: reproducing scan's eval function

Dragon uses the conjugated gradient algorithm for computing the weights. It's pretty fast for 1 million positions, taking maybe 30 seconds or so. But you can imaging playing a million games takes a lot longer than that.

I matched dragon with the newly learned weights and the scan eval, both with dragon's search.

Here is some of the bitboard code.

The function to getPatHashSc() looks up a pattern value in a hashtable, for gamefase 'eeFase'.

Code: Select all

``````p=(2+((0LL<<58) + ((bb3->bbWhite&1597635LL)>>0) + ((bb3->bbBlack&1597635LL)<<2)) ^ ((19LL*((bb3->bbCrown>>0)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((1LL<<58) + ((bb3->bbWhite&3195270LL)>>1) + ((bb3->bbBlack&3195270LL)<<1)) ^ ((19LL*((bb3->bbCrown>>1)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((2LL<<58) + ((bb3->bbWhite&6390540LL)>>2) + ((bb3->bbBlack&6390540LL)>>0)) ^ ((19LL*((bb3->bbCrown>>2)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((3LL<<58) + ((bb3->bbWhite&12781080LL)>>3) + ((bb3->bbBlack&12781080LL)>>1)) ^ ((19LL*((bb3->bbCrown>>3)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((4LL<<58) + ((bb3->bbWhite&13087825920LL)>>13) + ((bb3->bbBlack&13087825920LL)>>11)) ^ ((19LL*((bb3->bbCrown>>13)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((5LL<<58) + ((bb3->bbWhite&26175651840LL)>>14) + ((bb3->bbBlack&26175651840LL)>>12)) ^ ((19LL*((bb3->bbCrown>>14)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((6LL<<58) + ((bb3->bbWhite&52351303680LL)>>15) + ((bb3->bbBlack&52351303680LL)>>13)) ^ ((19LL*((bb3->bbCrown>>15)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((7LL<<58) + ((bb3->bbWhite&104702607360LL)>>16) + ((bb3->bbBlack&104702607360LL)>>14)) ^ ((19LL*((bb3->bbCrown>>16)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((8LL<<58) + ((bb3->bbWhite&107215469936640LL)>>26) + ((bb3->bbBlack&107215469936640LL)>>24)) ^ ((19LL*((bb3->bbCrown>>26)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((9LL<<58) + ((bb3->bbWhite&214430939873280LL)>>27) + ((bb3->bbBlack&214430939873280LL)>>25)) ^ ((19LL*((bb3->bbCrown>>27)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((10LL<<58) + ((bb3->bbWhite&428861879746560LL)>>28) + ((bb3->bbBlack&428861879746560LL)>>26)) ^ ((19LL*((bb3->bbCrown>>28)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((11LL<<58) + ((bb3->bbWhite&857723759493120LL)>>29) + ((bb3->bbBlack&857723759493120LL)>>27)) ^ ((19LL*((bb3->bbCrown>>29)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((12LL<<58) + ((bb3->bbWhite&878309129720954880LL)>>39) + ((bb3->bbBlack&878309129720954880LL)>>37)) ^ ((19LL*((bb3->bbCrown>>39)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((13LL<<58) + ((bb3->bbWhite&1756618259441909760LL)>>40) + ((bb3->bbBlack&1756618259441909760LL)>>38)) ^ ((19LL*((bb3->bbCrown>>40)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((14LL<<58) + ((bb3->bbWhite&3513236518883819520LL)>>41) + ((bb3->bbBlack&3513236518883819520LL)>>39)) ^ ((19LL*((bb3->bbCrown>>41)&1597635LL))));
q+=getPatHashSc(eeFase,p);
p=(2+((15LL<<58) + ((bb3->bbWhite&7026473037767639040LL)>>42) + ((bb3->bbBlack&7026473037767639040LL)>>40)) ^ ((19LL*((bb3->bbCrown>>42)&1597635LL))));
q+=getPatHashSc(eeFase,p);
return(q);
``````

BertTuyt
Posts: 1477
Joined: Wed Sep 01, 2004 19:42

### Re: reproducing scan's eval function

A 1000 game match at 6 ply between scan and dragon yielded 270 wins for scan, 289 for dragon and 441 draws. Which means scan's evaluation result is fairly easy to reproduce.

It's not close to being as strong as the 6x6 patterns though.
Michel did yo do a test (or planning a test) of 1000 ( or so) games with the orginal Dragon 6x6 patterns compared with the 4x4 patterns, so we get a quantification of the strength difference?

Bert