Bad Bishop win

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

Moderators: hgm, Rebel, chrisw

MikeGL
Posts: 1010
Joined: Thu Sep 01, 2011 2:49 pm

Bad Bishop win

Post by MikeGL »

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.

[pgn] [Event "CCC 8: Deep Dive Finals (15|5) "] [Site "?"] [Date "2019.05.13"] [Round "1"] [White "Lc0"] [Black "Stockfish"] [Result "1-0"] [ECO "B50"] [GameDuration "00:41:03"] [GameEndTime "2019-05-13T22:25:24.946 PDT"] [GameStartTime "2019-05-13T21:44:21.336 PDT"] [Opening "Sicilian"] [PlyCount "267"] [TimeControl "900+5"] 1. e4 c5 2. Nf3 d6 3. c3 Nf6 4. Bb5+ Bd7 5. Bxd7+ Qxd7 6. d3 e6 7. O-O Be7 8. Qe2 O-O 9. Rd1 Nc6 10. Bf4 b5 11. d4 cxd4 12. cxd4 Rac8 13. h3 d5 14. e5 Ne4 15. Nbd2 Nxd2 16. Bxd2 Nb4 17. h4 Rc4 18. b3 Rc7 19. h5 Nc2 20. Rac1 Rfc8 21. h6 g6 22. g3 a6 23. Kg2 Rc6 24. a4 bxa4 25. bxa4 Rc4 26. a5 Bf8 27. Rb1 Na3 28. Rb6 Qa7 29. Nh2 Nb5 30. Ng4 Be7 31. Rb1 Nxd4 32. Qd3 Nf5 33. Rb7 Qa8 34. Kh3 d4 35. Kh2 Bd8 36. Rd7 R4c7 37. Rxc7 Bxc7 38. Nf6+ Kh8 39. Kh3 Rb8 40. Rc1 Qb7 41. Nd7 Rg8 42. Rb1 Qc6 43. Nf6 Rb8 44. Qa3 Rd8 45. Rc1 Qb5 46. Qc5 Bxe5 47. Qxb5 axb5 48. Nd7 Bd6 49. a6 Kg8 50. a7 Ra8 51. Rc6 f6 52. g4 Rxa7 53. gxf5 gxf5 54. Rxd6 Kf7 55. Nc5 e5 56. Bb4 Rc7 57. Rb6 Kg6 58. Rxb5 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ure 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: 4605
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: Bad Bishop win

Post by Guenther »

MikeGL wrote: Tue May 21, 2019 4: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?
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
chrisw
Posts: 4313
Joined: Tue Apr 03, 2012 4:28 pm

Re: Bad Bishop win

Post by chrisw »

Guenther wrote: Tue May 21, 2019 5:10 pm
MikeGL wrote: Tue May 21, 2019 4: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: 4605
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: Bad Bishop win

Post by Guenther »

chrisw wrote: Tue May 21, 2019 5:34 pm
Guenther wrote: Tue May 21, 2019 5:10 pm
MikeGL wrote: Tue May 21, 2019 4: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.
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
MikeGL
Posts: 1010
Joined: Thu Sep 01, 2011 2:49 pm

Re: Bad Bishop win

Post by MikeGL »

Guenther wrote: Tue May 21, 2019 5:10 pm
MikeGL wrote: Tue May 21, 2019 4: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: 1010
Joined: Thu Sep 01, 2011 2:49 pm

Re: Bad Bishop win

Post by MikeGL »

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: 4313
Joined: Tue Apr 03, 2012 4:28 pm

Re: Bad Bishop win

Post by chrisw »

MikeGL wrote: Tue May 21, 2019 7:44 pm
Guenther wrote: Tue May 21, 2019 5:10 pm
MikeGL wrote: Tue May 21, 2019 4: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: 12537
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Bad Bishop win

Post by Dann Corbit »

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: 12537
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Bad Bishop win

Post by Dann Corbit »

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: 4313
Joined: Tue Apr 03, 2012 4:28 pm

Re: Bad Bishop win

Post by chrisw »

Dann Corbit wrote: Wed May 22, 2019 1:07 am 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”.