Initiative

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Initiative

Post by Lyudmil Tsvetkov »

Well, this forum has become all Sedat and Frank's in the latest time, but just a very brief topic of mine.

I am very interested to know how do you engine programmers measure initiative in your engines?

Do you have a special algorithm for this, or is initiative just one of those elusive concepts that are never formalised in terms of specific functions?

As a quick prelude, my understanding of how initiative can relatively accurately be measured in an algorithmic way.

Initiative is basically potential/latent attacks of certain pawns and pieces upon enemy pawns and pieces.
But you should know what to count.

I would count the following, which are most important:

- attacks of pawns upon enemy minors; give some 20cps for such a latent attack

- attacks of minors, knights and bishops, upon enemy queen; give some 10cps for such a latent attack

Other latent attacks are not that important, so you can safely skip them.
You can skip attacks of pawns upon enemy rooks or queen, as they are either too tactical in the case of the queen, or the enemy piece easily avoids them. You can also skip attacks of knights and bishops upon enemy rooks, as those are not that forceful.

So if you ask me what initiative is, I would say it is just latent attacks of pawns upon enemy minors and knight and bishop upon enemy queen, i.e. the bonus for such latent attacks.

You just check with a null move technique or otherwise the existing abovementioned attacks and quantify them. The same way as you would check for existing checks.

For example, in a specific position one side has bad development and is short of space, but it has a couple of the abovementioned latent attacks. If you do not consider initiative, you will simply think the first side is much much better with the other having no compensation at all. When you also count those latent threats, suddenly the score looks quite different.

And indeed, a couple of such existing latent threats usually mean that in a couple of moves, with the help of those threats, the second side will push away the enemy minors or queen, gaining space in the process and valuable time for its own pieces to develop properly. If your engine does not count initiative, it might wonder a lot where its supposed advantage has gone.

Again, existing threats are different from latent threats, with latent threats usually being far more common. So that just counting existing threats and missing latent threats is plain wrong. Also, positions where one of the sides has many, 3,5 or even 10 latent threats, while the other has none, or just one or 2, are frequent.

Finally, I think this is a basic evaluation term, and the time spent on doing the above checks in null-move mode or otherwise are going to pay off in terms of accuracy of play.

How do your engines measure initiative, and what do you think of the above concept?
Frank Quisinsky
Posts: 6808
Joined: Wed Nov 18, 2009 7:16 pm
Location: Gutweiler, Germany
Full name: Frank Quisinsky

Re: Initiative

Post by Frank Quisinsky »

Hi Lyudmil,

just explain:
Playing on a small Rating List only and try out to create with the games I produce a good opening book (never the book will be good I think). Try out to give information about playing styles. OK, here I think (playing styles of engines) it's more interesting as strength of engines.

That is a small effort I try to make but ...
With a big spectacle around my own work ... typical Frank.
In reality it's only a small contribuiton, not more.

German's means that all own things must be in middle of focus. I too but in reality others do a lot of better things which much more effort.

Sedat for an example :-)

So, you will get my sorry!
If you read ... Frank ... you can ignore it :-)
Not very important what I do.

Have fun ...
Interesting message by yourself!
I let the others give an answere!

Best
Frank

... to your other thread!

Most important:
01. d4, Nf6
02. e4, c5
03. e4, e5, Nf3, Nc6, Bb5
...
later ...
c4 is more important as Nf3 (first move)
f4 isn't very important.

Most interesting in theory is ...
B12, B22, B33, B90, B42, C67, D15, D45, D85, E11, E12, E15 and maybe E94.

A lot of good lines here, very interesting for grandmasters and I think for Computer chess engines too.

But all in all ...
I think modern GM-Theory must not the same engines should play. In modern GM-Theory is A00-A99 rarely, Computer chess engines should be more play such openings. Same for the older "C" e4, e5 opening Systems (not Spanish).

Most Problems engines have with ...
1. d4, f5
1. e4, e6
and different King's Indian openings.

