Tuning

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

Moderator: Ras

bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Huge simplification

Post by bob »

mcostalba wrote:
mcostalba wrote: I can write a closed position detector to be used by people to write tests on it
Ok I have pushed a branch called closed_positions:

https://github.com/mcostalba/Stockfish/ ... d_position

with the code that implements your definition. Now I am able to detect positions like this one:

[d]r1q2rk1/2p3pp/2Pp4/p2P1p2/Q3p3/4P3/PP1R2PP/1K5R b - - 0 23
That is not close to blocked.
User avatar
AdminX
Posts: 6363
Joined: Mon Mar 13, 2006 2:34 pm
Location: Acworth, GA

Re: Huge simplification

Post by AdminX »

bob wrote:
mcostalba wrote:
mcostalba wrote: I can write a closed position detector to be used by people to write tests on it
Ok I have pushed a branch called closed_positions:

https://github.com/mcostalba/Stockfish/ ... d_position

with the code that implements your definition. Now I am able to detect positions like this one:

[d]r1q2rk1/2p3pp/2Pp4/p2P1p2/Q3p3/4P3/PP1R2PP/1K5R b - - 0 23
That is not close to blocked.
That's semi-open! :D
"Good decisions come from experience, and experience comes from bad decisions."
__________________________________________________________________
Ted Summers
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Huge simplification

Post by mcostalba »

I have generalized the close position detector to evaluate any chain of blocked pawns: now is very general and flexible, the chain is evaluated according to its size and if is in the center or not. I have submitted some tests although very probably weights are wrong so I don't expect nice surprises.
arjuntemurnikar
Posts: 204
Joined: Tue Oct 15, 2013 10:22 pm
Location: Singapore

Re: Huge simplification

Post by arjuntemurnikar »

Lyudmil Tsvetkov wrote:Hi Arjun.

By 4th rank I meant considering in storm danger f4,g4, h4 pawns as dangerous for a black king on g8.
Yes same thing. 5 ranks are included: Assuming King was RANK_1, then 1, 2, 3, 4, and 5 are included.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Huge simplification

Post by Lyudmil Tsvetkov »

arjuntemurnikar wrote:
Lyudmil Tsvetkov wrote:Hi Arjun.

By 4th rank I meant considering in storm danger f4,g4, h4 pawns as dangerous for a black king on g8.
Yes same thing. 5 ranks are included: Assuming King was RANK_1, then 1, 2, 3, 4, and 5 are included.
Because, in some particular types of position, SF frequently does not see pushes to the 4th rank like f4,g4 and h4, especially when both kings have castled on the same side.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Why this does not work?

Post by Lyudmil Tsvetkov »

2 further games where SF underestimates doubled rooks on an open file.



8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

1r6/4r1k1/1pbp2p1/q1p4p/P1Pp1Pn1/3P1BP1/1R1N3P/RQ4K1 b - - 0 61
SF has just played 61.Ne4-d2 with a zero score.

8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

4r3/4r1k1/1p1p2p1/q1p4p/P1Pp1Pn1/3P1NP1/1R5P/RQ4K1 w - - 0 63
After Gull doubles its rooks along the e file, it sees +70cps black edge. SF here still thinks white is worse by only some 30-40cps.

8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

q3r3/6k1/1R1p2p1/2p4p/P1Pp1PnN/3P2P1/4r2P/RQ4K1 w - - 0 65
Upon entering the 7th rank, the black rook decides the game. Doubled rooks on an open file are so forceful, because they remain unchallenged.

8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

2r2rk1/pb2q1pp/1pn1p3/3p4/3Pnp2/PP1Q1NP1/1BR1PPBP/2R3K1 b - - 0 18
Gull has just doubled its rooks on the c file and sees half a pawn white edge, SF only 20cps.

8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

