Trapped bishop

Discussion of chess software programming and technical issues.

Moderator: Ras

Henk
Posts: 7251
Joined: Mon May 27, 2013 10:31 am

Trapped bishop

Post by Henk »

Skipper plays 23 .. Be5??

[d] 5k1r/4ppbp/1p6/1Bp1P1p1/4P3/4P3/bPKN2PP/7R b - - 3 23

[pgn]
[Event "Computer Chess Game"]
[Site "HP"]
[Date "2015.12.10"]
[Round "-"]
[White "Fairy-Max 4.8S"]
[Black "SkipperWinb"]
[Result "1-0"]
[TimeControl "120"]
[Annotator "1. +0.14 1... -0.02"]

1. d4 {+0.14/8} Nf6 {-0.02/13 2.4} 2. c4 {+0.11/8 5} Nc6 {+0.01/13 2.4} 3.
Be3 {+0.08/8 2.6} d5 {+0.09/13 2.3} 4. Nd2 {-0.03/9 5} dxc4 {+0.39/12 2.3}
5. Nxc4 {-0.27/9 4} Ng4 {+0.39/12 2.2} 6. Nf3 {-0.35/8 7} Qd5
{+0.40/12 2.2} 7. Nce5 {-0.59/8 4} Ncxe5 {+0.40/12 2.2} 8. dxe5
{-0.73/10 1.6} Nxe3 {+0.38/12 2.1} 9. fxe3 {-0.66/10 1.2} Qb5
{+0.37/11 2.1} 10. Qd4 {-0.55/9 4} c5 {+0.36/10 2.0} 11. Qd2 {-0.47/8 1.4}
Bf5 {+0.36/11 2.0} 12. Qc3 {-0.34/8 2.3} Rd8 {+0.35/12 1.9} 13. Nd2
{-0.28/8 1.0} a6 {+0.36/9 1.9} 14. O-O-O {-0.19/8 1.3} Qa4 {+0.36/11 1.9}
15. Qb3 {-0.54/9 1.5} Qxb3 {+0.36/11 1.8} 16. Nxb3 {-0.67/11 1.6} Rxd1+
{+0.29/15 1.8} 17. Kxd1 {-0.70/11 1.0} b6 {+0.27/13 1.8} 18. Nd2
{-0.64/12 2.6} g5 {+0.30/13 1.7} 19. e4 {-0.47/11 2.4} Be6 {+0.86/15 1.7}
20. e3 {-0.57/10 1.1} Bg7 {+0.88/14 1.7} 21. Bxa6 {-0.68/10 0.9} Bxa2
{+0.84/14 2.0} 22. Bb5+ {-0.69/10 1.1} Kf8 {+0.86/15 2.0} 23. Kc2
{-0.86/11 1.6} Bxe5 {+0.19/13 1.9} 24. b3 {+0.05/11 1.3} e6 {+0.17/11 1.9}
25. Nc4 {+1.09/12 1.0} Bg7 {-1.37/12 1.8} 26. Rd1 {+1.43/12 1.7} f5
{-1.39/11 1.8} 27. Rd8+ {+1.60/11 0.9} Kf7 {-1.63/13 1.7} 28. Rd7+
{+1.52/11 1.0} Kf6 {-1.92/12 1.7} 29. e5+ {+2.13/12 2.0} Kg6 {-2.23/13 1.6}
30. Ra7 {+1.90/12 1.4} h5 {-2.26/12 1.6} 31. Rxa2 {+2.20/12 2.3} Rb8
{-2.26/11 1.6} 32. Ra7 {+2.93/11 1.5} Bf8 {-2.58/11 1.5} 33. Nd6
{+2.90/12 2.0} Bxd6 {-2.65/15 1.5} 34. exd6 {+3.79/11 1.5} Kf6
{-2.40/15 1.5} 35. d7 {+3.48/10 1.1} Ke7 {-3.27/16 1.4} 36. Rc7
{+3.50/10 1.6} Kd8 {-3.27/17 1.4} 37. Rc6 {+2.93/14 1.0} Kxd7
{-3.27/16 1.3} 38. Rxb6+ {+2.95/13 1.1} Kc7 {-3.27/15 1.3} 39. Rxb8
{+2.99/13 0.8} Kxb8 {-3.27/22 1.3} 40. Bd7 {+2.99/11 1.0} e5 {-3.27/21 1.3}
41. Bxf5 {+3.56/10 0.7} Kc7 {-3.27/19 0.8} 42. Kd3 {+3.75/11 1.1} h4
{-4.17/18 0.8} 43. Ke4 {+4.36/11 0.6} Kd6 {-5.07/24 0.8} 44. h3
{+4.43/12 0.6} Ke7 {-5.07/21 0.8} 45. Kxe5 {+5.03/12 0.8} Kf7
{-5.07/20 0.8} 46. Bg4 {+5.07/11 0.5} Kg6 {-5.07/22 0.8} 47. e4
{+5.65/12 1.1} Kg7 {-5.07/22 0.7} 48. Kd6 {+5.76/11 0.6} c4 {-5.07/20 0.7}
49. bxc4 {+12.24/12 0.6} Kh6 {-5.08/18 0.7} 50. c5 {+12.93/12 0.7} Kh7
{-15.20/14 0.7} 51. c6 {+13.48/12 0.8} Kg7 {-999.99/19 0.7} 52. c7
{+79.95/12 0.4} Kf7 {-999.99/18 0.7} 53. c8=Q {+79.96/18 0.4} Kg7
{-999.99/17 0.7} 54. Ke6 {+79.97/28 0.3} Kh7 {-999.99/18 0.7} 55. Kf6
{+79.98/28 0.1} Kh6 {-999.99/24 0.6} 56. Qh8# {+79.99/28 0.1}
{Xboard adjudication: Checkmate} 1-0
[/pgn]
op12no2
Posts: 558
Joined: Tue Feb 04, 2014 12:25 pm
Location: Gower, Wales
Full name: Colin Jenkins