In my opinion should King's Indian a high priority in an opening book because it's good if the programmers find out here a bit to made the strategy for such difficult openings better.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Initiative

Post by Lyudmil Tsvetkov »

Frank Quisinsky wrote:Hi Lyudmil,

just explain:
Playing on a small Rating List only and try out to create with the games I produce a good opening book (never the book will be good I think). Try out to give information about playing styles. OK, here I think (playing styles of engines) it's more interesting as strength of engines.

That is a small effort I try to make but ...
With a big spectacle around my own work ... typical Frank.
In reality it's only a small contribuiton, not more.

German's means that all own things must be in middle of focus. I too but in reality others do a lot of better things which much more effort.

Sedat for an example :-)

So, you will get my sorry!
If you read ... Frank ... you can ignore it :-)
Not very important what I do.

Have fun ...
Interesting message by yourself!
I let the others give an answere!

Best
Frank

... to your other thread!

Most important:
01. d4, Nf6
02. e4, c5
03. e4, e5, Nf3, Nc6, Bb5
...
later ...
c4 is more important as Nf3 (first move)
f4 isn't very important.

Most interesting in theory is ...
B12, B22, B33, B90, B42, C67, D15, D45, D85, E11, E12, E15 and maybe E94.

A lot of good lines here, very interesting for grandmasters and I think for Computer chess engines too.

But all in all ...
I think modern GM-Theory must not the same engines should play. In modern GM-Theory is A00-A99 rarely, Computer chess engines should be more play such openings. Same for the older "C" e4, e5 opening Systems (not Spanish).

Most Problems engines have with ...
1. d4, f5
1. e4, e6
and different King's Indian openings.

In my opinion should King's Indian a high priority in an opening book because it's good if the programmers find out here a bit to made the strategy for such difficult openings better.
Sehr gut, Frank, sehr gut.

Immer weiter schreiben.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Initiative

Post by Lyudmil Tsvetkov »

OK, I meant something like that:

[d]r1q1nr1k/pp1b2b1/n2p2pp/2pP1p2/2B4B/3Q1N1P/PPP1NPP1/1R3RK1 b - - 0 12

At first glance, white should be much better:

- better mobility
- better piece psqt, all black pieces are on the 1st and 2nd ranks, while white's are much advanced
- bad black king safety, no pawns around the king
- badly placed black queen
- white has space advantage with the central pawn d5, etc.

Black has almost nothing to compensate, but, be careful, a couple of latent/potential attacks:

- g6 pawn threatens to advance g5 and attack the h4 bishop
- b7 pawn threatens to advance b5 and attack the c4 bishop
- Na6 threatens to jump to b4 and attack the enemy queen

All those are not existing, but just potential threats (you do not know if they will be played or not, in distinction to real threats), but, contrary to what you might think, they are very important and deserve a bonus.

So at first glance you think white is much better, then you could find equality because of those threats in a couple of moves, and, be certain, if you do a longer search, black should probably be winning. All this because of the abovementioned threats.

That is what initiative is all about. Black is bad, but has the initiative, which is also a simple eval term. If you do not take the above threats into consideration, you might wrongly think white is better in terms of eval.

It is all here, in the current node, but some concepts are veiled deeper than others.

Let your engines analyse a bit the above position, to see if black will not play g5, b5 and Nb4 at some point.
Frank Quisinsky
Posts: 6808
Joined: Wed Nov 18, 2009 7:16 pm
Location: Gutweiler, Germany
Full name: Frank Quisinsky

Re: Initiative

Post by Frank Quisinsky »

Hi Lyudmil,

very nice position you gave here!
Not sure with your opinion about the black position!

Black have good changes too. Queen site is to closed at first. Knight over b8 back to king site later ... rock on a8 should try to find the way to king site. Black King on h8 on a good position, more aero for reorganisation black rocks / queen / Knights

White pawn on d5 is really strong and indeed white pieces are for the moment better. Black position is very activ but difficult. It need a long time to bring black pieces on better positions. Maybe it need to many time and white will get more Advantage. But white play must be very exactly.

