hello
my engine still doesn't have an eval: it just has PSQ table + mobility for the moment.
there are a ton of things I could do, but I just wonder where to start.
what is the most usefull thing to start adding/testing ?
thank you
lucas
writing an evaluation
Moderators: hgm, Rebel, chrisw
-
- Posts: 568
- Joined: Tue Dec 12, 2006 10:10 am
- Full name: Gary Linscott
Re: writing an evaluation
Roughly in order. And you can spend a lot of time on these .
Passed pawns.
Pawn structure.
King safety.
Passed pawns.
Pawn structure.
King safety.
-
- Posts: 2645
- Joined: Wed Mar 10, 2010 10:18 pm
- Location: Hamburg, Germany
- Full name: Srdja Matovic
Re: writing an evaluation
I suggest to choose a test suite first, for example the Bratko Kopec Test:what is the most usefull thing to start adding/testing ?
Then you can edit your evaluation and see how the changes affect your search.
--
Srdja
-
- Posts: 2645
- Joined: Wed Mar 10, 2010 10:18 pm
- Location: Hamburg, Germany
- Full name: Srdja Matovic
Re: writing an evaluation
Hi Lucas,
i took a look into your eval.c
not sure, but i think you should "flipflop" the sq for your psq-table instead of XORing with 070 :
..
Srdja
i took a look into your eval.c
return PSQTable[phase][piece][color ? sq : sq ^ 070];
not sure, but i think you should "flipflop" the sq for your psq-table instead of XORing with 070 :
#define FLIPFLOP(square) (((square)^7)^56)
...
return PSQTable[phase][piece][color ? sq : FLIPFLOP(sq)];
..
Srdja
-
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: writing an evaluation
Since 070 (octal) is 56 (decimal) the only difference between FLIPFLOP and the code of Lucas is the additional XORing with 7 which would also flip the file of the square.smatovic wrote:Hi Lucas,
i took a look into your eval.cnot sure, but i think you should "flipflop" the sq for your psq-table instead of XORing with 070 :return PSQTable[phase][piece][color ? sq : sq ^ 070];#define FLIPFLOP(square) (((square)^7)^56)
...
return PSQTable[phase][piece][color ? sq : FLIPFLOP(sq)];
But I don't think this would be necessary in DoubleCheck, and I also don't think it would be correct in the general case:
a) In DoubleCheck (looking at 1.1), all PSQ tables seem to be symmetrical so that flipping the files would not change any single value.
b) In the general case, by flipping also the file you would map g1 (from white viewpoint) to b8 (from black viewpoint) which could be incorrect in a program that has an asymmetrical king PSQ by intent, for instance. The normal mirroring of a position when flipping the colors does involve flipping the ranks only, at least if one of the castling rights is still present.
Btw that code is in psq.h, of course it is used indirectly in eval.c (eval_material).
Sven
-
- Posts: 2645
- Joined: Wed Mar 10, 2010 10:18 pm
- Location: Hamburg, Germany
- Full name: Srdja Matovic
Re: writing an evaluation
Code: Select all
{
0, 0, 0, 0, 0, 0, 0, 0,
50,50,50,50,50,50,50,50,
30,30,30,30,30,30,30,30,
5, 5, 5,10,10, 5, 5, 5,
3, 3, 3, 8, 8, 3, 3, 3,
2, 2, 2, 2, 2, 2, 2, 2,
0, 0, 0,-5,-5, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
},
if white is on B8 => index 54, then it should be mapped to index 9,
this is done by 54^7^56.
--
Srdja
-
- Posts: 2645
- Joined: Wed Mar 10, 2010 10:18 pm
- Location: Hamburg, Germany
- Full name: Srdja Matovic
Re: writing an evaluation
forget it, you are right.hmm, this table is from blacks point of view,
if white is on B8 => index 54, then it should be mapped to index 9,
this is done by 54^7^56.
--
Srdja
-
- Posts: 5106
- Joined: Tue Apr 29, 2008 4:27 pm
Re: writing an evaluation
Just a guess, but in this order I would guess:lucasart wrote:hello
my engine still doesn't have an eval: it just has PSQ table + mobility for the moment.
there are a ton of things I could do, but I just wonder where to start.
what is the most usefull thing to start adding/testing ?
thank you
lucas
1. Mobility - will go a long way by itself
2. Pawn structure - start with weak pawns and passed pawns.
3. King safety - hardest to do well but extremely important.
It's impossible to say which you need the most because if your program is out of balance, different things will affect it differently. But my guess is that if you do good mobility next you will get the single biggest payoff if done right. You may have to modify your piece square tables in conjunction with this if they were tuned without mobility.
Unfortunately, it's a huge black art how to do this. It's not difficult to come up with the most important set of features but how to weight them is a bear.