Pawn Storm - Theory

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

D Sceviour
Posts: 330
Joined: Mon Jul 20, 2015 3:06 pm
Contact:

Pawn Storm - Theory

Post by D Sceviour » Wed Feb 14, 2018 4:58 pm

Here is an outline for the theoretical conditions for a pawn storm:

(1) Queen participation is necessary in a pawn storm attack. Take the queens off in this position and the pawn storm attack fizzles to nothing. Minor material is also important. The pawn storm attack weakens with less material. Take the minors off the board in the same position and the attack weakens.

[d]1k1r1r2/1ppq4/p1p1bp2/4p1pp/1Q2Pn2/3PNN1P/PPP2PP1/R4RK1 w - g6 0 17
(2) Development of attacking material is necessary before beginning a pawn storm on the king position. To estimate this, test a castling complete status flag. Otherwise, the defending king could castle to the opposite side of the board and out of trouble. However, once a side has castled, the king is free to wander back to the center of the board. After development, the king positions can be zoned to either the left or right side of the board.

(3) Challenge kings with some other piece beside the pawns. The pawns themselves cannot threaten the king. Test a king safety value. Otherwise, the pawns are over-extending and will be subject to attack. The early advance of pawns is a commitment to sacrifice of material at some point. Pawns will be picked off that threaten for too long without advancing. Another way of expressing this is to say there are multiple attacks on the horizon.

(4) Pawn storms are best when kings are on the opposite sides of the board. A pawn storm can still take place with kings that have castled on the same side. However, king safety of the attacking side is compromised once the king pawn structure has been weakened by advancing pawns. If a same side king pawn storm succeeds, it is more likely because of other tactical issues.

(5) Connected pawns can increase the strength of a pawn storm.

Blocked pawns are slightly less active than free pawns (or pawns that can advance). However, tuning blocked values appear unstable between a bonus and a penalty. Other dynamics are more important. Stockfish 9 adds a blocked/unblocked pawn value but that seems too hopeful. The mapped values are similar.

Pawns Storms are part of opening theory because they are effective with lots of material, Queen attacks, castling status, and the sacrifice of material for attack. The engine is calculating pawn storm structures very early in the search. Passed pawns are less an issue as it would be in the endgame.

There are different types of pawn structures not considered that might be called pawn storms. First, there is pawn shelter and how the shape of the defensive pawns may effect the safety value. That is a very complex polynomial problem. King safety should have already calculated some sort of pawn defect around the attacked king. This part only examines the attacking pawns. Second, a positional crush is different from a king side pawn storm. In the board below, blacks problem is lack of mobility. Therefore, additional pawn attack information is unnecessary. The black king is safe. The white pawns are squeezing, not sacrificing. If the position gets bad enough, black could end up in zugzwang - or tempo obligation to move.

[d]rnr3k1/1p1b1p2/4p1p1/1PPpP2p/pB6/3B4/5PPP/R4RK1 w - - 4 23
Stockfish 9 considers a pawn storm on the opposite side of the king position. This is a different type of pawn structure. This can take place during the endgame but the expectations are different. In the endgame, the idea is to keep the pawns as long as possible and to queen at least one of the pawns. In an early king safety pawn storm, the expectations are to sacrifice the pawns with material loss and for a mating attack or positional trade. It is possible to combine different concepts into a single table as SF9 does, but there is no advantage in doing so.

Pawn storms are rare but damaging when they do happen. The main idea is to prune occurring positions in the tree rather than evaluate a pawn storm as a root principal variation. This leads to a different kind of problem when adding pawn storm code (or any type of code than tries to define a series of conditions). Consider the following obscure position that occurs in the search tree. The pawn storm attack on c6 is a useless calculation:

[d]r2k1bnr/ppp1pppp/2P5/8/2q5/8/PPPPNPPP/RNBQ1K1R b - -
Unfortunately, this type of position is too common in the opening tree. The kings are wandering around in the opening because they are trying to escape the pre-programmed king safety problems. Fixing shortfalls in a chess program is sometimes like trying to plug a leak. Fix one leak, and six more leaks suddenly appear.

D Sceviour
Posts: 330
Joined: Mon Jul 20, 2015 3:06 pm
Contact:

Pawn Storm - Application

Post by D Sceviour » Wed Feb 14, 2018 5:05 pm

Code: Select all

Useful constants:
const U64  leftHalf = 0xF0F0F0F0F0F0F0Full;
const U64 rightHalf = 0xF0F0F0F0F0F0F0F0ull;

int stormMap[64] = {
  0,  0,  0,  0,  0,  0,  0,  0,
  0,  0,  0,  0,  0,  0,  0,  0,
  0,  0,  0,  0,  0,  0,  0,  0,
 10, 10, 20,  0,  0, 20, 10, 10,
 10, 20, 50, 15, 15, 50, 20, 10,
 24, 50, 60, 50, 50, 60, 50, 24,
  0,  0,  0,  0,  0,  0,  0,  0,
  0,  0,  0,  0,  0,  0,  0,  0 };