All in all I am thinking yes ... better position for white but more interesting for black. I think I would like to play more with black as with white.

A good position for Spark, Nirvanachess, Junior with black pieces.
Spark and Nirvanachess can play very aggressive without to forget the own king safty. Junior is very aggressive, more speculative with good ideas, humans never can find out.

A good chance to compare analyzes from Spark, Nirvana and Junior with Stockfish / Komodo!

:-)

A good position for engines like the sure and relaxed way too (with white pieces). Thinking on Naum / Rybka or GullChess. These engines will give you a good white analysing result and a bad black result, sure here.

Interesting are Critter analyses. Critter can produced best moves with pawns in open positions. These pawns later are on optimal positions for the comming soon late middlegame / early endgame. Pawn structure from black is speculative ... interesting here are analyzes with Critter.

Best
Frank
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Initiative

Post by Lyudmil Tsvetkov »

Frank Quisinsky wrote:Hi Lyudmil,

very nice position you gave here!
Not sure with your opinion about the black position!

Black have good changes too. Queen site is to closed at first. Knight over b8 back to king site later ... rock on a8 should try to find the way to king site. Black King on h8 on a good position, more aero for reorganisation black rocks / queen / Knights

White pawn on d5 is really strong and indeed white pieces are for the moment better. Black position is very activ but difficult. It need a long time to bring black pieces on better positions. Maybe it need to many time and white will get more Advantage. But white play must be very exactly.

All in all I am thinking yes ... better position for white but more interesting for black. I think I would like to play more with black as with white.

A good position for Spark, Nirvanachess, Junior with black pieces.
Spark and Nirvanachess can play very aggressive without to forget the own king safty. Junior is very aggressive, more speculative with good ideas, humans never can find out.

A good chance to compare analyzes from Spark, Nirvana and Junior with Stockfish / Komodo!

:-)

A good position for engines like the sure and relaxed way too (with white pieces). Thinking on Naum / Rybka or GullChess. These engines will give you a good white analysing result and a bad black result, sure here.

Interesting are Critter analyses. Critter can produced best moves with pawns in open positions. These pawns later are on optimal positions for the comming soon late middlegame / early endgame. Pawn structure from black is speculative ... interesting here are analyzes with Critter.

Best
Frank
Of course black is winning, as I have been playing the black pieces. :)

You mention a lot of engines, but I can not find a suitable partner.

Lately have been trying some games against weaker engines.

Score against Comet after 40 games: +37, -0, =3, so Comet managed just 3 draws, but I use more time. (when I think that when I played Comet for the first time, I was getting 1 draw in about 10 games, so score was completely reversed; seemingly 15 years playing engines improved my strength from getting 1 draw in 10 games against Comet to Comet getting 1 draw in 10 games,:) but again I use more time now, taking a relaxed approach)

Been trying also Rybka: whatever I do, white or black, Rybka always gets lost positions. If I apply strictly time control, Rybka might beat me, but I do not care about that, the fact is that Rybka loses positionally all games.

Still afraid to try latest SF, people say it was a monster...
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: Initiative

Post by cdani »

Lyudmil Tsvetkov wrote:OK, I meant something like that:

[d]r1q1nr1k/pp1b2b1/n2p2pp/2pP1p2/2B4B/3Q1N1P/PPP1NPP1/1R3RK1 b - - 0 12
Hi!
Modern engines tend to understand this type of position only analyzing it, because they give bonus in the search order to moves than arises thanks to the latent initiative, and consequently they find rather quickly the logical result of the position. So the static eval is bad but is nicely compensated by search. This does not imply that must be leaved like this. Of course can be improved.
jorose
Posts: 358
Joined: Thu Jan 22, 2015 3:21 pm
Location: Zurich, Switzerland
Full name: Jonathan Rosenthal

Re: Initiative

Post by jorose »