Re: Trapped bishop

Post by op12no2 »

Does it play that as a stand-alone analysis as well (i.e. TTs reset)? If so seems like a great opportunity to find a search bug.
Stan Arts
Posts: 179
Joined: Fri Feb 14, 2014 10:53 pm
Location: the Netherlands

Re: Trapped bishop

Post by Stan Arts »

But after Bxe5 b3 you can't just move over with your king or rook to capture the white square bishop as the dark diagonal is now protected.
Unless you have trapped bishop code in your evaluation it might not really be an outright bug..just lack of depth.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Trapped bishop

Post by bob »

Henk wrote:Skipper plays 23 .. Be5??

[d] 5k1r/4ppbp/1p6/1Bp1P1p1/4P3/4P3/bPKN2PP/7R b - - 3 23

[pgn]
[Event "Computer Chess Game"]
[Site "HP"]
[Date "2015.12.10"]
[Round "-"]
[White "Fairy-Max 4.8S"]
[Black "SkipperWinb"]
[Result "1-0"]
[TimeControl "120"]
[Annotator "1. +0.14 1... -0.02"]

1. d4 {+0.14/8} Nf6 {-0.02/13 2.4} 2. c4 {+0.11/8 5} Nc6 {+0.01/13 2.4} 3.
Be3 {+0.08/8 2.6} d5 {+0.09/13 2.3} 4. Nd2 {-0.03/9 5} dxc4 {+0.39/12 2.3}
5. Nxc4 {-0.27/9 4} Ng4 {+0.39/12 2.2} 6. Nf3 {-0.35/8 7} Qd5
{+0.40/12 2.2} 7. Nce5 {-0.59/8 4} Ncxe5 {+0.40/12 2.2} 8. dxe5
{-0.73/10 1.6} Nxe3 {+0.38/12 2.1} 9. fxe3 {-0.66/10 1.2} Qb5
{+0.37/11 2.1} 10. Qd4 {-0.55/9 4} c5 {+0.36/10 2.0} 11. Qd2 {-0.47/8 1.4}
Bf5 {+0.36/11 2.0} 12. Qc3 {-0.34/8 2.3} Rd8 {+0.35/12 1.9} 13. Nd2
{-0.28/8 1.0} a6 {+0.36/9 1.9} 14. O-O-O {-0.19/8 1.3} Qa4 {+0.36/11 1.9}
15. Qb3 {-0.54/9 1.5} Qxb3 {+0.36/11 1.8} 16. Nxb3 {-0.67/11 1.6} Rxd1+
{+0.29/15 1.8} 17. Kxd1 {-0.70/11 1.0} b6 {+0.27/13 1.8} 18. Nd2
{-0.64/12 2.6} g5 {+0.30/13 1.7} 19. e4 {-0.47/11 2.4} Be6 {+0.86/15 1.7}
20. e3 {-0.57/10 1.1} Bg7 {+0.88/14 1.7} 21. Bxa6 {-0.68/10 0.9} Bxa2
{+0.84/14 2.0} 22. Bb5+ {-0.69/10 1.1} Kf8 {+0.86/15 2.0} 23. Kc2
{-0.86/11 1.6} Bxe5 {+0.19/13 1.9} 24. b3 {+0.05/11 1.3} e6 {+0.17/11 1.9}
25. Nc4 {+1.09/12 1.0} Bg7 {-1.37/12 1.8} 26. Rd1 {+1.43/12 1.7} f5
{-1.39/11 1.8} 27. Rd8+ {+1.60/11 0.9} Kf7 {-1.63/13 1.7} 28. Rd7+
{+1.52/11 1.0} Kf6 {-1.92/12 1.7} 29. e5+ {+2.13/12 2.0} Kg6 {-2.23/13 1.6}
30. Ra7 {+1.90/12 1.4} h5 {-2.26/12 1.6} 31. Rxa2 {+2.20/12 2.3} Rb8
{-2.26/11 1.6} 32. Ra7 {+2.93/11 1.5} Bf8 {-2.58/11 1.5} 33. Nd6
{+2.90/12 2.0} Bxd6 {-2.65/15 1.5} 34. exd6 {+3.79/11 1.5} Kf6
{-2.40/15 1.5} 35. d7 {+3.48/10 1.1} Ke7 {-3.27/16 1.4} 36. Rc7
{+3.50/10 1.6} Kd8 {-3.27/17 1.4} 37. Rc6 {+2.93/14 1.0} Kxd7
{-3.27/16 1.3} 38. Rxb6+ {+2.95/13 1.1} Kc7 {-3.27/15 1.3} 39. Rxb8
{+2.99/13 0.8} Kxb8 {-3.27/22 1.3} 40. Bd7 {+2.99/11 1.0} e5 {-3.27/21 1.3}
41. Bxf5 {+3.56/10 0.7} Kc7 {-3.27/19 0.8} 42. Kd3 {+3.75/11 1.1} h4
{-4.17/18 0.8} 43. Ke4 {+4.36/11 0.6} Kd6 {-5.07/24 0.8} 44. h3
{+4.43/12 0.6} Ke7 {-5.07/21 0.8} 45. Kxe5 {+5.03/12 0.8} Kf7
{-5.07/20 0.8} 46. Bg4 {+5.07/11 0.5} Kg6 {-5.07/22 0.8} 47. e4
{+5.65/12 1.1} Kg7 {-5.07/22 0.7} 48. Kd6 {+5.76/11 0.6} c4 {-5.07/20 0.7}
49. bxc4 {+12.24/12 0.6} Kh6 {-5.08/18 0.7} 50. c5 {+12.93/12 0.7} Kh7
{-15.20/14 0.7} 51. c6 {+13.48/12 0.8} Kg7 {-999.99/19 0.7} 52. c7
{+79.95/12 0.4} Kf7 {-999.99/18 0.7} 53. c8=Q {+79.96/18 0.4} Kg7
{-999.99/17 0.7} 54. Ke6 {+79.97/28 0.3} Kh7 {-999.99/18 0.7} 55. Kf6
{+79.98/28 0.1} Kh6 {-999.99/24 0.6} 56. Qh8# {+79.99/28 0.1}
{Xboard adjudication: Checkmate} 1-0
[/pgn]
There are at least two solutions. For years I had a trapped bishop scoring term. Testing earlier this year showed no benefit with the search depths we see today so it was removed. So either a scoring term if you can't reach reasonable depth, or else tune the search enough that depth alone is enough to solve it.