int PawnStorm() {

(1) isQueen is short and fast and can cut off the remainder quickly:

   if (isQueen && minor_major_count>7

(2) Need a development flag to prevent premature attacks. Using castled status for this:

	&& WCastleFinished && BCastleFinished

(3) A pawn storm augments an attack, it does not create one. Make sure other pieces are attacking first. Otherwise the issues are somewhere else on the board and a pawn storm is pointless or offers over-extension of pawns. A king safety measure is used for this:

	&& kingAttackersCount) {

(4) Determine king side. Peter Osterlund uses something like this in Texel:

int     zone[WHITE] = ((kingPosition[WHITE] & 7)>3 ? 1: 0);
        zone[BLACK] = ((kingPosition[BLACK] & 7)>3 ? 1: 0);
int     kingDiff = abs(zone[WHITE] - zone[BLACK]);

Only done when kings castle opposite sides:

        if (kingDiff) {

Create a temporary pawn bitboard of the pawns that are storming the king position. Extract the square information from the pawn bitboard:

U64	   tpb = pawnboard[side] and (zone[oside]?rightHalf:leftHalf);
        while (tpb) {
		if (side == WHITE) {
			sq = BSR(tpb);
		} else {
			sq = BSF(tpb);
		}

Erase the remaining FILE. Doubled pawns are ignored:

		tpb &= !FILES[sq & 7];
		mg += pawnStorm[sq];

(5) something extra if pawns are connected?

		if (pawnBoard[side] & connected[sq])
			mg+= 5;
	   }
      }
   }
   return (mg);
}

jdart
Posts: 3488
Joined: Fri Mar 10, 2006 4:23 am
Location: http://www.arasanchess.org

Re: Pawn Storm - Theory

Post by jdart » Thu Feb 15, 2018 2:05 am

I have tried to incorporate this concept into my eval, but so far without success.

Currently I consider pawn attacks along with other attacks on the king side. giving a penalty for those attacks, with a higher penalty given for attacks very near the opposing king.

This term is added to the overall attack "weight" and that is then put through a sigmoid function. So up to a point, more attacks generate a higher score, but after a while the incremental effect of adding another piece or pawn to the attack is smaller.

Currently, none of this takes into account the interaction of multiple pawns that may be participating in the attack, or opposite-side castling.

One of the problems with pawn storms is that if you have a locked position, where no pawn can advance, it may not matter that multiple pawns are near the enemy King. They can't do anything. Another problem as noted is that advancing pawns with same-side castling weakens your own King. However, sometimes this kind of attack works.

--Jon

D Sceviour
Posts: 330
Joined: Mon Jul 20, 2015 3:06 pm
Contact:

Re: Pawn Storm - Theory

Post by D Sceviour » Thu Feb 15, 2018 3:31 am

jdart wrote:This term is added to the overall attack "weight" and that is then put through a sigmoid function. So up to a point, more attacks generate a higher score, but after a while the incremental effect of adding another piece or pawn to the attack is smaller.
Hello Jon,

I assume you are referring to a tuning sigmoid function for a stormMap and not the actual calculation in the running program. A real time sigmoid calculation would be extremely slow. Other people have noted that tuning a pawn storm map is difficult. The stormMap values given are the best that I could so do so far.
One of the problems with pawn storms is that if you have a locked position, where no pawn can advance, it may not matter that multiple pawns are near the enemy King. They can't do anything.
True. All blocked pawns would not storm anything:

[d]r1b1qr2/pp1nb1k1/2p1p3/2Pp1p2/1P1P1Pp1/4P1Pp/PB1N1K1P/R2Q1R1B b - - 0 1
A blockedMap() was tried but gave unstable results. I used to think the "steamroller" type pawn attack was the best. However, one blocked pawn might be a good thing as it cramps the king. Perhaps consider a maximum of one blocked pawn. Some quick tests indicate this addition might be an improvement:

