Identifying weak squares

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Jon12345
Posts: 80
Joined: Tue May 11, 2010 6:18 pm

Identifying weak squares

Post by Jon12345 »

I would like to create an algo for identifying weak squares, or am I reinventing the wheel here? Any suggestions for how to go about doing this?

An interesting topic, I think.
Jon
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Identifying weak squares

Post by mvanthoor »

Jon12345 wrote: Thu Jul 08, 2021 9:41 pm I would like to create an algo for identifying weak squares, or am I reinventing the wheel here? Any suggestions for how to go about doing this?

An interesting topic, I think.
A weak square is one that can not be defended by a pawn. If the side with the weak square also hasn't got the bishop of that square's color, it can't be defended from a distance without using a rook or a queen for that. That makes the square even weaker.

You can just take a look at your board, and see if there are squares on the 3rd of 4th rank (or 6 and 5 for black) that can't be "attacked" by one of your own pawns.

The reverse: if there is a weak square on your opponent's side and _you_ can attack that square using a pawn, it becomes an outpost. If this square is in or near the center, it's a great location for one of your knights.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
BeyondCritics
Posts: 396
Joined: Sat May 05, 2012 2:48 pm
Full name: Oliver Roese

Re: Identifying weak squares

Post by BeyondCritics »

The https://hxim.github.io/Stockfish-Evaluation-Guide/ is a high level specification of the stockfish evaluation function.
Of course, this can be intimidating, so I understand if you want to ignore that voluntarily...
Besides that it is an excellent resource.
User avatar
Look
Posts: 366
Joined: Thu Jun 05, 2014 2:14 pm
Location: Iran
Full name: Mehdi Amini

Re: Identifying weak squares

Post by Look »

I suspect a customized version of Static_Exchange_Evaluation for empty squares could be helpful for you.
Farewell.
Jon12345
Posts: 80
Joined: Tue May 11, 2010 6:18 pm

Re: Identifying weak squares

Post by Jon12345 »

mvanthoor wrote: Fri Jul 09, 2021 3:32 am A weak square is one that can not be defended by a pawn. If the side with the weak square also hasn't got the bishop of that square's color, it can't be defended from a distance without using a rook or a queen for that. That makes the square even weaker.

You can just take a look at your board, and see if there are squares on the 3rd of 4th rank (or 6 and 5 for black) that can't be "attacked" by one of your own pawns.

The reverse: if there is a weak square on your opponent's side and _you_ can attack that square using a pawn, it becomes an outpost. If this square is in or near the center, it's a great location for one of your knights.
Establishing the definition of a weak square is a crucial part of this, so you bring up a good point. It is something I have been thinking about but I am struggling to get an exact definition. Why? Well, consider this...

If you have a fiancetto on g2, are f3 and h3 considered weak squares? They are protected by the Bishop.

What about with pawns on f2, g2 and h2. Does that mean squares f4, g4 and h4 are considered weak?
Jon
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Identifying weak squares

Post by mvanthoor »

Jon12345 wrote: Fri Jul 09, 2021 1:17 pm If you have a fiancetto on g2, are f3 and h3 considered weak squares? They are protected by the Bishop.
Yes, they're weak. Actually, it's a very common tactic for the opponent to try and swap off the g2 bishop, and if at all possible, land the queen on h3 while doing it. A square is weak, if it's on your side of the board, and you can never defend it with a pawn again.
What about with pawns on f2, g2 and h2. Does that mean squares f4, g4 and h4 are considered weak?
No. They're not weak, because they can be defended by a pawn if necessary. h2h3 defends g4. g2g3 defends both f4 and h4. (But it makes h3 weak; and f3 as well, if the e-pawn is advanced as well.) If you play g2g4 while you have already played e2e4, then f3, f4, h3, and h4 all become weak.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
Henk
Posts: 7220
Joined: Mon May 27, 2013 10:31 am