Crafty's search output looks like this:

Code: Select all

          9->   0.02/16:39   -0.81   1. ... Bxe5 2. Bc4 Bxc4 3. Nxc4 Bc7 4. Rd1
                                     Bxh2 5. Nxb6 Kg7 (s=2)
         10     0.03/16:39   -0.30   1. ... Bxe5 2. Nf3 f6 3. Nxe5 fxe5 4. Ra1
                                     Bf7 5. Ra7 Kg7 6. Rxe7 (s=2)
         10     0.04/16:39   -0.53   1. ... Be6 2. Bc4 Bg4 3. Rf1 e6 4. Nf3
                                     Bxf3 5. gxf3 Bxe5 6. f4 (s=2)
         10->   0.04/16:39   -0.53   1. ... Be6 2. Bc4 Bg4 3. Rf1 e6 4. Nf3
                                     Bxf3 5. gxf3 Bxe5 6. f4 (s=2)
         11     0.05/16:39   -0.59   1. ... Be6 2. Bc4 Bd7 3. Nf3 g4 4. Ng5 Bc6
                                     5. Rf1 Bxe5 6. Rxf7+ Ke8 7. Bd5 (s=2)
         11->   0.05/16:39   -0.59   1. ... Be6 2. Bc4 Bd7 3. Nf3 g4 4. Ng5 Bc6
                                     5. Rf1 Bxe5 6. Rxf7+ Ke8 7. Bd5 (s=2)
         12     0.08/16:39   -0.40   1. ... Be6 2. Ra1 Bxe5 3. Nf3 f6 4. Nxe5
                                     fxe5 5. Ra6 Kf7 6. Rxb6 Rd8 7. Rb7 (s=2)
         12->   0.09/16:39   -0.40   1. ... Be6 2. Ra1 Bxe5 3. Nf3 f6 4. Nxe5
                                     fxe5 5. Ra6 Kf7 6. Rxb6 Rd8 7. Rb7 (s=2)
         13     0.10/16:39   -0.30   1. ... Be6 2. Ra1 Bxe5 3. Nf3 Bb8 4. Nxg5
                                     Bg4 5. Rf1 f6 6. h3 Bh5 7. g4 Bg6 (s=2)
         13->   0.10/16:39   -0.30   1. ... Be6 2. Ra1 Bxe5 3. Nf3 Bb8 4. Nxg5
                                     Bg4 5. Rf1 f6 6. h3 Bh5 7. g4 Bg6
         14     0.12/16:39   -0.33   1. ... Be6 2. Ra1 Bxe5 3. Nf3 Bd6 4. e5
                                     Bc7 5. Nxg5 Bxe5 6. Ra8+ Kg7 7. Rxh8 Kxh8
                                     8. Nxe6 fxe6
         14->   0.12/16:39   -0.33   1. ... Be6 2. Ra1 Bxe5 3. Nf3 Bd6 4. e5
                                     Bc7 5. Nxg5 Bxe5 6. Ra8+ Kg7 7. Rxh8 Kxh8
                                     8. Nxe6 fxe6