Code: Select all

	   if (side == WHITE) {
U64   	blocked = &#40;tpb << 8&#41; & pawnBoard&#91;BLACK&#93;;
	   &#125; else &#123;
   		blocked = &#40;tpb >> 8&#41; & pawnBoard&#91;WHITE&#93;;
	   &#125;
	   if &#40;popcount&#40;blocked&#41;>1&#41; return 0;

jdart
Posts: 3488
Joined: Fri Mar 10, 2006 4:23 am
Location: http://www.arasanchess.org

Re: Pawn Storm - Theory

Post by jdart » Thu Feb 15, 2018 2:43 pm

I assume you are referring to a tuning sigmoid function for a stormMap
In my program the sigmoid is used after all attack terms have been summed (pieces and pawns), and is applied to the sum. During auto-tuning it is an actual sigmoid calculation but in the end this is converted into a lookup table.

--Jon

Daniel Anulliero
Posts: 620
Joined: Fri Jan 04, 2013 3:55 pm
Location: Nice

Re: Pawn Storm - Theory

Post by Daniel Anulliero » Thu Feb 15, 2018 5:19 pm

Great post denis !

I worked on the pawn storm sole weeks ago but didn't get some improvement .
I'll read your study with atention :wink:

D Sceviour
Posts: 330
Joined: Mon Jul 20, 2015 3:06 pm
Contact:

Re: Pawn Storm - Theory

Post by D Sceviour » Thu Feb 15, 2018 7:49 pm

This term is added to the overall attack "weight" and that is then put through a sigmoid function. So up to a point, more attacks generate a higher score, but after a while the incremental effect of adding another piece or pawn to the attack is smaller.....
In my program the sigmoid is used after all attack terms have been summed (pieces and pawns), and is applied to the sum. During auto-tuning it is an actual sigmoid calculation but in the end this is converted into a lookup table.
I tried something like this and got no change in results:

Code: Select all

	value += pawnStorm&#91;sq&#93; * weight&#91;kingAttacksCount&#93;;
The sample sizes are becoming small because of the continuing restrictions. This position was sampled from the tuning set. It meets the theoretical conditions outlined but it is not what was it was intended for. On the contrary, positions like this are adding noise to the results. More restrictions or a different type of tuning set are required. Otherwise, intuitive tuning values are probably better than sigmoid values.

[d]1Q5r/1pBk4/6p1/pP1P1b2/q3B3/8/1b3P2/2R3K1 w - - 0 1

carldaman
Posts: 1541
Joined: Sat Jun 02, 2012 12:13 am

Re: Pawn Storm - Theory

Post by carldaman » Wed Feb 21, 2018 11:21 pm

jdart wrote:
Another problem as noted is that advancing pawns with same-side castling weakens your own King. However, sometimes this kind of attack works.

--Jon
http://www.talkchess.com/forum/viewtopi ... 53&t=66473

[D]4rrk1/pp1n1pp1/2pb1q1p/3p1b2/1P1P4/PQN1PN2/4BPPP/2R2RK1 b - - 0 14

A pawn storm with kings castled on the same side can be successful and NOT compromise the attacker's own king safety if the pawn chains are pointed at the enemy king. Of course, other conditions that Dennis mentioned, involving sufficient material being present on the board (Queens, minors, etc), have to be met as well.

The game I posted in the above thread is a good example of that. The black king is never in danger even after a big chunk of his shelter has stormed forward.

Also, this old thread of mine re: pawn chains might still hold some relevance: :)

http://www.talkchess.com/forum/viewtopi ... 22&t=55399

CL

D Sceviour
Posts: 330
Joined: Mon Jul 20, 2015 3:06 pm
Contact:

Re: Pawn Storm - Theory

Post by D Sceviour » Wed Feb 21, 2018 11:56 pm

carldaman wrote: [D]4rrk1/pp1n1pp1/2pb1q1p/3p1b2/1P1P4/PQN1PN2/4BPPP/2R2RK1 b - - 0 14
The game I posted in the above thread is a good example of that. The black king is never in danger even after a big chunk of his shelter has stormed forward.
Hello Carl,
My own engine Schooner finds g5 in only 6 ply, yet Stockfish9 says b5! is the best move. SF9 says g5 gives nothing more than equality. One cannot argue with the machine, but we can try to duplicate some of the reasoning in code.

In your given position above, black is never in danger because white has no current attack, and no white attack on the king on the horizon. Thus, the black pawn structure does not make a difference. This is described in item:

(3) Challenge kings with some other piece beside the pawns. The pawns themselves cannot threaten the king.

Some programs consider other measures in describing the attacking situation. One is king tropism - or how close the pieces are to the king. Here, blacks tropism is higher than whites, and this is important (unless you are using Stockfish9 to analyze).

carldaman
Posts: 1541
Joined: Sat Jun 02, 2012 12:13 am

Re: Pawn Storm - Theory

Post by carldaman » Thu Feb 22, 2018 12:08 am

D Sceviour wrote:
carldaman wrote: [D]4rrk1/pp1n1pp1/2pb1q1p/3p1b2/1P1P4/PQN1PN2/4BPPP/2R2RK1 b - - 0 14
The game I posted in the above thread is a good example of that. The black king is never in danger even after a big chunk of his shelter has stormed forward.
Hello Carl,
My own engine Schooner finds g5 in only 6 ply, yet Stockfish9 says b5! is the best move. SF9 says g5 gives nothing more than equality. One cannot argue with the machine, but we can try to duplicate some of the reasoning in code.

In your given position above, black is never in danger because white has no current attack, and no white attack on the king on the horizon. Thus, the black pawn structure does not make a difference. This is described in item:

(3) Challenge kings with some other piece beside the pawns. The pawns themselves cannot threaten the king.

Some programs consider other measures in describing the attacking situation. One is king tropism - or how close the pieces are to the king. Here, blacks tropism is higher than whites, and this is important (unless you are using Stockfish9 to analyze).
White has no current attack in large part because of the pawn chain structure (b7-c6-d5/f2-e3-d4), which (diagonally) splits the board in two halves, with many of the White pieces in the wrong half, but all the Black pieces in the 'attacking' half.

The pawns alone cannot attack the king, but they can a) threaten to dislodge defensive pieces (Nf3), and b) open up lines of attack by creating levers (pawn breaks, h5-h5, hxg3).

Post Reply