Test position: Find the draw!

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

Moderator: Ras

User avatar
Eelco de Groot
Posts: 4663
Joined: Sun Mar 12, 2006 2:40 am
Full name:   Eelco de Groot

Re: Test position: Find the draw!

Post by Eelco de Groot »

Edmund wrote:
Marc MP wrote:I'm sorry I "read" the article in one minute or so....

Do you think it would implementable in a chess engine without too much loss in time checking the conditions (say with extra pieces)?

You're a programmer if I'm not wrong? (if so you got to answer! :wink: )
In this position, if you just shuffle the pieces around a little and place the black rook and king to support the h5 push and the white mobile pieces further away, then this position will probably be won for black.

Or in other combinations it may be possible that a piece would be sacrificed to create a dangerous passer.

The more possibilites one side has, the harder it becomes to generalize.

In my opinion the first problems with pieces to be approached should be with opposite colored bishops. eg in this position, if either side only had the bishop on the same square color as its pawns, the position would become trivial (knights, rooks and queens are more complicated). There are many more of these type of positions, where the stronger side can't do anything because of a wrong colored bishop.
I think those are good points. The pawn structure is not really rigid with four possible levers, on each side and then you would still have to consider what happens after that. That is more a matter for the search, so I don't think you can put it all in eval. If you leave it to the search then the eval and with that the output, which just reflects some leaf position will be "imperfect", in this case too high for the side up in material.

Rainbow Serpent, because of the symmetry in the pawn position and because only four pawns are at the moment blocking each other evaluates this exactly like Stockfish with the only possible difference being slightly different mobility. The "Restrepo Routines" are helpless I'm afraid in this position.

This just for reference:

Code: Select all

	if (ei.pi->blocked_pawns())
	{
		int closedPosition = count_1s<HasPopCnt>(ei.pi->blocked_pawns());
		int nonBlockedPawns = pos.piece_count(WHITE, PAWN) + pos.piece_count(BLACK, PAWN) - closedPosition;
		if ((closedPosition > 8 || (nonBlockedPawns <=3)) && !ei.pi->passed_pawns())
		{
			if (factor[WHITE] > 16)
				factor[WHITE] = ScaleFactor(factor[WHITE] - ((closedPosition - nonBlockedPawns) * factor[WHITE])/64);
			if (factor[BLACK] > 16)
				factor[BLACK] = ScaleFactor(factor[BLACK] - ((closedPosition - nonBlockedPawns) * factor[BLACK])/64);
		}
	}

Just declaring this a draw or even changing the scale factor, when there are four pawns that could cause a breakthrough is not "obvious". I don't think it is that obvious even to a human player, you still have to calculate what happens if you try a breaktrough, or using a pawn lever as I think it would be called in the testsuites from Swami. It is not obvious to me :)
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
metax
Posts: 344
Joined: Wed Sep 23, 2009 5:56 pm
Location: Germany

Re: Test position: Find the draw!

Post by metax »

