int bishop_mobility(int squareb)
{
int d, ofs, s = 0;
for (d = 0; d < 4; d++)
{
ofs = b_offsets[d];
for (d = squareb + ofs; board[d] == npiece; d += ofs)
s++;
}
return s;
}
returns correct score in the 1 bishop w/kings position. Im gonna try this with rooks and queens too. I think it will be less expensive because the other code seemed to be returning double scores.
int bishop_mobility(int squareb)
{
int d, ofs, s = 0;
for (d = 0; d < 4; d++)
{
ofs = b_offsets[d];
for (d = squareb + ofs; board[d] == npiece; d += ofs)
s++;
}
return s;
}
returns correct score in the 1 bishop w/kings position. Im gonna try this with rooks and queens too. I think it will be less expensive because the other code seemed to be returning double scores.
This code is not correct
p was correct but marco forgot to define it.
It is not logical to have a loop with d twice when one loop is inside the other loop.
int b_offsets[] = { 11, -11, 13, -13 };
int bishop_mobility(int squareb)
{
int d, ofs, s = 0;
for (d = 0; d < 4; d++)
{
ofs = b_offsets[d];
for (p = squareb + ofs; board[p] == npiece; p += ofs)
s++;
}
return s;
}
Shouldn't "p" be "d" ? or is p new.. I dont see int p.
No
You should replace
int d, ofs, s = 0; by
int p,d, ofs, s = 0;
You have 4 variables and marco forgot to define p
Meaning of the variables:
1)d is the direction in the board 0-3
2)ofs is the difference between squares in the relevant direction
3)p is the square on the board that the bishop can move into it.
4)s is the number of squares that the bishop controls.
again, I feel I am running into a double score when using "p". Im not sure what it is. 3.97 seems correct (3.25 bishop value + 7 squares mobility * bme +/- kings position)
I think that a score of 10 centi-pawns for one square is too high for mobility and I also think that it is not the best to have a linear mobility but it is still better than no mobility.
I suggest that you use bme=5 and not bme=10 and I believe that it should be productive relative to no mobility evaluation.
outAtime wrote:I can keep "p" but I'll need to adjust the other values - 1/2 I guess. ? I just don't know why the score seems to double with "p".
I do not know but if the score that you have is based on search and not static evaluation then it is possible that the bishop get 13 squares and not 7 squares because search can push the bishop to the centre of the board when it has 13 squares.