Older versions find this quicker, but at 0.04 seconds the search has convinced it that leaving the bishop at a2 is bad...
D Sceviour
Posts: 570
Joined: Mon Jul 20, 2015 5:06 pm

Re: Trapped bishop

Post by D Sceviour »

bob wrote:...For years I had a trapped bishop scoring term. Testing earlier this year showed no benefit with the search depths we see today so it was removed. So either a scoring term if you can't reach reasonable depth, or else tune the search enough that depth alone is enough to solve it....
The removal of the trapped bishop function should produce less accurate scores. In general, this could be a very interesting topic for the future. Earlier I discovered that a small random score change for deep searches actually reduced nodes. What I think is happening is that the evaluator is thrashing on small differences in position. By adding a random score increment, the evaluator can return more decisive scores and thus produce more cutoffs near the horizon. When I get more time I may try this again with some new ideas. Stay tuned.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Trapped bishop

Post by bob »

D Sceviour wrote:
bob wrote:...For years I had a trapped bishop scoring term. Testing earlier this year showed no benefit with the search depths we see today so it was removed. So either a scoring term if you can't reach reasonable depth, or else tune the search enough that depth alone is enough to solve it....
The removal of the trapped bishop function should produce less accurate scores. In general, this could be a very interesting topic for the future. Earlier I discovered that a small random score change for deep searches actually reduced nodes. What I think is happening is that the evaluator is thrashing on small differences in position. By adding a random score increment, the evaluator can return more decisive scores and thus produce more cutoffs near the horizon. When I get more time I may try this again with some new ideas. Stay tuned.
My approach is massive testing, and I go with the results as opposed to my intuition (which has been wrong frequently enough to teach me to test, test and test...) Today's trees are so deep and large (I regularly see 100M nodes per second and beyond on my 20 core box) that there is very little in the way of "critical pathways" that can lead to problems. The tree is almost "self-healing" today as Cozzie and I learned with the artificial hash-collision introduction study we did a few years back. The tree is astoundingly resilient and almost ignores errors, particularly infrequent ones...
D Sceviour
Posts: 570
Joined: Mon Jul 20, 2015 5:06 pm

Re: Trapped bishop

Post by D Sceviour »

