2 Dh5?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

2 Dh5?

Post by Henk »

My chess program uses an evaluation with Mobility(=MoveCount), KingSafety and MaterialCount only.

Now he playes e4, e5, Dh5 ?

What can I do about this. I also encounter Ld3 blocking his own d2 centre pawn.

I removed piece square table because I read that it did not scale well on higher levels.
tpetzke
Posts: 686
Joined: Thu Mar 03, 2011 4:57 pm
Location: Germany

Re: 2 Dh5?

Post by tpetzke »

What can I do about this.
Write a smarter eval. If your mobility bonus is really depending on the total number of moves one side has the move Qh5 seems very natural.

Usually mobility is evaluated per piece and a different bonus if assigned to the number of possible moves per piece type. The mobility bonus for a queen is usually much smaller per available move than the bonus for lets say a knight.

Thomas...
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: 2 Dh5?

Post by Sven »

Hi Henk,

you might try giving queen mobility a smaller weight compared to knight/bishop mobility. Something like queen=2, rook=3, knight=4, bishop=5 (i.e. each available knight move counts roughly twice as much as a queen move) might help as a start, of course you must test what works best for you. Especially in the opening a high queen mobility can be misleading, therefore sooner or later you will see the need to address the task of dealing with different game phases in your evaluation function.

Blocking center pawns with a minor piece, like Bd3, can be avoided with different heuristics. One is to assign a bonus for pawns on d4,d5,e4,e5. Another is to assign a penalty for a white pawn on d2 (e2) if d3 is occupied, and vice versa for black. Both heuristics also serve for other purposes as well, and both overlap. Again, test what works best for you.

As to using piece square table, most programs use it. Whether your program works better with or without it can't be decided by reading what others write about it, you must actually test it. Setting up a reasonable testing framework is one of the essential parts of chess programming today.

Sven
User avatar
velmarin
Posts: 1600
Joined: Mon Feb 21, 2011 9:48 am

Re: 2 Dh5?

Post by velmarin »

I guess if the program is in the early stages of evolution, there is little synchronization,
Queen h5, mobility might look much attack, and score high.
(Beginners humans players equal)

Or that this valued statically.
Bishop d3 or d6, is common, protect pawn and develop piece,
Ippolit engines play equal without books, few plays later.

You have to tune again, little by little.
All synchronized, without too many ups and downs between the pieces.
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: 2 Dh5?

Post by Henk »

Mobility is the number of legal moves. Maybe this should be the number of plausible moves. For instance if the white queen is attacked the mobility of other white pieces should not be counted if they do not eliminate the attacker or perform a counter attack on black queen or king.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: 2 Dh5?

Post by Sven »

Henk wrote:Mobility is the number of legal moves. Maybe this should be the number of plausible moves. For instance if the white queen is attacked the mobility of other white pieces should not be counted if they do not eliminate the attacker or perform a counter attack on black queen or king.
This would only make sense when analyzing the impact of each move statically, i.e. does it eliminate the attacker, is it a counter attack etc. But that seems to be far too expensive for a static positional evaluation function, and even if you would try it you would get too many misevaluations since you include tactical aspects into the positional evaluation and tactics need a good search to be resolved correctly.

Sven
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: 2 Dh5?

Post by Henk »

Sven Schüle wrote:
Henk wrote:Mobility is the number of legal moves. Maybe this should be the number of plausible moves. For instance if the white queen is attacked the mobility of other white pieces should not be counted if they do not eliminate the attacker or perform a counter attack on black queen or king.
This would only make sense when analyzing the impact of each move statically, i.e. does it eliminate the attacker, is it a counter attack etc. But that seems to be far too expensive for a static positional evaluation function, and even if you would try it you would get too many misevaluations since you include tactical aspects into the positional evaluation and tactics need a good search to be resolved correctly.

Sven
Yes I also think that it would be too expensive. Maybe a very rudimentary check.

