The Pawn Structure feature in LiChess Tools
As you know, LiChess Tools is my own Chromium browser extension for lichess.org, adding a lot of stuff to it. Recently, from version 2.2.0 on, I've added a new feature called Show Pawn Structures. This post explains in detail what it is, what it does and how it does it.
Pawn Structures
What is a pawn structure? The configuration of pawns on the chessboard. Because pawns are the least mobile of the chess pieces, the pawn structure is relatively static and thus plays a large role in determining the strategic character of the position. It is a powerful chess concept that is mostly ignored on amateur level and I've met 2000+ rated players who didn't know what that was. Not that I know, either, which is why I got so excited to build this feature because it would further chess understanding and learning. With different structures come medium term plans, so instead of having the opaque engine recommendations of making one move or another, you will have a general idea on where to take the game to.
The above is the chess definition of the concept, though. In order to work with it in an algorithm it has to be clearly defined. The difficulty here lies in the fact that while the pawn structure is "relatively static" its meaning is not. While you will be shown a specific pawn configuration in the context of a named structure, it would be implied that other similar configurations also belong. That similarity being not precise, but something nebulous related to the general ideas and themes that are made possible by the structure.
Feature requirements
The purpose of the feature is to determine the pawn structure of a position in either game analysis, analysis board, studies, TV games and mini-games (the things that appear when you hover on a playing user link or in the Current Games section), then display it, similar to the Show Opening feature. The reasoning here is that one can learn to classify positions and thus know the general plans that apply in the situation.
Technical details
There is a list of pawn structures that LiChess Tools supports. The list is at the end of this post. In order to the structure I created a textual representation of them, that looks something like this: 312100TX 0X0210 2020 XXLXXX XXXXXX XXXX. A bit daunting, but the most important part is the first group of characters: 312100TX.
The idea is that the first characters are the most significant, so similar pawn structures would start with the same letters and digits, even if they diverge later on. Based on the structures detailed by various books on the matter, I've considered that the position of the d-pawn is the most significant, followed by the e and c pawns, then the pawn majority on the White and Black sides, followed by the other pawns: f,b,g,a,h. The final part is doubled or triple pawns, which most of the time is irrelevant.
So let's get back to the complicated string above: 312100TX 0X0210 2020 XXLXXX XXXXXX XXXX (we will assume White board orientation)
- 312 - my pawn position on the d,e,c files: d5 (3 squares forward), e3 (1 square), c4 (2 squares) - the possible characters for this group are X (missing pawn), 0 (unmoved pawn), 1,2,3 (squares the pawn is forward from its starting position)
- 100 - their pawn position on the d,e,c files: d6, e7, c7
- TX - the majority on the queenside and kingside: T (they) have majority on the queenside, and equality on the kingside - the possible characters for this group are M (me), T (them) or X (neither)
- 0X0 - my pawn position for the f,b,g files
- 210 - there pawn position for the f,b,g files
- 20 - my pawn position for the a,h files
- 20 - my pawn position for the a,h files
- XXLXXX XXXXXX XXXX - similar to above groups, doubled or tripled pawns - X for no, L for yes
Most pawn structures are exclusively about the position of the c,d and e file pawns, therefore the first group of characters will be the most determining one. This may change in the future, perhaps, as better chess players than me will point out issues with this system, but for the moment this is how it works.
Based on this string we can compare the current pawn position to the one of the named pawn structures. There are three options in the Preferences for this feature:
- Enabled - if this feature is on or off
- Only named structures - will only display the named structures if enabled. If not, then the name will be displayed as the most significant group of characters in the structure representation. On mouseover, the title will show the entire thing as well as the most similar named structure found.
- Fuzzy - if this feature is on, then a structure will be considered named if 90% similar to the standard one.
The feature will invert the structure and look for a name there if not found for your own orientation. If a name is found there, "(R)" will be added to the name.
Note that the most named structures are represented by the most significant group only, and only several of them by the first two or three groups of characters. The rest is ignored.
Similarity
Now, how do we compute the similarity? It's a work in progress, but at the moment it works like this:
- the number of common characters on the same position from the beginning of the text are counted as 1
- the number of other common characters on the same position (so after any position where the characters were different) are counted as 0.8
- the number of positions where the current structure has pawns on squares that may allow moving them on the named structure square for that position (so where the value is numerical and smaller than the numerical value of the named structure) are counted as 0.2
- the percentage of the resulting sum from the characters counted is returned as the result
Example: Carlsbad vs Slav
21X2X0TM
21XX11TX
11100280 (8 denotes 0.8 and 2 denotes 0.2 here) = 4/8 = 50%
It may be that this is not the best way and it might be changed in the future.
List of structures
A small note on naming: different sources name these differently or don't recognize them as structures at all. I did what I could to give a short identifiable name to each position, but I think sooner or later I will have to restrict the number of names, rather than increase it. We'll see.
So here is the list of pawn structures recognized by LiChess Tools (v2.2.3):
- Queen's Isolani - 2XXX1XXT
- Italian Isolani - 2XXXX0TX
- Hanging Pawns - 2X2X1XTT
- Carlsbad - 21X2X0TM
- Orthodox Exchange - 21X2X1TM
- Rauzer Formation - X22X21XX
- Boleslavsky Wall - X221X1TM
- Scheveningen - X2011XMX
- Dragon - X2010XMX 000001
- Maróczy Bind - X2210XMX and X2201XMX
- Hedgehog - X2211XMX 000010
- Boleslavsky Hole - X2012XMX
- d5 Chain - 322120XX
- e5 Chain - 230210XX
- Panov - 2X321XMT and 2X320XMT
- Stonewall - 200210XX 000200
- Botvinnik - 122122XX
- Slav - 21XX11TX
- Caro - 2X1X11MT
- Modern Benoni - 32X1X2TM
- Symmetric Benoni - 3X21X2XX
- Closed Sicilian - 120102XX
- Grünfeld - 221X02TX 0X0000
- Najdorf - 3X012XMT and X20X22XX and X2022XMX
- KID (King's Indian Defense) I - 32X12XXX
- KID (King's Indian Defense) II - 322122XX
- KID (King's Indian Defense) Complex - 222121XX
- Open KID (King Indian's Defense) - X221X0TM
- French - 2X0210XM and X3121XMX
- 3-3 vs 4-2 - XX1X1XMT
- Benko - 32X102MX 0000X1 00X0
- Closed Ruy Lopez - 321123XX
- Lopez - 221122XX
- Maróczi SymT (Symmetrical Transformation) - 32X10XXX
- Maróczi AsymT (Asymmetrical Transformation) - 3X210XMT
- KID II TA (Transformation A)- 3X2122XM 00020X
- KID II TB (Transformation B) - 3X2122XM 000X00
- d5 Chain TA (Transformation A) - 3X2120XM 00020X
- d5 Chain TB (Transformation B) - 3X2120XM 000X00
- Lopez Exchange (double pawn exchange on d4) - X2X1XXXM
The links above are also used in LiChess Tools and are mostly from Wikipedia, but also some approximations or just other random sites because there are no links for many of the Flores structures. I would be very happy if someone would help me clean these up.
Hope this explains everything. Enjoy!
Comments
Be the first to post a comment