This an interesting example but it illustrates initiative very differently then you might think. Mainly due to the fact that the only reason black is doing even remotely well is because it is his turn to move! He can push back whites pieces, which for the most part aren't actually that well placed (eg the Bc4 and Ne2 are akward and Bh4 risks becoming locked out after g5 and f4) If you turn the tables however and put white to move you really see what initiative actually is. White can play Nf4! and use his tempo to activate his knight and threaten Nxg6+ followed by Nxf8, after the natural Kh7 white again can use his tempo and play Ne6! Again threatening Nxf8 and suddenly the Bishop on c4 is useful!

That is initiative, it has much more to do with tempo than anything more abstract. As such the easiest way to describe it to an engine is let him calculate lines. If he can see that he can improve his position by force, that is enough for me.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Initiative

Post by Lyudmil Tsvetkov »

cdani wrote:
Lyudmil Tsvetkov wrote:OK, I meant something like that:

[d]r1q1nr1k/pp1b2b1/n2p2pp/2pP1p2/2B4B/3Q1N1P/PPP1NPP1/1R3RK1 b - - 0 12
Hi!
Modern engines tend to understand this type of position only analyzing it, because they give bonus in the search order to moves than arises thanks to the latent initiative, and consequently they find rather quickly the logical result of the position. So the static eval is bad but is nicely compensated by search. This does not imply that must be leaved like this. Of course can be improved.
Hi Daniel.

Probably you do not need to apply a null-move technique at all.

A static eval can be sufficient, at least in the case of latent pawn threats.

Most engines have bonus for direct/existing/real pawn threats, i.e. the case when to the left or right of the pawn on the rank in front it there is an enemy piece. Latent threats of course would be the case when to the left or right of the pawn not, one, but 2 ranks in front it, there is a minor piece. In the case of a pawn on the 2nd rank, that would be to the left or right of the pawn 3 ranks in front of it there is an enemy minor.

So for latent pawn threats you could have everything codified as a static eval, no need to do anything else. Why have direct/real pawn threats, especially when they give you some elo increase, and skip latent pawn threats? Believe me or not, latent pawn threats are much more important than real/direct pawn threats, for the simple reason that they are much more numerous. You will usually have just 1 or 2 direct pawn threats, but at the same time might have several latent pawn threats.

It is not in vain that many authors consider initiative in chess a very important thing.

What concerns latent attacks of minors on enemy queen, maybe an easy solution could also be figured out in static eval, you as a programmer should know that better.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Initiative

Post by Lyudmil Tsvetkov »

jorose wrote:This an interesting example but it illustrates initiative very differently then you might think. Mainly due to the fact that the only reason black is doing even remotely well is because it is his turn to move! He can push back whites pieces, which for the most part aren't actually that well placed (eg the Bc4 and Ne2 are akward and Bh4 risks becoming locked out after g5 and f4) If you turn the tables however and put white to move you really see what initiative actually is. White can play Nf4! and use his tempo to activate his knight and threaten Nxg6+ followed by Nxf8, after the natural Kh7 white again can use his tempo and play Ne6! Again threatening Nxf8 and suddenly the Bishop on c4 is useful!

That is initiative, it has much more to do with tempo than anything more abstract. As such the easiest way to describe it to an engine is let him calculate lines. If he can see that he can improve his position by force, that is enough for me.
Wrong.

Eval is first. You should know which positions to pick up and which not, and for this you need accurate eval.

My suggestion tries to do precisely that: put forward an algorithm that would consider in static eval something that would otherwise only be possible to consider by trying out a sequence of moves, sometimes a long one. The main point behind it is that the more latent threats you have, the more promising your position, even though you might have no direct attacks at all currently.

It does not matter whose move it is, even if the turn of the side to move would change the outcome of the game, the multiple latent threats will still weigh in one way or another; you could lose the game slower, draw, etc. They do weigh in, as they are an important eval term.

Initiative is huge portion of the game, and I am pretty sure engines do not handle this perfectly...

Direct pawn threats are the current short-lasting initiative. Latent pawn threats are the far bigger portion of what initiative constitutes.