# Dispersion and Distortion

Home * Board Representation * Bitboards * Pawn Pattern and Properties * Dispersion and Distortion

Dispersion and Distortion,
are Kmoch's terms [2] [3] for pawn structure weaknesses due to vertical or horizontal splitting caused by captures or advancement. The proposed functions may be used via an additional scaling or indirection, f.i. to index a table with concrete penalties.

# Dispersion

Dispersion is Kmoch's term for vertical splitting of pawns (most commonly, isolation) caused by captures. Having three or four islands while the opponent has one or two - assuming about the same number of pawns for both sides - may be considered in evaluation. But this is also implicitly done by evaluating double- or triple and isolated or the balance of weak pawns in general. Some arbitrary dispersion measure, intended as index of a pre-calculated table for evaluation purpose.

```int dispersion(U64 pawns)
{
BYTE fileset  = (BYTE) soutFill(pawns);
int  ni = popCount(islandsEastFiles(fileset));
int  np = popCount(wpawns);
return abs(3*ni*ni - np);
}

BYTE islandsEastFiles(BYTE f) {return f & ((f ^ (f >> 1));}
```

The higher the worse.

```  \  number if islands
\     1   2   3   4
np  \    3  12  27  48
_____\________________
1   |   2   -   -   -
2   |   1  10   -   -
3   |   0   9  24   -
4   |   1   8  23  44
5   |   2   7  22  43
6   |   3   6  21  42
7   |   4   5  20  41
8   |   5   4  19  40
```

# Distortion

Distortion is Kmoch's term for horizontal splitting of pawns caused by advances. One may use something like this based on rearfill, xor and population count to get an idea of distortion. It considers the rank-difference of two file-adjacent pawns (if any) as distortion penalty - the higher the worse. Half-isolated or even isolated pawns contribute a distortion penalty according to the size of their rearfill from 2 to 7 for each empty neighboring file, which discourages advancement of such pawns, interacting with terms considerring (half-) isolated pawns. Alternatively, for a "reverse" distortion penalty to encourage advancement of half-isolanis, one may use frontfill instead with a slightly different semantic is case of doubled pawns.

```int wDistortion(U64 wpawns) {
U64 fill  = wRearFill(wpawns); // wFrontFill
U64 delta = (fill ^ (fill<<1)) & C64(0xfefefefefefefefe));
return popCount(delta);
}
```

High distortion sample:

```wpawns              rearFill            rearFill << 1      xor & ~A-File
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . 1 . 1 . 1 .     . . 1 . 1 . 1 .     . . . 1 . 1 . 1     . . 1 1 1 1 1 1
. . . . . . . .     . . 1 . 1 . 1 .     . . . 1 . 1 . 1     . . 1 1 1 1 1 1
1 . . . . . . .     1 . 1 . 1 . 1 .     . 1 . 1 . 1 . 1     . 1 1 1 1 1 1 1
. . . . . . . .     1 . 1 . 1 . 1 .     1 1 . 1 . 1 . 1     . 1 1 1 1 1 1 1
. 1 . 1 . 1 . 1     1 1 1 1 1 1 1 1     1 1 1 1 1 1 1 1     . . . . . . . .
. . . . . . . .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1     . . . . . . . .

26 bits sets
```