Bad Bishop win

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

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
MikeGL
Posts: 899
Joined: Thu Sep 01, 2011 12:49 pm

Bad Bishop win

Post by MikeGL » Tue May 21, 2019 2:45 pm

This is a weird win by Lc0 when it had bad bishop against SF10.
Two pawns were also given up by Lc0 for some tiny compensation that's uncrompehensible to mere mortals.



Position after move 26.a5 of Lc0

[d]2r3k1/3qbp1p/p3p1pP/P2pP3/2rP4/5NP1/2nBQPK1/2RR4 b - - 0 26
Not sure if SF have this bad bishop code in its eval function.
Notice the bad bishop of white, but it managed to win. This bad bishop anomaly happened many times where Lc0 won.
But I think bad bishop code really hurts some AB engines considering the speed and depth that can be reached by modern hardware. YMMV.
I told my wife that a husband is like a fine wine; he gets better with age. The next day, she locked me in the cellar.

User avatar
Guenther
Posts: 3016
Joined: Wed Oct 01, 2008 4:33 am
Location: Regensburg, Germany
Full name: Guenther Simon
Contact:

Re: Bad Bishop win

Post by Guenther » Tue May 21, 2019 3:10 pm

MikeGL wrote:
Tue May 21, 2019 2:45 pm
This is a weird win by Lc0 when it had bad bishop against SF10.
Two pawns were also given up by Lc0 for some tiny compensation that's uncrompehensible to mere mortals.

[d]2r3k1/3qbp1p/p3p1pP/P2pP3/2rP4/5NP1/2nBQPK1/2RR4 b - - 0 26
Not sure if SF have this bad bishop code in its eval function.
Notice the bad bishop of white, but it managed to win. This bad bishop anomaly happened many times where Lc0 won.
But I think bad bishop code really hurts some AB engines considering the speed and depth that can be reached by modern hardware. YMMV.
Not sure, why you consider Bd2 a bad Bishop? It defends all black squares from far except d4, which is taboo, because a6 would fall
and allow a mighty passer. Actually it is more about the usual 'thorn' pawn (h6) theme of LC0, which is defended by the Bd2
and even possible invasion via b6 using the advanced a5 pawn, also defended by the strong Bd2.

In my book a bad Bishop BTW is something quite different, a piece that is directly hindered by own pawns, or even
locked for a longer period. None of this is the case here. I think you have a bit dogmatic view on the Bishop because
it is in front of the Rd1?
Current foe list count : [93]
http://rwbc-chess.de/chronology.htm

chrisw
Posts: 2019
Joined: Tue Apr 03, 2012 2:28 pm

Re: Bad Bishop win

Post by chrisw » Tue May 21, 2019 3:34 pm

Guenther wrote:
Tue May 21, 2019 3:10 pm
MikeGL wrote:
Tue May 21, 2019 2:45 pm
This is a weird win by Lc0 when it had bad bishop against SF10.
Two pawns were also given up by Lc0 for some tiny compensation that's uncrompehensible to mere mortals.

[d]2r3k1/3qbp1p/p3p1pP/P2pP3/2rP4/5NP1/2nBQPK1/2RR4 b - - 0 26
Not sure if SF have this bad bishop code in its eval function.
Notice the bad bishop of white, but it managed to win. This bad bishop anomaly happened many times where Lc0 won.
But I think bad bishop code really hurts some AB engines considering the speed and depth that can be reached by modern hardware. YMMV.
Not sure, why you consider Bd2 a bad Bishop? It defends all black squares from far except d4, which is taboo, because a6 would fall
and allow a mighty passer. Actually it is more about the usual 'thorn' pawn (h6) theme of LC0, which is defended by the Bd2
and even possible invasion via b6 using the advanced a5 pawn, also defended by the strong Bd2.

In my book a bad Bishop BTW is something quite different, a piece that is directly hindered by own pawns, or even
locked for a longer period. None of this is the case here. I think you have a bit dogmatic view on the Bishop because
it is in front of the Rd1?
if you remove all pieces except pawns and bishops, it would be a bad bishop, I think black immediately wins even if white has the first move.
But with pieces on the board, it's an entirely different game, the rook file pawns are dangerous (as you point out), rather than a weak liability and the heuristic doesn't apply.

User avatar
Guenther
Posts: 3016
Joined: Wed Oct 01, 2008 4:33 am
Location: Regensburg, Germany
Full name: Guenther Simon
Contact:

Re: Bad Bishop win

Post by Guenther » Tue May 21, 2019 3:44 pm

