Showing posts with label Fruit. Show all posts
Showing posts with label Fruit. Show all posts

Monday, August 3, 2020

Jerome Gambit: Two Computer Programs Walk Into A Bar...

I put some work into maintaining this blog, but I never could do it without the ideas, analysis and games that Readers send me.

For example, here is an introduction and then some analysis that I recently received (thank you, Anastazja) concerning a chess game where Stockfish gave Fruit 1.2 "Jerome Gambit odds".
Interested in the Jerome Gambit, I decided to look into it a little bit. However since my own chess playing abilities are a little weak, and since I don't play chess myself and I am more interested in AI research (and that of course leads to chess), I decided to test it on some computer games. However, since the Jerome Gambit is a very hard line to hold as white, I needed to change things a little bit. Considering that you would usually play Jerome Gambit against unprepared opponents looking to surprise them, it in theory has no place in today's computer chess. Their deep search can easily spot tactics and not fall victim to early queen attacks. However it turns out, that if you look deep enough, even computers can be outplayed with the opening. In the game I wish to share, white managed to use the queen checks to create a blocked position with very long term plans, making it very easy for opponents to become overzealous. 
Since the evaluation of the top chess engine Stockfish is at -3.5 pawns black advantage and the same engine can't surprise itself, I decided to try something different. I put Stockfish as white and an old engine called "Fruit 2.1" as black. Fruit is an old engine, however it still is about 2800 elo in strength, which would put it near world champion level. Moreover, its strength mostly comes from tactical prowess, as engines back in the day were relatively weak positionally. One would think that the Jerome Gambit is a tactical line that looks for compensation in terms of attack on the king that is in the open, so an engine with superhuman tactics should easily hold it. It turns out that it's not so simple. 
The game is 150 moves long, however most of those moves are just "shuffling" moves waiting for 50 move rule to take effect. White of course wants the draw, as it's a piece down, however black doesn't want that to happen. Even though most of the game are "pointless" rook and king moves, the critical moments of the game are definitely very interesting in my opinion. 
Game starts in the Jerome Gambit Accepted position, after Kxf7. White develops its remaining pieces. This, combined with queen checks, has led black to a little chaos. Black tried to force the queen trade, however the little positional and development edges white gained earlier made it not so simple. When black finally got its pieces developed and queens off the board, the position was already blocked and white got its own fortress ready. 
After creating a blocked position, both engines just shuffled around for multiple moves. The "shuffling" starts at move 34.Rf2 and continues for about 100 moves. White, being a piece down, has held the position because black could make no progress. Black constantly looked for opportunities, however the preparation in the first 30 moves of the game has made it impossible for black to find any kind of an attack. 
First 50 move rule reset happens at [71]...axb4 and [72].axb4. This pawn exchange doesn't open the position however, so engines continue to shuffle around. It's on move [121]...Rxc6 that the game gains a new life. Fruit playing as black, sacrifices the rook for a knight to open up the position hoping for some kind of an attack. Black is still up in terms of pieces, bishop and a knight for a rook. White has one pawn more, however in engine games pieces are usually worth a lot more than pawns. It turned out to be a very serious mistake. White managed to showcase a beautiful temporary rook sacrifice that led to a creation of connected passed pawns which ultimately gave white the material back and ultimately won the game. 
This result surprised me. If a 2800 elo engine has fallen victim to impatience and being overzealous because of the material advantage, a human surely can too. I'm not an expert so I can't really evaluate the position after it got locked and I don't know how it would play out if it was two humans, however I can easily see humans sacrificing and going for even worse attacks way earlier. The mental advantage Jerome Gambit can definitely catch some humans off guard, however I would never it would happen to an engine as well.
When I raised the question of the exchange of Queens, I received

Fruit definitely wanted the queen exchange to happen at first, the king was still in the open and the checks could prove a little annoying, plus exchanging the pieces when up the material is definitely a good idea. After [10]...Qb4, Fruit expected [11].Qxb4, however Stockfish played the [11].Qb5 move. Even though Fruit wanted the exchange to happen, [11]...Qxb5 would be followed by [12].Nxb5 with an attack on the c7 pawn. The only way to defend that pawn is [14]...Ne8, however after [13].Bf4 the pawn is still most likely going to fall. Black's pieces are still not developed, the knight on e8 blocks the access to an open file for the rook (and the other open file is blocked by the king). Apparently the engine thought that it no longer has any time to trade the queens, as development is more important. Can't make the use of the extra piece when most of them are hidden behind pawns after all. White used all this crucial time gained that way to create a solid position which then turned out to be impenetrable.  
stockfish_20060616_x64_modern  - fruit_2.1
computer vs computer, 2020

1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. Bxf7+



4...Kxf7 5.O-O Nf6 6.Nxe5+ Nxe5 7.d4 
Bxd4 8.Qxd4 Nc6 



So far, following in the path of Demon 1.0 - Rybka 2.3.2a (0-1, 53) and La Dame Blanche 2.0c - Rybka 2.3.2a (0-1, 41) from the Torneo tematico GaJero00–A PC Intel Pentium 4 630 3000 1, in 2009. 

9.Qa4 Qe7 10.Nc3 Qb4 11.Qb5 d6 12.Qd3 Be6 13.b3 Rhf8 14.Bd2 Qd4 15.Rae1 Rae8 16.Be3 Qxd3 17.cxd3 Nb4 18.Rd1 Ng4 19.Bc1 a5 20.d4 Nf6 