2r1r1k1/1b3np1/2n1p1qp/ppRp4/3P1P2/PP2QNPB/1B2P2K/2R5 b - - 0 29
SF now sees white is winning, but it is already too late. The battle is decided mainly by the white doubled rooks that support tactically a wide range of lines that would otherwise be impossible. That is why it is always good to have doubled rooks, even if you see nothing concrete, something is bound to exist.

SF would do well to think over why doubled rooks code does not work in it. This is a major term and SF loses games because of its lack, but probably some redundancies again, or imperfect definitions, or maybe even search, influences such an outcome. People that know SF code should know better.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Hacky rules 2

Post by Lyudmil Tsvetkov »

2 other games where a rook is much stronger than an enemy minor plus pawns, but SF would not think so.



8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

6k1/1p5p/2p3p1/p1n5/2Pn4/4R2B/PP5K/8 w - - 0 42
It is interesting that both engines do not evaluate quite correctly this position, seeing only some 20cps white advantage. Gull is a bit better in its eval, but just by cps.

8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

5k2/7R/8/ppn3p1/3n2Bp/1P6/P6K/8 b - - 0 48
Now SF is faster to recognize white is much better, but that does not help a lot, as the position is already lost. A good eval knowledge moves earlier, however, before the vital exchanges were made, could have saved SF much trouble and the point.

8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

4k3/8/8/pp4p1/4n1Bp/1P1R4/P3n2K/8 b - - 0 51
A rook seems to be so much stronger than N + 2 pawns.

8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

1k6/1p3p2/p2b2p1/5b2/8/1P1NR3/P1P5/1K6 w - - 0 40
It is rook vs minor + pawn. Gull sees half a pawn white edge, SF only 25cps.

8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

4R3/1k3p2/p3b1p1/1p4b1/1N6/1P6/P1P1K3/8 w - - 0 54
Same imbalance. Moves later search already helps SF realise white is winning.

8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

8/8/1k3ppb/p1N2b2/2K1R3/1P6/P7/8 w - - 0 67
Once again, rook proves to be much stronger than minor + pawn.

Well, you see SF imbalance eval, what concerns rook-minor imbalances, is really wrong. Games where SF evaluates incorrectly this imbalance are really rife. I posted just a few, but there are much more. Something really should be done to fix this problem.

One of Reuven's patches started well, maybe try to improve on it?
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Gullible 2

Post by Lyudmil Tsvetkov »

2 more games where SF severely underestimates blocked pawn on the 6th rank.



8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

r6r/3qnk2/p3npp1/1pp1p2p/P3P2N/1PpP1NP1/2P1QP1P/R4RK1 w - - 0 30
Gull sees 60cps black edge, SF only 20cps. The c3 blocked pawn on the 6th rank does not bother SF too much.

8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

3r3r/3q1k2/p4p2/2p1p1pp/Pp1nP2P/1PpPN1P1/2P2PQK/R4R2 w - - 0 37
Even now, SF sees only 40cps black edge, Gull 80cps. The c3 pawn is tremendous.

8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

6r1/5k2/p3qr2/2p1pN1p/Pp1nP1p1/1PpP1PP1/2P2Q1K/4R1R1 w - - 0 44
Only now SF realises it is dead lost. The c3 blocked pawn is instrumental in claiming the win by the sheer pressure it exercises.

8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

4r3/p1pk1p2/3p2p1/7r/4Pn2/1PB2P1p/PKP4P/3R1R2 b - - 0 31
Both engines see themselves in advantage. Who is right? I think Gull. The h3 black pawn is tremendous, and besides h2 is very vulnerable.

8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

4r3/2pk4/p2p2p1/4rp2/4P3/1P1R1P1p/PKP3nP/2B2R2 w - - 0 35
SF still thinks it is equal, Gull sees half a pawn black advantage. The h3 blocked pawn is a permanent threat.

8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

8/2pk4/p2p1P2/5r2/6p1/1PK2P1p/P1PB2nP/5R2 w - - 0 42
Only now SF realises it is losing.