chrisw wrote:
Tue May 21, 2019 3:34 pm
Guenther wrote:
Tue May 21, 2019 3:10 pm
MikeGL wrote:
Tue May 21, 2019 2:45 pm
This is a weird win by Lc0 when it had bad bishop against SF10.
Two pawns were also given up by Lc0 for some tiny compensation that's uncrompehensible to mere mortals.

[d]2r3k1/3qbp1p/p3p1pP/P2pP3/2rP4/5NP1/2nBQPK1/2RR4 b - - 0 26
Not sure if SF have this bad bishop code in its eval function.
Notice the bad bishop of white, but it managed to win. This bad bishop anomaly happened many times where Lc0 won.
But I think bad bishop code really hurts some AB engines considering the speed and depth that can be reached by modern hardware. YMMV.
Not sure, why you consider Bd2 a bad Bishop? It defends all black squares from far except d4, which is taboo, because a6 would fall
and allow a mighty passer. Actually it is more about the usual 'thorn' pawn (h6) theme of LC0, which is defended by the Bd2
and even possible invasion via b6 using the advanced a5 pawn, also defended by the strong Bd2.

In my book a bad Bishop BTW is something quite different, a piece that is directly hindered by own pawns, or even
locked for a longer period. None of this is the case here. I think you have a bit dogmatic view on the Bishop because
it is in front of the Rd1?
if you remove all pieces except pawns and bishops, it would be a bad bishop, I think black immediately wins even if white has the first move.
If we remove all pieces we could play tic tac toe... probably only weaker players see a bad Bishop here.

The Bishop defends important squares far into the opponents camp, which is decisive here (big space plus)
and Nc2 is more or less fixed and pseudo-active. W/o using a chess prog I would first check here, if Bb4 by Black
could help to get ridd off the good Bd2, too lazy now for own calculation, just my plain positional eval.
Current foe list count : [93]
http://rwbc-chess.de/chronology.htm

MikeGL
Posts: 899
Joined: Thu Sep 01, 2011 12:49 pm

Re: Bad Bishop win

Post by MikeGL » Tue May 21, 2019 5:44 pm

Guenther wrote:
Tue May 21, 2019 3:10 pm
MikeGL wrote:
Tue May 21, 2019 2:45 pm
This is a weird win by Lc0 when it had bad bishop against SF10.
Two pawns were also given up by Lc0 for some tiny compensation that's uncrompehensible to mere mortals.

[d]2r3k1/3qbp1p/p3p1pP/P2pP3/2rP4/5NP1/2nBQPK1/2RR4 b - - 0 26
Not sure if SF have this bad bishop code in its eval function.
Notice the bad bishop of white, but it managed to win. This bad bishop anomaly happened many times where Lc0 won.
But I think bad bishop code really hurts some AB engines considering the speed and depth that can be reached by modern hardware. YMMV.
Not sure, why you consider Bd2 a bad Bishop? It defends all black squares from far except d4, which is taboo, because a6 would fall
and allow a mighty passer. Actually it is more about the usual 'thorn' pawn (h6) theme of LC0, which is defended by the Bd2
and even possible invasion via b6 using the advanced a5 pawn, also defended by the strong Bd2.

In my book a bad Bishop BTW is something quite different, a piece that is directly hindered by own pawns, or even
locked for a longer period. None of this is the case here. I think you have a bit dogmatic view on the Bishop because
it is in front of the Rd1?

I think it was mentioned in some books, like that one by Capablanca, where a bishop is bad if all of your pawn sits on the same color as that of your bishop. As an example (not to criticize the author/ and moderator here Dr. Hyatt) his crafty has the correct code which implements this bad bishop thing. It is found in its eval function in evaluate.c module:

Code: Select all

/*
 ************************************************************
 *                                                          *
 *  Next we count the number of friendly pawns on the same  *
 *  color squares as the bishop.  This is a bad thing since *
 *  it restricts the bishop's ability to move.  We only do  *
 *  this if there is only one bishop for this side.         *
 *                                                          *
 ************************************************************
 */
    if (TotalPieces(side, bishop) == 1) {
      if (dark_squares & SetMask(square))
        tpawns = PopCnt(dark_squares & Pawns(side));
      else
        tpawns = PopCnt(~dark_squares & Pawns(side));
      score_mg -= tpawns * bishop_pawns_on_color[mg];
      score_eg -= tpawns * bishop_pawns_on_color[eg];
    }