I'm not a good chess player and I may very well be wrong but it is really unclear to me how Black could find a way to win this. Even if Black 'shuffles its pieces around', puts the rook to h8 and tries a breakthrough with ...h5, this will - as far as I can see - be no use. White simply plays the bishops to g2/g3, the king to g1 and waits. Even though the h-file is open, I can't find any win for Black. His dark-squared bishop is completely worthless and rook and king cannot break into the white position.
Or am I wrong in evaluating this position (then I'm sorry for posting this wrong 'test')?
User avatar
Eelco de Groot
Posts: 4663
Joined: Sun Mar 12, 2006 2:40 am
Full name:   Eelco de Groot

Re: Test position: Find the draw!

Post by Eelco de Groot »

metax wrote:I'm not a good chess player and I may very well be wrong but it is really unclear to me how Black could find a way to win this. Even if Black 'shuffles its pieces around', puts the rook to h8 and tries a breakthrough with ...h5, this will - as far as I can see - be no use. White simply plays the bishops to g2/g3, the king to g1 and waits. Even though the h-file is open, I can't find any win for Black. His dark-squared bishop is completely worthless and rook and king cannot break into the white position.
Or am I wrong in evaluating this position (then I'm sorry for posting this wrong 'test')?
Hi Luca,

No, I think it is a very good test, at least it was for me worthwhile; to see how the little routine I made completely failed on this position, because there are exactly as many pawns blocked as there are pawns that can still move, and because of the symmetry in the pawn formation, I got almost exactly the same eval as Stockfish, but still it is clear you would like to have a better way of evaluating this because there seems no way to progress for the stronger side.

I think that Edmund's point is more that if the pieces where placed more out of sync, the stronger side (Black) might still try a breakthrough and that you would have to make sure in eval that this is not the case or at least very unlikely if you want to count it as a draw, that you could compare for instance with a draw because of insufficient material left. So it shows just how careful you must be with assuming that what we see as humans with our trained neural networks is something that can be translated 1 to 1, into something usable by the evaluation function that works very differently from our brain, looking square by square and sequentially adding or subtracting integers, without much room for fuzzy logic and limited pattern recognition. And I think your position shows something about pawn structures that is very hard to spot when you evaluate just pawn by pawn, the pawn formation here seems to be balanced so much that you really would need the backing of a Rook and worse placement of the Bishop pair to even begin considering unbalancing it.

I think you have to look at a4-b3-c4 being balanced by a5-b6-c5 as a pattern first in which the b-pawns can't break through without more backing of pieces, and the fact that none of the pawns can be attacked from the side or rear, and that the pieces are blocked by their own pawns. If you calculate all of that in, I think it might work.

The rest of Stockfishes big eval is just an evaluation of Bishop pair versus the exchange, and how these pieces work together in the material imbalance tables. There is almost no consideration there of the type of pawn formation, only the number of pawns. So that would be another area of attack, I mean as a programmer :) Bishop pair versus some pawn formations would be another way of looking at the problem. Or maybe Rook plus Bishop has a hard time winning from the Bishop pair in general, maybe that is also something that might be used, I mean as something that you could test, a hypothetic fuzzy rule.

Regards,
Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
Edmund
Posts: 670
Joined: Mon Dec 03, 2007 3:01 pm
Location: Barcelona, Spain

Re: Test position: Find the draw!

Post by Edmund »

metax wrote:I'm not a good chess player and I may very well be wrong but it is really unclear to me how Black could find a way to win this. Even if Black 'shuffles its pieces around', puts the rook to h8 and tries a breakthrough with ...h5, this will - as far as I can see - be no use. White simply plays the bishops to g2/g3, the king to g1 and waits. Even though the h-file is open, I can't find any win for Black. His dark-squared bishop is completely worthless and rook and king cannot break into the white position.
Or am I wrong in evaluating this position (then I'm sorry for posting this wrong 'test')?
When I wrote my post, I had something like this in mind:

[FEN "7r/4b3/1p1p1pkp/p1p1p1p1/P1P1P1P1/1P1P1P1P/BK6/B7 b - - 0 1"]
1. ... h5 2. Bb1 hxg4 3. hxg4 Rh3 4. Bc2 Rxf3 5. Bd1 Rxd3 6. Kc2 Re3 7. Kd2 Rxe4 *

I was starting from a different startingposition, the position given in the first post is probably drawn. All I wanted to show was that given the pawn formatinon one cannot automatically call the positio a draw.
metax
Posts: 344
Joined: Wed Sep 23, 2009 5:56 pm
Location: Germany

Re: Test position: Find the draw!

Post by metax »

I had some fun playing this position against Twisted Logic in a quick 1+1 (and I am really not a strong player, but Twisted Logic is a strong engine! I have only a German rating number, but it would be something around Elo 1600). The fact that I had 1:42min on my clock after the game was drawn in move 107 (while Twisted Logic had 1.6 seconds), which means that I took around 0.6 seconds per move, shows how simple the white plan is. If anyone is interested, here is the game:


[Event "1+1"]
[Site "?"]
[Date "2010.03.14"]
[Round "?"]
[White "Me"]
[Black "Twisted Logic 20100131x"]
[Result "*"]
[SetUp "1"]
[FEN "r3kb2/8/1p1p1p1p/p1p1p1p1/P1P1P1P1/1P1P1P1P/8/2B1KB2 w q -"]

1. Bg2 Be7 {-1.88/22 11s} 2. Be3 {0s} Kf7 {-1.88/19 6s}
3. Bf2 {1s} Rh8 {-1.88/20 3s} 4. Bg3 {1s} h5 {-1.88/19 2s}
5. Kf1 {2s} Ke6 {-1.87/18 2s} 6. Ke2 {1s} h4 {-1.87/21 2s}
7. Bf2 {0s} Rd8 {-1.87/22 2s} 8. Kd2 {0s} Rc8 {-1.87/22 2s}
9. Kc3 {0s} Rh8 {-1.87/21 2s} 10. Bf1 {0s} Bf8 {-1.88/21
3s} 11. Be2 {0s} Bg7 {-1.88/22 2s} 12. Kc2 {0s} Ra8
{-1.87/19 2s} 13. Be3 {0s} Rb8 {-1.87/21 2s} 14. Bd2 {1s}
Bf8 {-1.87/21 2s} 15. Kb2 {0s} Rc8 {-1.88/21 1s} 16. Kc2
{0s} Be7 {-1.87/22 1s} 17. Kb2 {0s} Rd8 {-1.87/21 1s}
18. Kc2 {0s} Ra8 {-1.88/22 1s} 19. Kb2 {0s} Bf8 {-1.87/22
1s} 20. Kc2 {0s} Rc8 {-1.87/22 1s} 21. Kb2 {0s} Be7
{-1.87/22 1s} 22. Kc2 {0s} Rh8 {-1.87/22 1s} 23. Kb2 {0s}
Kd7 {-1.87/22 1s} 24. Kc2 {0s} Bf8 {-1.87/22 1s} 25. Kb2
{0s} Ke6 {-1.87/22 1s} 26. Kc2 {0s} Bh6 {-1.88/21 1s}
27. Kb2 {0s} Bg7 {-1.87/22 1s} 28. Kc2 {0s} Bf8 {-1.87/22
1s} 29. Kb2 {0s} Rg8 {-1.87/23 2s} 30. Kc2 {0s} Bh6
{-1.88/22 1s} 31. Kb2 {0s} Rg7 {-1.87/21 1s} 32. Kc2 {0s}
Ra7 {-1.87/22 1s} 33. Kb2 {0s} Rc7 {-1.87/22 1s} 34. Kc2
{0s} Rb7 {-1.87/21 1s} 35. Kb2 {0s} Rf7 {-1.87/21 1s}
36. Kc2 {0s} Bg7 {-1.87/21 1s} 37. Kb2 {0s} Rc7 {-1.87/21
1s} 38. Kc2 {0s} Ra7 {-1.87/22 1s} 39. Kb2 {0s} Rf7
{-1.87/21 1s} 40. Kc2 {0s} Rd7 {-1.87/22 1s} 41. Kb2 {0s}
Ke7 {-1.87/21 1s} 42. Kc2 {0s} Rc7 {-1.87/21 1s} 43. Kb2
{0s} Rc8 {-1.87/21 1s} 44. Kc2 {0s} Rb8 {-1.87/21 1s}
45. Kb2 {0s} Ra8 {-1.87/20 1s} 46. Kc2 {0s} Ra7 {-1.87/22
1s} 47. Kb2 {0s} Bf8 {-1.87/20 1s} 48. Kc2 {0s} Ra6
{-1.87/18 1s} 49. Kb2 {0s} Ke6 {-1.87/16 1s} 50. Kc2 {0s}
Ra7 {-1.25/14 6s} 51. Kb2 {0s} Rb7 {-1.17/13 4s} 52. Kc2
{0s} Bg7 {-0.98/14 2s} 53. Kb2 {0s} Kd7 {-0.83/15 2s}
54. Kc2 {0s} Rb8 {-0.83/15 1s} 55. Kb2 {0s} Rh8 {-0.64/15
1s} 56. Kc2 {0s} d5 {-0.58/16 0s} 57. cxd5 {12s} Bf8
{-0.63/16 1s} 58. Kc3 {2s} Be7 {-0.63/18 0s} 59. Kc4 {0s}
Kd6 {-0.63/18 0s} 60. Kb5 {0s} Bd8 {-0.63/20 0s} 61. Bc3
{1s} Bc7 {-0.63/20 0s} 62. Bd2 {0s} Rh6 {-0.63/20 0s}
63. Bc3 {0s} Rh7 {-0.63/21 0s} 64. Bd2 {0s} Bd8 {-0.63/21
0s} 65. Bc3 {0s} Re7 {-0.63/20 0s} 66. Bd2 {0s} Rc7
{-0.63/17 0s} 67. Bc3 {0s} Rg7 {-0.63/21 0s} 68. Bd2 {0s}
Rb7 {-0.63/21 0s} 69. Bc3 {0s} Rh7 {-0.63/22 0s} 70. Bd2
{0s} Rh6 {-0.63/21 0s} 71. Bc3 {0s} Bc7 {-0.63/21 0s}
72. Bd2 {0s} Kd7 {-0.63/20 0s} 73. Bc3 {0s} Rh8 {-0.63/20
0s} 74. Bd2 {0s} Rb8 {-0.63/21 0s} 75. Bc3 {0s} Bd8
{-0.63/20 0s} 76. Bd2 {0s} Kd6 {-0.63/21 0s} 77. Bc3 {0s}
Ra8 {-0.63/21 0s} 78. Bd2 {0s} Bc7 {-0.63/21 0s} 79. Bc3
{0s} Rd8 {-0.63/21 0s} 80. Bd2 {0s} Rd7 {-0.63/21 0s}
81. Bc3 {0s} Rg7 {-0.63/21 0s} 82. Bd2 {0s} Rg8 {-0.63/22
0s} 83. Bc3 {0s} Bd8 {-0.63/21 0s} 84. Bd2 {0s} Rg7
{-0.63/22 0s} 85. Bc3 {0s} Rf7 {-0.63/22 0s} 86. Bd2 {0s}
Rd7 {-0.63/22 0s} 87. Bc3 {0s} Ra7 {-0.63/21 0s} 88. Bd2
{0s} Re7 {-0.63/22 0s} 89. Bc3 {0s} Re8 {-0.63/21 0s}
90. Bd2 {0s} Bc7 {-0.63/21 0s} 91. Bc3 {0s} Ra8 {-0.63/22
0s} 92. Bd2 {0s} Rh8 {-0.63/22 0s} 93. Bc3 {0s} Rg8
{-0.63/22 0s} 94. Bd2 {0s} Bd8 {-0.63/22 0s} 95. Bc3 {0s}
Be7 {-0.63/20 0s} 96. Bd2 {0s} Kc7 {-0.63/19 0s} 97. Bc3
{0s} Bd8 {-0.63/19 0s} 98. Bd2 {0s} Rf8 {-0.63/19 0s}
99. Bc3 {0s} Re8 {-0.63/17 0s} 100. Bd2 {0s} Rg8 {-0.63/15
0s} 101. Bc3 {0s} Rf8 {-0.34/13 0s} 102. Bd2 {0s} Re8
{-0.52/14 0s} 103. Bc3 {0s} Be7 {-0.46/15 1s} 104. Bd2 {0s}
Kd6 {0.00/15 2s} 105. Bc3 {0s} Rc8 {0.00/17 1s} 106. Bd2
{0s} Rb8 {0.00/17 0s} 107. Bc3 {2s} *


My Elo difference to Twisted Logic is 1200. Under normal conditions TL would win every game against me. The fact that I managed to draw this game shows that the positio just has to be a draw, and the draw is simple.