Moderator: Andres Valverde
I also wonder how other free source code programs or non free source code programs evaluate mobility(I am too lazy to look at the sources if free programs espacially when there is a chance to understand faster by reading replies)
Fabien Letouzey wrote:Hi Uri,
It will be hard to draw conclusions if you make two changes at once:
1) leaf evaluation (true measure at the leaves instead of fast approximation from previous nodes)
2) different weighting; if I understand, you value mobility for all pieces in the same way.
If you have computer time available, I suggest you try 1) first with the same weighting you are already using. My intuition is that the 20%-max slow down (with naive code such as mine) will not be visible strength-wise because of better accuracy once in a while. Of course we won't know before we try.
In any case, I think it's easier to try different combination schemes while using full-leaf evaluation (say at least that feature) and only then consider a faster approximation.
Fabien.
Unlike fruit my evaluation of mobility consider pins (for example knight that is pinned has no mobility) and I am not sure if it is a good idea.
Uri Blass wrote:I also wonder how other free source code programs or non free source code programs evaluate mobility
Fabien Letouzey wrote:Hi Uri,
It will be hard to draw conclusions if you make two changes at once:
1) leaf evaluation (true measure at the leaves instead of fast approximation from previous nodes)
2) different weighting; if I understand, you value mobility for all pieces in the same way.
If you have computer time available, I suggest you try 1) first with the same weighting you are already using. My intuition is that the 20%-max slow down (with naive code such as mine) will not be visible strength-wise because of better accuracy once in a while. Of course we won't know before we try.
In any case, I think it's easier to try different combination schemes while using full-leaf evaluation (say at least that feature) and only then consider a faster approximation.
Fabien.
// Primitive mobility eval
for( ; *mvp; mvp++)
{
tosq = sq + *mvp;
while((tosq & 0x88) == 0 && gi.brd[tosq] == NULL) {
mcount++;
tosq += *mvp;
}
if((tosq & 0x88) == 0)
{
tmpscore += pmob[col][gi.brd[tosq]->col][gi.brd[tosq]->pc];
// Possible pin
if(delta == *mvp && gi.brd[tosq]->col == rcol)
{
tmp = gi.brd[tosq]->pc;
do {
tosq += *mvp;
} while((tosq & 0x88) == 0 && gi.brd[tosq] == NULL);
if(tosq == ksq[rcol])
tmpscore += pin_bonus[tmp];
}
}
}
tmpscore += (mcount*2);
score[col] += tmpscore;
if((tosq & 0x88) == 0)
gi.brd[tosq] == NULL
while((tosq & 0x88) == 0 && gi.brd[tosq] == NULL) {
mcount++;
tosq += *mvp;
}
if((tosq & 0x88) == 0)
{
// Calculate mobility score.
// gi.brd[tosq]->col is the color of the piece on the position tosq
// gi.brd[tosq]->pc is the piece on the position tosq on the board.
tmpscore += pmob[col][gi.brd[tosq]->col][gi.brd[tosq]->pc];
// Now since we have hit an occupied square, it is possible that we
// may be pinning an opponent piece to the king. To see that I first
// check that if I go in the current direction, I can reach the king
// that is delta == *mvp
// delta is the kings direction
// I also check that it is an opponent piece.
// Perhaps I should also check that it is not a pawn.
// Possible pin
if(delta == *mvp && gi.brd[tosq]->col == rcol)
{
tmp = gi.brd[tosq]->pc;
// Now continue moving in the same direction until we are
// out of board, or we hit a piece
do {
tosq += *mvp;
} while((tosq & 0x88) == 0 && gi.brd[tosq] == NULL);
// If we hit a piece check whether it is opponent king. If so,
// give a pinning bonus.
if(tosq == ksq[rcol])
tmpscore += pin_bonus[tmp];
}
}
Daniel Shawul wrote:Did any one consider to evluate pinning other more valuable pieces
than the king?
I don't expect any improvement from mobility eval, but i expect an improvement on my king safety eval, becaue pinned rooks and pinned queens are major threats there.
daniel
Dann Corbit wrote:If you use bitboards, you can calculate all pins and even half-pins for free.
Consider a bishop ray trace or a rook ray trace along some line.
For every one of the [at most] 127 possible distinct bit patters along his ray of attack, you can precompute all the results and store them in a table.
Return to Programming and Technical Discussions
Users browsing this forum: No registered users and 15 guests