/*
The above Code and idea (in crafty v25.2 is correct, IMO). It implements bad bishop as defined in most Chess Fundamental books, but I have seen maybe 6 or 7 games where Lc0 loves bad bishop and it was allowed by Stockfish10 too, which means SF has this bad bishop code somewhere on its eval.
I told my wife that a husband is like a fine wine; he gets better with age. The next day, she locked me in the cellar.

MikeGL
Posts: 899
Joined: Thu Sep 01, 2011 12:49 pm

Re: Bad Bishop win

Post by MikeGL » Tue May 21, 2019 5:57 pm

I just checked with SF10 source just now and there was indeed a bad bishop penalty, the reason why black allowed those pawns to reach h6 for white is because it is bad according to stockfish. Eval terms are expensive during search,

Code: Select all


            if (Pt == BISHOP)
            {
                // Penalty according to number of pawns on the same color square as the
                // bishop, bigger when the center files are blocked with pawns.
                Bitboard blocked = pos.pieces(Us, PAWN) & shift<Down>(pos.pieces());

                score -= BishopPawns * pe->pawns_on_same_color_squares(Us, s)
                                     * (1 + popcount(blocked & CenterFiles));

                // Bonus for bishop on a long diagonal which can "see" both center squares
                if (more_than_one(attacks_bb<BISHOP>(s, pos.pieces(PAWN)) & Center))
                    score += LongDiagonalBishop;
            }
Found it in evaluate.cpp module of stockfish 10, looks like this is a similar thing implemented in crafty regarding bad bishops too.
I told my wife that a husband is like a fine wine; he gets better with age. The next day, she locked me in the cellar.

chrisw
Posts: 2019
Joined: Tue Apr 03, 2012 2:28 pm

Re: Bad Bishop win

Post by chrisw » Tue May 21, 2019 8:12 pm

MikeGL wrote:
Tue May 21, 2019 5:44 pm
Guenther wrote:
Tue May 21, 2019 3:10 pm
MikeGL wrote:
Tue May 21, 2019 2:45 pm
This is a weird win by Lc0 when it had bad bishop against SF10.
Two pawns were also given up by Lc0 for some tiny compensation that's uncrompehensible to mere mortals.

[d]2r3k1/3qbp1p/p3p1pP/P2pP3/2rP4/5NP1/2nBQPK1/2RR4 b - - 0 26
Not sure if SF have this bad bishop code in its eval function.
Notice the bad bishop of white, but it managed to win. This bad bishop anomaly happened many times where Lc0 won.
But I think bad bishop code really hurts some AB engines considering the speed and depth that can be reached by modern hardware. YMMV.
Not sure, why you consider Bd2 a bad Bishop? It defends all black squares from far except d4, which is taboo, because a6 would fall
and allow a mighty passer. Actually it is more about the usual 'thorn' pawn (h6) theme of LC0, which is defended by the Bd2
and even possible invasion via b6 using the advanced a5 pawn, also defended by the strong Bd2.

In my book a bad Bishop BTW is something quite different, a piece that is directly hindered by own pawns, or even
locked for a longer period. None of this is the case here. I think you have a bit dogmatic view on the Bishop because
it is in front of the Rd1?

I think it was mentioned in some books, like that one by Capablanca, where a bishop is bad if all of your pawn sits on the same color as that of your bishop. As an example (not to criticize the author/ and moderator here Dr. Hyatt) his crafty has the correct code which implements this bad bishop thing. It is found in its eval function in evaluate.c module:

Code: Select all

/*
 ************************************************************
 *                                                          *
 *  Next we count the number of friendly pawns on the same  *
 *  color squares as the bishop.  This is a bad thing since *
 *  it restricts the bishop's ability to move.  We only do  *
 *  this if there is only one bishop for this side.         *
 *                                                          *
 ************************************************************
 */
    if (TotalPieces(side, bishop) == 1) {
      if (dark_squares & SetMask(square))
        tpawns = PopCnt(dark_squares & Pawns(side));
      else
        tpawns = PopCnt(~dark_squares & Pawns(side));
      score_mg -= tpawns * bishop_pawns_on_color[mg];
      score_eg -= tpawns * bishop_pawns_on_color[eg];
    }