Re: Identifying weak squares

Post by Henk »

mvanthoor wrote: Fri Jul 09, 2021 1:33 pm
Jon12345 wrote: Fri Jul 09, 2021 1:17 pm If you have a fiancetto on g2, are f3 and h3 considered weak squares? They are protected by the Bishop.
Yes, they're weak. Actually, it's a very common tactic for the opponent to try and swap off the g2 bishop, and if at all possible, land the queen on h3 while doing it. A square is weak, if it's on your side of the board, and you can never defend it with a pawn again.
What about with pawns on f2, g2 and h2. Does that mean squares f4, g4 and h4 are considered weak?
No. They're not weak, because they can be defended by a pawn if necessary. h2h3 defends g4. g2g3 defends both f4 and h4. (But it makes h3 weak; and f3 as well, if the e-pawn is advanced as well.) If you play g2g4 while you have already played e2e4, then f3, f4, h3, and h4 all become weak.
f4, g4, h4 are a bit weak for when defended they create a weakness on the pawnshield of the king. So depends on kingsafety.
f4, h4 are weakest squares. For h3 may not be that bad.

O wait that means that f5, g5, h5 are even weaker. Hmm g5 can be attacked by knight, h5 by a bishop and f5 by a pawn on e4.
But in case you don't have a pawn on e4 or a bishop on e2 etc.
Jon12345
Posts: 80
Joined: Tue May 11, 2010 6:18 pm

Re: Identifying weak squares

Post by Jon12345 »

mvanthoor wrote: Fri Jul 09, 2021 1:33 pm Yes, they're weak. Actually, it's a very common tactic for the opponent to try and swap off the g2 bishop, and if at all possible, land the queen on h3 while doing it. A square is weak, if it's on your side of the board, and you can never defend it with a pawn again.
So are we saying that a square is weak if you had a Knight, Bishop, Queen and Rook all pointing to that square, if it doesn't have a pawn attacking it?
Jon
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Identifying weak squares

Post by mvanthoor »

Jon12345 wrote: Fri Jul 09, 2021 3:49 pm So are we saying that a square is weak if you had a Knight, Bishop, Queen and Rook all pointing to that square, if it doesn't have a pawn attacking it?
Possibly. Not having a square covered by a pawn doesn't make it weak automatically; if you can still move a pawn to cover the square, it's not weak. If you can never cover the square with a pawn because they all moved past it, then it's weak, independent of how many pieces are covering it.

The reason is that you have to tie down at least a 3-point piece to defend the square, where a 1-point pawn could also have done the job. This decreases the mobility of your pieces, because if you give up that square, bad things may happen. If your opponent has a knight he can put on that square and you have a bishop that can't cover that square, you can never get rid of the knight without sacrificing at least a rook. If your opponent can attack this square with on of his own pawns, it becomes so strong for him (and weak for you) that he can possibly plant a knight there, which then covers 8 other squares in your position.

Look at games of Wilhelm Steinitz. He was the first to really get this down. If you have the knight and your opponent has the bishop, plant your knight on a weak square in your opponent's camp, preferably where the bishop can't attack it. That's an outpost. If you have a bishop against a knight, then try to take away all the squares of the knight, preferably by also putting your pawns on the opposite square color of the bishop.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
Jon12345
Posts: 80
Joined: Tue May 11, 2010 6:18 pm

Re: Identifying weak squares

Post by Jon12345 »

I am trying to establish what is deemed as the "official" definition of a weak square, and what is actually a weak square. So far, I am getting the definition to be a square is weak if it is on rank 3 or 4 in your own half of the board and you can never now, or in the future protect that square with a pawn, yes?

And for my unofficial definition, a weak square is on a continuum where it is weakest when it cannot be protected by a pawn or Bishop, it is slightly weak when it is protected by a Bishop (for example) and not weak when it can be protected by a pawn, and strongest when protected by a pawn and pieces.
Jon