bonuses according to the type of attacking piece

Discussion of chess software programming and technical issues.

Moderator: Ras

liuzy

bonuses according to the type of attacking piece

Post by liuzy »

In chess evaluate function, many engines add bonus according to type of attacked enemy pieces and to the type of attacking piece, from knights to queens.
I don't know why we should give this kind of bonus.

Another question is when black queen is trapped by white bishop like this:
black king
\
black queen
\
white bishop
whether we should give some bonus to this pattern if white bishop is not well protected.
User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 6:57 pm
Location: Washington, DC

Re: bonuses according to the type of attacking piece

Post by Greg Strong »

Second question: Already handled. If it's not adequately protected, then quiescent search will figure that out.

First question: Can you give an example of a program that does this?
LiquidNitrogenOverclocker

Re: bonuses according to the type of attacking piece

Post by LiquidNitrogenOverclocker »

liuzy wrote:In chess evaluate function, many engines add bonus according to type of attacked enemy pieces and to the type of attacking piece, from knights to queens.
I don't know why we should give this kind of bonus.
See the Static Exchange Evaluator idea:

http://chessprogramming.wikispaces.com/ ... Evaluation
outAtime
Posts: 226
Joined: Sun Mar 08, 2009 3:08 pm
Location: Canada

Re: bonuses according to the type of attacking piece

Post by outAtime »

Adding a bonus to pieces which attack enemy pieces could be a way of estimating a positions overall potential for attack, much in the same way, a piece which defends another friendly piece could receive a bonus for its potential, or ability to defend said piece. Thus, a position with zero defense potential could be very bad for the side defending if the side "attacking" has a high attack potential. Also, pieces actively involved in important attack or defensive operations should logically be valued higher than pieces yet to find a useful function. A well posted knight may receive a bonus based purely on its 'square', however if it is not involved in any attack or defense from this square, it might be good to lower the value of the knight here, and try to place it somewhere more "active". Maybe even on the rim, or in a corner square could be better in some situations. That's at least part of the reason in many cases I would expect.
outAtime
User avatar
hgm
Posts: 28384
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: bonuses according to the type of attacking piece

Post by hgm »

liuzy wrote:Another question is when black queen is trapped by white bishop like this:
black king
\
black queen
\
white bishop
whether we should give some bonus to this pattern if white bishop is not well protected.
The point is that you want to answer the question if the Bishop is well protected enough by search, not by a much more unreliable static evaluation method. Giving a penalty for the Queen being pinned prevents a careless attitude of the program: it cnnot as easily decide to act like there is no problem, and stand pat based on the material it has on the board. The bonus suppresses the value of stand pat (hopefully enough to reject it). So the bonus then forces to program to try alternatives, in particular capturing the Bishop, to find out how well it was protected.

There is some danger in making the bonus to high: the Bishop might indeed be well protected, but there might have been other ways to save the Queen, (e.g. interposing a Bishop or Pawn between the Bishop and Queen), which you would not search in Quiescence search. So you should only tune the bonus to represent the disadvantage that the Queen side does not have a free move choice, but is forced to interpose a piece (which might now itself be pinned). You should not score it as if the Queen will be lost; that would make the program wildly optimistic, and it would start to sac large material just to get a curable pin of the Queen.

Now pins are much more difficult to cure than normal attacks, so no matter how large you make the bonus, frequently you will be off from the true score by a large amount. So if you already went to through the trouble of detecting these things in the first place, it would be better to use that info to give an extension, rather than a score correction. That would not hold for normal attacks on a high piece, which can almost always be solved.