I've implemented a pawn hash table, this gave a -12 elo. Not entirely unexpected as the only pawn code is the passed pawn code.
Tried adding countNDoublePawns and countNIsolatedPawns but those gave a -13 elo.
Two questions:
- what is expected to gain from a pawn hash?
- is there anything wrong with those routines?
Code: Select all
int countNIsolatedPawns(const Board *const b, const ChessPiece * const *objs)
{
int n = 0;
const PlayerColor col = objs[0] -> getColor();
for(int i1=0; i1<16; i1++)
{
const ChessPiece *const cur = objs[i1];
if (!cur -> getAlive() || cur -> getType() != PAWN)
continue;
bool protector = false;
for(int i2=0; i2<16; i2++) {
const ChessPiece *const prot = objs[i2];
if (i1 == i2 || !prot -> getAlive() || prot -> getType() != PAWN)
continue;
if (col == WHITE && abs(prot -> getX() - cur -> getX()) == 1 && prot -> getY() < cur -> getY()) {
protector = true;
break;
}
else if (col == BLACK && abs(prot -> getX() - cur -> getX()) == 1 && prot -> getY() > cur -> getY()) {
protector = true;
break;
}
}
n += !protector;
}
return n;
}
Code: Select all
void countObjects(const ChessPiece * const *myObjects, int counts[6][8])
{
for(int i=0; i<16; i++) {
if (!myObjects[i] -> getAlive())
continue;
counts[myObjects[i] -> getType()][myObjects[i] -> getX()]++;
}
}
int nDoublePawns(int obCountsMe[6][8])
{
int cnt = 0;
for(int i=0; i<8; i++)
cnt += obCountsMe[PAWN][i] >= 2;
return cnt;
}
Code: Select all
pawnScore = -15 * (countNIsolatedPawns(b, myObjects) - countNIsolatedPawns(b, hisObjects));
// ppfc: pawns per file
pawnScore -= 15 * (countNDoublePawns(myPPFC) - countNDoublePawns(hisPPFC)); // MAX 15*4 = 60