Has anyone thought of a knight Danger king safety term?
I was reading the CPW's Knight Pattern article, and I came across the knight-fill section. My first thought when reading it was King Safety, or something of the sort.
My idea (if no-one else has thought of it) is based on the knight fill pattern.
ZirconiumX wrote:Has anyone thought of a knight Danger king safety term?
I was reading the CPW's Knight Pattern article, and I came across the knight-fill section. My first thought when reading it was King Safety, or something of the sort.
My idea (if no-one else has thought of it) is based on the knight fill pattern.
#define KNIGHT_FILL(knights) (KnightAttacks(knights) | knights)
int KnightDangerBonus = 30; // highly untuned
void KnightDanger(uint64_t knights, uint64_t opp_king, int * opening, int * endgame) {
int from;
int score;
uint64_t tmp;
while (knights) {
from = FirstOne(&knights);
for (tmp = 1ULL << from, score = KnightDangerBonus; !((tmp = KNIGHT_FILL(tmp)) & opp_king); score -= 10);
opening += score;
endgame += score;
}
}
The idea is that a good knight is usually close to the king. It is also a bonus for checks, in a way.
Just a stupid thought by me.
Matthew:out
This is actually covered by a broader concept known as king tropism:(http://chessprogramming.wikispaces.com/King+Safety#King Tropism). I implemented it in my engine using a table of bonuses indexed by piece type and distance to the king. It seems to help a bit in tests, but not by much...
You can give bonuses for checking pieces, but only if it is in a square not attacked by the opposition (read stockfish king safety eval).
ZirconiumX wrote:Has anyone thought of a knight Danger king safety term?
I was reading the CPW's Knight Pattern article, and I came across the knight-fill section. My first thought when reading it was King Safety, or something of the sort.
My idea (if no-one else has thought of it) is based on the knight fill pattern.
#define KNIGHT_FILL(knights) (KnightAttacks(knights) | knights)
int KnightDangerBonus = 30; // highly untuned
void KnightDanger(uint64_t knights, uint64_t opp_king, int * opening, int * endgame) {
int from;
int score;
uint64_t tmp;
while (knights) {
from = FirstOne(&knights);
for (tmp = 1ULL << from, score = KnightDangerBonus; !((tmp = KNIGHT_FILL(tmp)) & opp_king); score -= 10);
opening += score;
endgame += score;
}
}
The idea is that a good knight is usually close to the king. It is also a bonus for checks, in a way.
Just a stupid thought by me.
Matthew:out
This is actually covered by a broader concept known as king tropism:(http://chessprogramming.wikispaces.com/King+Safety#King Tropism). I implemented it in my engine using a table of bonuses indexed by piece type and distance to the king. It seems to help a bit in tests, but not by much...
You can give bonuses for checking pieces, but only if it is in a square not attacked by the opposition (read stockfish king safety eval).
Just a note. I don't think simple tropism works very well. That is, a single piece close to the king doesn't do a thing overall. Until it has friends. I've used a second-order function for years that works better than the simple tropism I used early in Crafty development. The idea is that the tropism bonus should not increase linearly as a piece gets closer, or as multiple pieces get closer, it should increase non-linearly to attract more pieces, which then provides attacking opportunities...
bob wrote:
Just a note. I don't think simple tropism works very well. That is, a single piece close to the king doesn't do a thing overall. Until it has friends. I've used a second-order function for years that works better than the simple tropism I used early in Crafty development. The idea is that the tropism bonus should not increase linearly as a piece gets closer, or as multiple pieces get closer, it should increase non-linearly to attract more pieces, which then provides attacking opportunities...
Agreed.
Does Crafty scale the resulting (king tropism) bonus using game phase? and if it does so, is the endgame score higher than middlegame score?
bob wrote:
Just a note. I don't think simple tropism works very well. That is, a single piece close to the king doesn't do a thing overall. Until it has friends. I've used a second-order function for years that works better than the simple tropism I used early in Crafty development. The idea is that the tropism bonus should not increase linearly as a piece gets closer, or as multiple pieces get closer, it should increase non-linearly to attract more pieces, which then provides attacking opportunities...
Agreed.
Does Crafty scale the resulting (king tropism) bonus using game phase? and if it does so, is the endgame score higher than middlegame score?
Yes, but it is the opposite of what you suggest. As material comes off the board, king safety becomes a less important issue. When all pieces are gone, what threats are left???
bob wrote:
Yes, but it is the opposite of what you suggest. As material comes off the board, king safety becomes a less important issue. When all pieces are gone, what threats are left???
would you mind to delete from the files what i've just said? lol
ZirconiumX wrote:Has anyone thought of a knight Danger king safety term?
I was reading the CPW's Knight Pattern article, and I came across the knight-fill section. My first thought when reading it was King Safety, or something of the sort.
My idea (if no-one else has thought of it) is based on the knight fill pattern.
bob wrote:
Yes, but it is the opposite of what you suggest. As material comes off the board, king safety becomes a less important issue. When all pieces are gone, what threats are left???
would you mind to delete from the files what i've just said? lol