bob wrote:
D Sceviour wrote:
bob wrote:...For years I had a trapped bishop scoring term. Testing earlier this year showed no benefit with the search depths we see today so it was removed. So either a scoring term if you can't reach reasonable depth, or else tune the search enough that depth alone is enough to solve it....
The removal of the trapped bishop function should produce less accurate scores. In general, this could be a very interesting topic for the future. Earlier I discovered that a small random score change for deep searches actually reduced nodes. What I think is happening is that the evaluator is thrashing on small differences in position. By adding a random score increment, the evaluator can return more decisive scores and thus produce more cutoffs near the horizon. When I get more time I may try this again with some new ideas. Stay tuned.
My approach is massive testing, and I go with the results as opposed to my intuition (which has been wrong frequently enough to teach me to test, test and test...) Today's trees are so deep and large (I regularly see 100M nodes per second and beyond on my 20 core box) that there is very little in the way of "critical pathways" that can lead to problems. The tree is almost "self-healing" today as Cozzie and I learned with the artificial hash-collision introduction study we did a few years back. The tree is astoundingly resilient and almost ignores errors, particularly infrequent ones...
Artificial hash-collision sounds interesting. There was nothing specifically on google. Would it be worth having a link to look at? I have doubts about "self-healing" with artificial hash-collision because a PVS research requires accurate hash information.

However, this triggered another "self-healing" idea that might be possible. I tried automatic reduction on the horizon after excessive branching factor with some success. That is another one to try again. Lots of ideas today. :idea:

http://www.iflscience.com/technology/ro ... in-minutes
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Trapped bishop

Post by bob »

D Sceviour wrote:
bob wrote:
D Sceviour wrote:
bob wrote:...For years I had a trapped bishop scoring term. Testing earlier this year showed no benefit with the search depths we see today so it was removed. So either a scoring term if you can't reach reasonable depth, or else tune the search enough that depth alone is enough to solve it....
The removal of the trapped bishop function should produce less accurate scores. In general, this could be a very interesting topic for the future. Earlier I discovered that a small random score change for deep searches actually reduced nodes. What I think is happening is that the evaluator is thrashing on small differences in position. By adding a random score increment, the evaluator can return more decisive scores and thus produce more cutoffs near the horizon. When I get more time I may try this again with some new ideas. Stay tuned.
My approach is massive testing, and I go with the results as opposed to my intuition (which has been wrong frequently enough to teach me to test, test and test...) Today's trees are so deep and large (I regularly see 100M nodes per second and beyond on my 20 core box) that there is very little in the way of "critical pathways" that can lead to problems. The tree is almost "self-healing" today as Cozzie and I learned with the artificial hash-collision introduction study we did a few years back. The tree is astoundingly resilient and almost ignores errors, particularly infrequent ones...
Artificial hash-collision sounds interesting. There was nothing specifically on google. Would it be worth having a link to look at? I have doubts about "self-healing" with artificial hash-collision because a PVS research requires accurate hash information.

However, this triggered another "self-healing" idea that might be possible. I tried automatic reduction on the horizon after excessive branching factor with some success. That is another one to try again. Lots of ideas today. :idea:

http://www.iflscience.com/technology/ro ... in-minutes
Go to www.cis.uab.edu/hyatt

scroll down a bit to the "online technical reports". There is an HTML version of the paper that was published in the ICGA Journal...

It was beyond surprising, and the results were replicated in Crafty AND in Zappa (Cozzie's program).
D Sceviour
Posts: 570
Joined: Mon Jul 20, 2015 5:06 pm

Re: Trapped bishop

Post by D Sceviour »

zd3nik
Posts: 193
Joined: Wed Mar 11, 2015 3:34 am
Location: United States

Re: Trapped bishop

Post by zd3nik »

This is a question that has plagued me for a long time. The solution I choose to go with is to add code to the positional analysis to detect trapped pieces, but only penalize them on the order of 16-20 centi-pawns (plus the fact that the piece gets zero mobility bonus).

This isn't enough to prevent your engine from taking the pawn in cases where search depth can't see the trapped piece's demise. But it ensures it will capture a less poisonous pawn when there's multiple capture choices. And it helps the engine play toward trapping the piece if it's playing the side that's losing, or lost, the pawn.

Trying to make it "know" that the piece is trapped via static positional analysis is an exercise in frustration. It's up to deeper search to do that. The trapped piece penalty in static positional analysis is just a rule of thumb; a "nudge" to help the engine get into a better situation in the long run, just like giving a bonus for centralizing pieces, or moving the king behind a pawn shield.

Here are a couple extra test positions for you:

[d] r4rk1/1pq1bppp/p2pb2P/N3p1P1/n3P3/4BP2/PPPQ4/2KR1B1R b - - 0 17 am Bxa2 gxh6
taking the a2 pawn here would be bad

[d] r4rk1/1pq1bp1p/p2pb1pP/N3p1P1/n3P3/4BP2/PPPQ4/2KR1B1R b - - 0 17 bm Bxa2
taking the a2 pawn here would be good