Well, what to say, too many lost SF games on one and the same theme. I really already lost count of them. It should not be very difficult to fix this problem, but who knows when will this happen.
carldaman
Posts: 2283
Joined: Sat Jun 02, 2012 2:13 am

Re: Huge simplification

Post by carldaman »

Lyudmil Tsvetkov wrote:
mcostalba wrote:
mcostalba wrote: Ok I have pushed a branch called closed_positions:

https://github.com/mcostalba/Stockfish/ ... d_position
Following Lyudmil indications I have refined the detector requiring that pawns are on a diagonal chain. Now I don't detect anymore positions as the previous one posted, but only these kind of positions:

[d]rn1qk2r/pp3ppp/2p2n2/2Pp1b2/3Pp3/P1P1P3/3B1PPP/R2QKBNR w KQkq - 1 9
Perfect, that is precisely a KID-type closed position.

Taking into account that an f2 backward pawn is also present, this is precisely the type of position for which the white king should receive some nice penalty, as the general pattern favours black very much, especially what concerns possible king attacks.

I see SF starts understanding the KID now. Carl will be very happy. :D


I'm very happy even more so seeing that Marco is working with you on this very critical matter. :D I believe he won't regret it :)

Now, I've known that since about 5 months ago SF can play a mean KID (usually from the attacking/Black side) and some of the tweaks clearly found their way into how it plays these positions. It is mind boggling how every move has a purpose (see game below) and the execution is incredibly accurate, while Houdini or other top engines have no idea what's coming their way until it's too late.

The problem as I see it, is that SF's eval does not yet allow it to seek out these KID positions in the first place. Once faced with the well-known position after 12 moves in the game below, it outplays everybody in spectacular fashion.

The next step should be to bring its eval in line so that it fully recognizes the attacking potential of such positions and doesn't shy away from them. Rating such positions as much better for White is incorrect and counterproductive, since SF has tremendous fighting chances on the Black side of the Classical KID.

The game is _very typical_ of how SF plays the KID against top engines. I have numerous other examples.

40m/20m acc., 512 MB hash, 2 cores, 5-man syzygy, ponder off



8 
7 
6 
5 
4 
3 
2 
1 
abcdefgh

r1b3k1/8/p5q1/3P4/P1P1P3/3BQPn1/R4KP1/7r b - - 4 42

Surreal, isn't it? :lol:

Cheers,
CL
carldaman
Posts: 2283
Joined: Sat Jun 02, 2012 2:13 am

Re: Huge simplification

Post by carldaman »

Lyudmil Tsvetkov wrote:
Joerg Oster wrote:
mcostalba wrote:
Lyudmil Tsvetkov wrote: this is precisely the type of position for which the white king should receive some nice penalty, as the general pattern favours black very much, especially what concerns possible king attacks.
Why it favors black and not white? What if position is flipped? It would favor white instead?

Once detected the closed position how can SF understand if it favors white or black?
Black's pawn chain is pointing towards the kingside. White's chain towards the queenside. If Black castles short, there is no impact from white's chain. Contrary to black's chain, if White castles short.
So another idea might be to give a penalty for White castling short in these KID like positions. Or, if White already castled short, give a penalty to king safety.
Since this is partially redundant with pawns attacking kingRing, maybe that penalty should be increased in such positions.
Of course, that's all only valid if I correctly understood Lyudmil's idea. :lol:
Hi Joerg.

As usual, you understood my idea better than myself. :D

If you allow me, I think the best thing with such structures would be to give penalty for the king in the general case when it is on the side where the chain is pointed at, i.e. for king on e1,f1,g1,h1, regardless of whether it has castled or not.
I do not know about the penalty, maybe 20cps for a start would be OK, but who knows. What were Joona's values?
Hi Joerg and Lyudmil,

You could also try a progressively larger penalty that increases from e1 to f1 to g1/h1. Maybe 10 cp for e1, 15 cp for f1 and 20 cp for g1/h1.

Regards,
CL