/*
The above Code and idea (in crafty v25.2 is correct, IMO). It implements bad bishop as defined in most Chess Fundamental books, but I have seen maybe 6 or 7 games where Lc0 loves bad bishop and it was allowed by Stockfish10 too, which means SF has this bad bishop code somewhere on its eval.

Correct? Haha. It's a simplistic rule for weak players, unsurprisingly it gets implemented in handcrafted evaluations. stronger players kind of unlearn it, with a knowledge of the cases where the opposite or something different applies. Muchly, and unsurprisingly, it depends what are the other pieces on the board. Eg the example position, with no other pieces on the board apart from bishops, there's no way to stop the black king from getting to the white square b5 and winning the a-pawn and the game. With other pieces on the board, situation is entirely different. Therefore, you might 'improve' the simplistic heuristic for a program by weighting use of the term by the material situation. There is no "correct".

Dann Corbit
Posts: 10002
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: Bad Bishop win

Post by Dann Corbit » Tue May 21, 2019 10:57 pm

As to 'there is no "correct"':
1. One definition of correct would be that it gains Elo in the desired environment of play.
2. Another definition of correct is that it causes more good decisions in analysis than bad decisions.
As to whether it is correct by either of these definitions or some other definition, I cannot say.

When we are talking about code, correct means two things to me:
1. It does not contain harmful bugs and performs the desired task as designed
2. The code causes the intended benefit, whatever it may be.

Now, correct and truth are not the same thing here.
I would agree that we cannot come to any conclusion about truth in these code snippets.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.

Dann Corbit
Posts: 10002
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: Bad Bishop win

Post by Dann Corbit » Tue May 21, 2019 11:07 pm

Some internet goo on good and bad bishops:

Good vs Bad

A good bishop is on the opposite color as its pawns. A bad bishop is on the same color as its pawns. For example if the white pawn structure is c3, d4, e3, f4, then the light squared bishop is the good bishop and the dark squared bishop is the bad bishop.
Active vs Inactive

An active bishop is outside of the friendly pawn chain (in the above example, if the bishop is on e5, then it is clearly both active and bad). An inactive bishop is trapped by pawn chains - either the player's color or the opponent's.
Mitigating Factors

There are two main mitigating factors. The first can be remembered by a common phrase: "bad bishops defend good pawns". This means that a bishop might be very bad (same color as all the friendly pawns) but if it is defending them from attack in the endgame, then it might be enough to hold a draw. Usually it is much harder to win with the bad bishop though.
The other main mitigating factor is if the bishop is defending its own passed pawn or stopping an enemy passed pawn.

More mitigating factors discussed:
https://thechessworld.com/articles/midd ... ad-bishop/

Also (three ways to fix a bad bishop):
https://www.ichess.net/blog/good-bishop-bad-bishop/
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.

chrisw
Posts: 2019
Joined: Tue Apr 03, 2012 2:28 pm

Re: Bad Bishop win

Post by chrisw » Wed May 22, 2019 12:17 am

Dann Corbit wrote:
Tue May 21, 2019 11:07 pm
Some internet goo on good and bad bishops:

Good vs Bad

A good bishop is on the opposite color as its pawns. A bad bishop is on the same color as its pawns. For example if the white pawn structure is c3, d4, e3, f4, then the light squared bishop is the good bishop and the dark squared bishop is the bad bishop.
Active vs Inactive

An active bishop is outside of the friendly pawn chain (in the above example, if the bishop is on e5, then it is clearly both active and bad). An inactive bishop is trapped by pawn chains - either the player's color or the opponent's.
Mitigating Factors

There are two main mitigating factors. The first can be remembered by a common phrase: "bad bishops defend good pawns". This means that a bishop might be very bad (same color as all the friendly pawns) but if it is defending them from attack in the endgame, then it might be enough to hold a draw. Usually it is much harder to win with the bad bishop though.
The other main mitigating factor is if the bishop is defending its own passed pawn or stopping an enemy passed pawn.

More mitigating factors discussed:
https://thechessworld.com/articles/midd ... ad-bishop/

Also (three ways to fix a bad bishop):
https://www.ichess.net/blog/good-bishop-bad-bishop/
Yes, thanks, I think we all know the “bad bishop” heuristic. Heuristics are not guaranteed to be optimal, correct, rational or logical, sometimes they get it wrong. They are short cuts for problem solving, and the discussion in this case is whether or not the “bad bishop” on d2 in this position is actually “bad”. Its not a discussion about how many pawns are on the same colour (yes, we can count), but whether the count same colour pawns heuristic is useful in this particular position. Guenther is arguing the reverse is true (he says it’s a good piece, actually) and points to the wing pawns. And I’m arguing it would be bad if it weren’t for the presence of other pieces and the possibility of exploiting the wing pawns again (eg play this game by not exchanging pieces, exchanging pawns is fine). Interestingly enough, LC0 plays it by tossing some pawns and then exploiting the wing pawns.
If chess could be solved by adding up heuristics “correctly”, it would have been solved in the last fifty or so years of trying. There is no “correct”, everything depends on everything else, and nobody has worked out how to balance it all together, especially not by separating everything out into heuristical knowledge chunks and then adding it all up as if there were no dependencies. Except maybe this neural net, which certainly doesn’t work by adding up pawns and defining “bad bishops”.

Post Reply