By the way we also have KingSafety. KingSafety cannot be checked statically, but it is a necessary element of evaluation.Maybe introduce a QueenSafety, or a more generic Safety.

Or maybe Mobility concept makes no sense or should include AttackCount.
User avatar
hgm
Posts: 27793
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: 2 Dh5?

Post by hgm »

Henk wrote:Mobility is the number of legal moves.
If you use that definition, than it would be a very bad idea to use mobiity as a term in your evaluation. In Chess extra Knight moves are worth much more than extra Queen moves, as the extra Knight moves are essential for the Knight to manoeuvre, while the Queen has so many moves that she gets anywhere easily anyway.

An even better way is to use a non-linear mobility correction per piece. An extra move on a piece that already has 10 moves is worth much less than an extra move on a piece that only has one.

You should also ask yourself why Qh5 is a poor move, and what you have done to give the engine that insight. On h5 the Queen has fantastic mobility, so what are you grumbling about? That it is a bad idea to put a Queen in the center where it is subject to easy attack by all kinds of inferior pieces? Then you should give it a PST penalty for being in the center to express that.

I should add that tardiness in developing pieces can also be a consequence of having too small a Pawn-push bonus. Minimax does not automatically do the best move, because that move gives you the same score increase when you do it later. So it does not care whether it does a good move that you gave an enormous score on ply 1, or do a few time-wasting moves first, and then do it on ply 9. To avoid time-wasting moves, like a Queen being chased around the board by constant attacks by developing opponent pieces, you really must see to it that there are enough purposeful moves to fill the entire search depth.
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: 2 Dh5?

Post by Henk »

hgm wrote:
Henk wrote:Mobility is the number of legal moves.
If you use that definition, than it would be a very bad idea to use mobiity as a term in your evaluation. In Chess extra Knight moves are worth much more than extra Queen moves, as the extra Knight moves are essential for the Knight to manoeuvre, while the Queen has so many moves that she gets anywhere easily anyway.

An even better way is to use a non-linear mobility correction per piece. An extra move on a piece that already has 10 moves is worth much less than an extra move on a piece that only has one.

You should also ask yourself why Qh5 is a poor move, and what you have done to give the engine that insight. On h5 the Queen has fantastic mobility, so what are you grumbling about? That it is a bad idea to put a Queen in the center where it is subject to easy attack by all kinds of inferior pieces? Then you should give it a PST penalty for being in the center to express that.

I should add that tardiness in developing pieces can also be a consequence of having too small a Pawn-push bonus. Minimax does not automatically do the best move, because that move gives you the same score increase when you do it later. So it does not care whether it does a good move that you gave an enormous score on ply 1, or do a few time-wasting moves first, and then do it on ply 9. To avoid time-wasting moves, like a Queen being chased around the board by constant attacks by developing opponent pieces, you really must see to it that there are enough purposeful moves to fill the entire search depth.
Ok my evaluation function is much too simple.

Mobility should be non-linear. I forgot that mobility is the most expensive factor in evaluation. It iterates over all legal moves.

Maybe I should count all moves for these are constant per [piece, field] and can be pre computed.

By the way I noticed that my chess program has serious bugs again, so I should go back to the start, eliminate as much as possible. It plays at least 200 ELO worse than before my latest changes. The nice thing is that I also have forgotten to make a backup. Trouble, trouble, trouble.
Gerd Isenberg
Posts: 2250
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: 2 Dh5?

Post by Gerd Isenberg »

Henk wrote:My chess program uses an evaluation with Mobility(=MoveCount), KingSafety and MaterialCount only.

Now he playes e4, e5, Dh5 ?

What can I do about this.
A common term is a penalty for too early queen development related to the number of none developed light pieces (knights and bishops), i.e. something like this:

Code: Select all

tooEarlyQueenPenalty = max(1, distance[d1][qSq]) * max(0, 3-nNoneDevLight);