21.d5 Bd7 22.f3 h6 23.Rf2 b6 24.a3 Na6 25.Rc2 g5 26.h3 Re7 27.Ne2 Nc5 28.Rc3 Rfe8 29.b4 Ba4 30.Rf1 Nb3 31.Ng3 Kg6 32.Bb2 Rf7 

33.Rd3 Nd7 34.Nf5 b5 35.g4 Nb6 36.h4 Nc4 37.h5+ Kh7 38.Rf2 Ra8 39.Kh2 Ra7 40.Kg3 Ra6 41.Kg2 Rf8 42.Rc3 Raa8 43.Kg3 Rfe8 

44.Rg2 Ra7 45.Rd3 Rf8 46.Rf2 Rf7 47.Kh2 Ra8 48.Kg3 Re8 49.Re2 Ref8 50.Rf2 Rb8 51.Kh2 Rff8 52.Kg3 Rbe8 53.Rg2 Ra8 54.Rh2 Rad8 55.Rf2 Rb8 56.Re2 Rf7 57.Rh2 Rg8 58.Rg2 Rd8 59.Re2 Re8 60.Rg2 Rff8 61.Re2 Rg8 62.Rf2 Ra8 63.Rg2 Ra6 64.Re2 Rga8 65.Rg2 Rf8 66.Re2 Rf7 67.Rg2 Rb6 68.Rf2 Rf8 69.Rh2 Rb7 70.Rf2 Ra7 71.Rg2 axb4 



The fifty-move rule states that a player can claim a draw if no capture has been made and no pawn has been moved in the last fifty moves. Fruit 2.1 assesses itself as better, and, although it can not figure out a breakthrough, it does not want to give up the 1/2 point.

72.axb4 Raa8 73.Re2 Ra6 74.Rg2 Rf7 75.Re2 Ra8 76.Rg2 Re8 77.Re2 Ref8 78.Rf2 Rb8 79.Rh2 Rg8 80.Re2 Re8 81.Rg2 Ra8 82.Rh2 Rd8 83.Rf2 Rdf8 84.Re2 Rg8 85.Kh3 Ra8 86.Kg3 Rff8 87.Rg2 Rae8 88.Rf2 Rb8 89.Rh2 Rbc8 90.Rf2 Rcd8 91.Rh2 Rb8 92.Rc3 Rb7 93.Rd3 Rb6 94.Rf2 Rg8 95.Ne7 Re8 96.Nf5 Rf8 97.Re2 Rg8 98.Rh2 Ra6 99.Rf2 Raa8 100.Re2 Rgd8 101.Rf2 Rd7 102.Rg2 Ra6 103.Bf6 Rf7 104.Bb2 Ra7 105.Rh2 Rb7 106.Rg2 Rb6 107.Re2 Rd7 108.Rf2 Rb8 109.Rh2 Re8 110.Rg2 Ra8 111.Rh2 Rf8 112.Rf2 Rg8 113.Rh2 Rdd8 114.Rf2 Rb8 115.Rh2 Rb6 116.Rf2 Rb7 117.Rh2 Rbb8 118.Ne7 Rge8 119.Nc6 Rb6 120.Rg2 Kg8 121.Rf2 



Black is bumping up against the 50-move rule again. Perhaps its programming has a "contempt factor" built in, that prohibits it to offer a draw in this kind of situation. Of course, one way to get by the 50-move rule here is to play 121...Nxb2. Instead, Fruit 2.1 sacrifices the exchange.

121...Rxc6 122.dxc6 Ra8 123.Rd5 Ra7 



I expected that Fruit 2.1 would continue with its sacrifice-the-exchange plan and grab the extra pawn, i.e. 123...Ra6, and if 124.e5, then 124...Nxe5 125.Bxe5 dxe5 126.Rxe5 Rxc6 and my buddy, Komodo 10, sees the position as even.

Stockfish now shows the kind of creativity we expect from Jerome Gambit players.

124.e5 Ne3 

This does not work, as Stockfish is ready for it.

125.Rxd6 cxd6 126.exd6 

Suddenly, the "Jerome pawns" make their appearance. Despite the fact that Black has two extra Knights, White is better.

126...Nd5 127.Re2 Ra8 128.Re5 Nxb4 129.c7 Na6 



130.c8=Q+ Rxc8 131.d7 Rd8 132.Re8+ Kf7 133.Rxd8 Ke7 134.Ra8 Nb8 135.Rxb8 Kxd7 



White is clearly winning, but some programs don't resign, they wait until they are checkmated.

136.Rh8 Na5 137.Rxh6 Nc4 138.Rg6 Bc2 139.Rxg5 Nxb2 140.Rxb5 Na4 141.Rb7+ Kc6 142.Rb4 Nc5 143.Rc4 Bd3



144.Rxc5+ Kxc5 

Black has an extra piece, while White has extra pawns, an echo of the position 100 moves earlier.

145.f4 Kd6 146.f5 Ke7 147.Kf4 Bc4 148.g5 Bg8 149.g6 Be6 150.fxe6 Kxe6 151.h6 Kf6 152.g7 Kf7 153.Ke5 Kg8 154.Kf6 Kh7 155.Kf7 Kxh6 156.g8=Q Kh5 157.Qg3 Kh6 158.Qh4 checkmate