Glaurung in the Open Polish Computer Chapionships 2007

Links

Day 0 (Thursday, June 28)

I arrived at the airport in Warszawa around 10 PM, too late for the last buses and trains to Lodz. Fortunately, my good friend Grzegorz Sidorowicz (author of Armageddon) had arranged to pick me up at the airport and drive me to Lodz. I was given the task of reading the maps and finding our way to the hotel, which proved to be unexpectedly difficult, but after various adventures we finally found the place.

Day 1 (Friday, June 29)

Early next morning, after getting up and looking at the few and not particularly nerdy-looking people who were already present in the hotel restaurant, I arrived at the unexpected conclusion that I appeared to be the earliest chess programmer to arrive for breakfast. I was sitting there for a while, eating breakfast while watching the people who entered and trying to guess who among them were likely to be chess programmers, until a guy with a Google T-shirt entered the room. The Google guy turned out to be Aleksandrs Saveljevs, author of the Latvian chess program Warrior.

Shortly after, the rest of the programmers started appearing, and there was soon a big crowd of us around the table. After breakfast, it was time to go to the Technical University of Lodz, where the tournament was being held.

Match between GM Barlomiej Macieja and computer programs

Grandmaster Bartlomiej Macieja, the European Chess Champion from 2002, is not only an extremely strong chess player, but also a very nice and sympathetic person. He is also remarkably courageous, as proven by his willingness to play four rapid chess games against strong computer opponents during a single morning. Most GMs don't play public games against computers at all, and if they do, they usually demand very favorable conditions. The conditions for the human in Macieja's match must be described as very unfavorable. Computers are generally thought to be stronger in rapid games than in slow games, and the fact that there was hardly any time for rest between the games made Macieja's task even more formidable.

Glaurung was initially not supposed to play against Macieja, but was added to the computer lineup at the last moment, when Rybka and Zappa resigned from the tournament.

The first one to play against Macieja was the Dutch program Diep by Vincent Diepeveen. The game was a wild tactical melee, where first Macieja, and later Diep appeared to be winning, before Macieja surprised the audience (or at least me) by finding a forced draw. This was a great game to watch, and a very impressive performance by Macieja.

Glaurung was the next in line, and was lucky to play white. Unfortunately, I had misunderstood the time controls, and set my program at a level of 20+1 (20 minutes for the game, plus 1 second per move), while the real time controls turned out to be 20+10. Glaurung therefore played far too quickly throughout the game, but considering the position after the opening, it is unlikely that the result would have been different if my program had spent more time.

Glaurung Lodz 2007 - Bartlomiej Macieja

1. e4 e5 2. Nf3 Nf6 3. d4 Nxe4 4. Bd3 d5 5. Nxe5 Nd7 6. Nxd7 Bxd7 7. O-O Bd6 8. c4 c6 9. cxd5 cxd5 10. Qh5 O-O 11. Qxd5 Bc6 12. Qh5 g6 13. Qh3 Ng5 14. Bxg5 Qxg5 15. Nc3 Rae8

In this position, Glaurung was out of book. The choice of book line was unfortunate: White has an extra pawn, but black's bishop pair, active pieces, and pressure against the white king gives him full compensation, and indeed a near-forced draw. Glaurung manages to find a few more theory moves on its own, but the resulting position is completely lifeless.

16. Rad1 Re7 17. d5 Bd7 18. Ne4 Rxe4 19. Qxd7 Rd8 20. Qxd8+ Qxd8 21. Bxe4 Qf6

Even simpler was 21... Qh4 22. f4 Bxf4 23. Rxf4 Qxf4 24. d6 Qg4, with an instant draw.

22. g3 Qxb2

According to Macieja, this position has been played once before in a GM game, and a draw was agreed a few moves later. Glaurung, however, was too stupid to realize that black's position is completely impregnable, and thought it had an advantage worth about half a pawn at this stage of the game. For the next 30 moves, nothing interesting happens.

23. Rb1 Qd4 24. Bf3 b6 25. Rfe1 Kg7 26. Kg2 h5 27. h4 Bc5 28. Re2 Qc4 29. Rbb2 Qd4 30. Rbd2 Qf6 31. Rd1 Qd6 32. a4 a5 33. Re4 Qf6 34. Re2 Qd6 35. Red2 Bb4 36. Rc2 Bc5 37. Rd3 Kf8 38. Re2 Kg7 39. Rd1 Qf6 40. Red2 Qd6 41. Be2 Bb4 42. Ra2 Qe7 43. Bb5 Qe4+ 44. f3 Qe5 45. Re2 Qf6 46. Bc6 Bd6 47. Rf1 Qf5 48. Re4 Qf6 49. f4 Qc3 50. Re2 Qd3 51. Rfe1 Bb4 52. Re3 Qd2+ 53. R1e2 Qd1 54. Kh2 Qf1 55. Rg2 Bc5 56. Bb5

Here Macieja thought for a very long time, before he finally uncorked...

56... Qxg2+!

At first I thought that white had a chance to win the resulting opposite-colored bishop endgame, but it soon turned out that Macieja had calculated everything correctly. The game ends in a draw.

57. Kxg2 Bxe3 58. d6 Bc5 59. d7 Be7 60. Kf3 f5 61. Ke3 Kf6 62. Bc4 Bc5+ 63. Ke2 Be7 64. Kd3 Bd8 65. Bg8 Ke7 66. Kc4 Bc7 67. Kd5 Kxd7 68. Bh7 Bd6 69. Bxg6 Bc5 70. Ke5 Bf2 71. Kxf5 Bxg3 72. Kg5 Ke7 73. Bxh5 Be1 74. Be2 Bc3 75. h5 Bb2 76. h6 Ba1 77. f5 Bf6+ 78. Kg6 Be5 79. Bh5 Bf6 80. h7 Bh8 81. Kg5 Bf6+ 82. Kf4 Kd6 83. Bf7 1/2-1/2

Having defended successfully against Diep and Glaurung, the two Polish programs Butcher and Matacz were next. To everybody's surprise, Macieja lost both games, despite having good winning chances against Butcher and a forced tactical win against Matacz. The missed win against Matacz was so pretty that it deserves to be seen:

In this position, Macieja had the chance to play the beautiful move 12... b5!!, with a winning attack. If white tries to grab the pawn by 13. cxb5, there follows 13... Nxe4! 14. Nxe4 Qa4! 15. bxc6 Qb3!, with a crushing attack against the white king:

Macieja didn't see this move, and retreated the knight with 12... Nb8 instead. A few moves later, it was Matacz who had the chance to unleash some flashy pyrotechnics:

Matacz sacrificed the queen with 18. Nxe5! fxe4 19. Bh5+. If black tries 19... Kf8, white wins a ton of material with 20. Ng6+ Ke8 21. Nxh8+ Kf8 22. Ng6+ Kg8 23. Ndxe7+ Kh7 24. Nxc8. Macieja decided he had seen enough, and decided to end the pain quickly by playing 19... Ke8 20. Nf4+, with mate in the next move.

After Macieja had finished playing all four programs, it was time for the main tournament to begin.

Round 1

Not all chess programs are optimized for maximum playing strength. Pitr Cichy, author of nanoSzachy and pikoSzachy, optimizes his programs for size. While Glaurung weighs in at 300-400 KB, nanoSzachy is only 29.5 KB, and pikoSzachy is a ridiculous 9 KB. Despite their tiny sizes, both programs play remarkably good chess (especially at fast time controls), and are able to win even against the best chess programs on good days. It's amazing that it is possible to pack so much strength in such small programs.

Glaurung - nanoSzachy

1. e4 c6 2. d4 d5 3. Nd2 dxe4 4. Nxe4 Nd7 5. Ng5 Ngf6 6. Bd3 e6 7. N1f3 h6 8. Ne4 Be7 9. Nxf6+ Nxf6 10. O-O O-O 11. Ne5 c5 12. dxc5 Bxc5 13. Re1 Qd5 14. Ng4 Nxg4 15. Qxg4 Bd4

I am not sufficiently well acquainted with this line of the Caro-Kann to say exactly what mistake(s) black has made, but it is clear that something has gone badly wrong for black. Glaurung, in fact, has displayed a clear plus ever since it left book at move 9. Now, Glaurung finds a long, forced line to win the exchange:

16. Qg3 Rd8 17. Bxh6 Bxb2 18. Rad1 Qh5 19. Bh7+ Kxh7 20. Rxd8 Qxh6 21. Qd3+ Qg6 22. Qc4

The point of white's combination becomes clear: He wins back a bishop on c8, and the resulting position is a relatively simple technical win.

22... Qf6 23. Rxc8 Rxc8 24. Qxc8 Bd4 25. Rf1 b5 26. c4 bxc4 27. Qxc4 g6 28. g3 e5 29. Kg2 Qe7 30. Qd5 Kg7 31. f4 f6 32. Rb1 Bb6 33. fxe5 Qxe5 34. Qxe5 fxe5 35. Kf3 Kh6 36. Rxb6 axb6 37. Ke4 Kg7 38. Kxe5 1-0

Round 2

In round 2, Glaurung was paired against Matacz, who had finished off Macieja so prettily earlier the same morning. Maciej Pestka, the author of Matacz, is unusual among chess programmers in the sense that he has never played chess actively. Perhaps Maciej's lack of chess experience and book knowledge is the reason why his program has such a wild and unorthodox style of play. Its games are always fun to watch.

Matacz - Glaurung

1. d4 Nf6 2. Nf3 d5 3. g3 c6 4. Nc3 c5 5. Bg2 cxd4

Both programs were already out of book, as a consequence of white's unusual 4th move. The position is probably roughly equal.

6. Nxd4 e5 7. Nb3 Bb4 8. O-O Be6 9. Na4 Na6 10. a3 Be7 11. f4!

Characteristically, Matacz's opening play is unorthodox, but interesting and not at all bad. White now gets a nice square for his knight on d4.

11... e4 12. f5 Bd7 13. Nc3 Bc6 14. Bf4 O-O 15. e3 Nc5 16. Nd4 Bd6

17. Nxc6?

A serious mistake. White trades the strong knight on d4 for the passive bishop on c6, and simultaneously strengthens black's centre and gives black play on the half-open 'b' file. Glaurung's score quickly climbed to more than +1 after this move, and stayed there for the rest of the game.

bxc6 18. b3 Bxf4 19. Rxf4 Ncd7 20. Qd4 Qe7 21. a4 Ne5 22. b4

Another mistake, weakening the c4 square. Black's knights now become very strong. But despite black's obvious advantage, it turns out that Glaurung doesn't find an easy way to break through. It takes many moves before black finds something concrete.

22... Rfd8 23. Rb1 Rab8 24. Rb3 Rb7 25. a5 Rdb8 26. b5 c5 27. Qd1 Rd7 28. a6 Rd6 29. Qc1 Nfd7 30. Rb1 Nb6 31. Qe1 Qd8 32. g4 Nbc4 33. Ra1 Rbb6 34. Kh1 h6 35. Qg3 Qf6 36. Qe1 Rd8 37. Rd1 Rbd6 38. Na4

38... Na3!

Although it is not easy to see for a human player, this move wins material in all variations. White can't save all the weak pawns at b5, c2, e4 and g4. Matacz tries to resort to tactical complications to find a way out, but ends up with a trapped knight:

39. Nxc5 Rc8 40. Qb4 Nec4 41. Rc1 Rb6 42. Nd7 Qd6 43. Nxb6 Qxb4 44. Nxc8 Qxb5 45. Ne7+ Kf8

46. Nxd5

Without the knight, white is obviously lost, but the alternative 46. f6 also loses after 46... gxf6 47. Nf5 Nxc2 followed by 48... N2xe3.

46... Qxd5 47. Bxe4 Qd2 48. Rcf1 Nxe3 49. Rg1 Naxc2 50. h3 Ne1 51. Bb7 Nd3 52. Rf3 Nf2+ 53. Rxf2 Qxf2 54. Be4 Qh4 55. Bg2 Nxg4 56. Rb1 Nf2+ 57. Kh2 Qf4+ 58. Kg1 Qg3 59. h4 Ng4 60. f6 gxf6 61. h5 Qe3+ 62. Kh1 Qd3 63. Re1 Qg3 64. Re8+ Kxe8 65. Bc6+ Ke7 66. Bd5 Nf2# 0-1

Round 3

Glaurung's opponent in round 3 was the program Booot by the very sympathetic Ukrainian author Alex Morozov. Unlike most strong chess programs, Booot is not written in C or C++, but in Delphi. It is probably the second strongest non-C/C++ chess program in the world right now, second only to the Italian program Delfi (which is, as the name indicates, also written in Delphi).

Another unusual thing about Booot is that it does not think while it's the opponent's turn to move. This obvious handicap makes the strength of Booot even more impressive. If Alex could implement this feature, his program would be an even more dangerous opponent.

Glaurung - Booot

1. e4 c5 2. Nf3 Nc6 3. d4 cxd4 4. Nxd4 Qb6 5. Nb3 Nf6 6. Nc3 e6 7. a3 Be7 8. Bf4 e5 9. Be3?

Glaurung's first move after leaving the opening book, and not a good one. White voluntarily helps the black queen to move to a better square. Much better was 9. Bg5, planning to exchange on f6 and grab control of black's weak d5 square.

9... Qd8 10. Bc4 d6 11. O-O O-O 12. Qf3 Bg4 13. Qg3 Rc8 14. Bd3 Be6 15. h3

15... Bxb3?

Probably not good. Black surrenders the bishop pair and weakens the important square d5. Up to this point, the game was roughly equal, but now white gets the advantage.

16. cxb3 Nd4 17. b4 Nh5 18. Qg4 Nf6 19. Qd1 Qb6?!

Another dubious-looking move, self-pinning the knight on d4.

20. Re1 Rfd8 21. Bf1 a6 22. Qd2 Kf8 23. Qd3 Rc6 24. Red1

Glaurung's score has slowly climbed over the last few moves, and reached +1.27 in this position. Black can't prevent white from winning a pawn in the centre. The problem for white is that the opposite-colored bishops after the exchange of d4 give black good defensive chances.

24... Nd7 25. Qd2 Rcc8 26. Rab1?

This looks like a waste of time. What purpose is the rook serving on b1?

26... Nf6 27. Bxd4 Qxd4 28. Qxd4 exd4 29. Rxd4 Ne8

White has taken the pawn, and there is no doubt that he is clearly better. The position is difficult to win, however: There is no easy way for white to create a passed pawn, and the opposite-colored bishops facilitate black's defence.

30. Rd2 Bg5 31. Rd3 Bf6 32. Nd5 Rc2 33. Nxf6 Nxf6 34. e5 Ne8 35. g3 Ke7 36. Bg2 dxe5 37. Rxd8 Kxd8 38. Bxb7 Nc7 39. Be4 Rd2

By a strong sequence of moves, Glaurung has solved most of its problems, and seems to be on its way towards a comfortable win. The opposite-colored bishops are gone, white has a nice pawn majority on the queenside, and the bishop is clearly stronger than the knight in this position. Glaurung's score for the last few moves was around +1.9. Unfortunately, my program now destroys everything with a single, horrible move:

40. Bxh7?

Very strange. First of all, Glaurung knows about trapped bishops on a7/h7, and has a huge penalty for this pattern in its evaluation function. Second, in this particular position, Glaurung searched sufficiently deeply to see that the bishop was lost. The main line at depth 20 was 40. Bxh7 g6 41. Re1 Rd5 42. Rc1 Ne8 43. Rc6 Ke7 44. Rxa6 Nf6 45. Ra7+ Ke6 46. Bxg6 fxg6 47. Ra6+ Ke7 48. Ra7+ Ke6 49. Rg7 Kf5 50. Kg2 Rd2 51. b3, with a score of +1.88. I need to have a close look at my evaluation function to find out why Glaurung wants to sacrifice the bishop.

40... g6 41. Re1 Ke7 42. Rxe5+ Kf8 43. Kg2 Nd5 44. Kf3 Kg7 45. Bxg6 fxg6 46. Ke4

Glaurung's score has dropped a little, but is still a very optimistic +1.45. In reality, white doesn't have any good winning chances. Black's actively placed rook makes it easy to stop white's queenside pawns.

46... Nf6+ 47. Ke3 Rxb2 48. Ra5 Kf7 49. Rxa6 Nd5+ 50. Kd4 Ne7 51. f3 Nf5+ 52. Ke5 Nxg3 53. Ra7+ Ke8 54. Kf6 Nf5 55. f4 Nh4 56. Kg5 Ng2 57. h4 Rf2 58. Kxg6

Here, at last, Glaurung begins to realize that the position is probably a draw. The score is down at +0.68 here. We play on until both engines agree about a 0.00 score.

58... Nxf4+ 59. Kg5 Ne6+ 60. Kg4 Rf1 61. Rb7 Rg1+ 62. Kf5 Nd4+ 63. Ke5 Nf3+ 64. Ke4 Nxh4 65. a4 Rg4+ 66. Kd5 Rg5+ 67. Ke6 Rg6+ 68. Ke5 Nf3+ 69. Kd5 Rg5+ 70. Ke4 Nd2+ 71. Kf4 Rg6 72. a5 Nb3 73. Ke4 Rd6 74. Ke3 1/2-1/2

After the first three rounds, WildCat was the sole leader with 3/3, after having beaten Diep in the 3rd round. Booot and Glaurung were on shared second place with 2.5/3.

In the evening, most of the programmers went out to savor the nightlife of Lodz, which turned out to be surprisingly dull. It is strange to see the streets, pubs and restaurants almost empty on a Friday night in a town with almost 800,000 inhabitants. We enjoyed some beer and pizza at a place on the Piotrkowska street before going back to the hotel.

Day 2 (Saturday, June 30)

Round 4

In round 4, Glaurung had black against one of the favorites: Diep by Vincent Diepeveen. Because Diep is not (yet?) available to the general public, few people have a very precise idea of exactly how strong it is, but Vincent is a strong chess player and a very experienced chess programmer, and there is no doubt that Diep is a formidable opponent.

The hardware and time controls of this tournament were rather unadvantageous for Diep, however: Diep is a big and slow program with a lot of chess knowledge, and requires a very fast computer and/or slow time controls in order to play at its best. At one hour per game on a Core 2 Duo laptop, Diep wasn't always able to search deeply enough against the simpler and faster programs. Vincent talked about preparing a special blitz version of his program for next year's tournament; if he does this, I think he will be hard to beat.

The night before, I had received a new and "improved" opening book from Salvo Spitaleri. Salvo's work is usually of excellent quality, but like all of us, he occasionally makes mistakes. Unfortunately for me, one of his rare mistakes occured in this particular book, which turned out to be broken (although we only discovered it after the tournament): Some of the book lines ended far too early, for instance there was no book move after 1. e4 d5.

Glaurung, as usual, was lucky. The book did not cause any unnecessary losses or draws. It did cause some worries and frustrations during the games, however, not least in the game against Diep:

Diep - Glaurung

1. d4 Nf6 2. c4 e6 3. Nc3 d5 4. Bg5 Be7 5. e3 O-O 6. Nf3 Nbd7 7. Rc1 c6 8. Qc2 h6 9. Bh4

This position must have been played hundreds of times before in grandmaster games, but Glaurung, to my surprise, was already out of book, probably because of the previously mentioned mistake by Salvo. Being out of book at move 9 is not necessarily a big problem, but in this particular position, Glaurung does not understand what is going on, and makes a near-losing positional blunder as its first non-book move:

9... Nb6?

Horrible. If white now simply exchanges on d5, we have a fairly normal Queen's gambit exchange position, except that black's night on b6 is badly misplaced. The knight will probably have to return to d7 sooner or later, and black is simply two tempi down compared to the normal exchange variation.

Fortunately, Diep immediately pays back the favor, and plays a few weak move of its own:

10. c5? Nbd7 11. Bg3?

A mistake, at least according to Glaurung. Glaurung expected 11. Bd3 b6 12. b4 a5 13. b5, with a slight plus for white. After 11. Bg3, Glaurung thinks black has equal play.

11... b6 12. cxb6

12. b4 perhaps looks more natural, but 12... Nh5 seems to give black at least equal chances.

12... axb6 13. Bd3 c5 14. Bb5

For some reason, Glaurung doesn't like white's last move: It thought 14. O-O would be much better. After 14. Bb5, the score increased from 0.00 to a clear +0.54 in black's favor. For the next few moves, Glaurung stays happy, with scores between +0.5 and +0.7. To my eyes, however, the position looks equal.

Nh5 15. O-O Nxg3 16. hxg3 Nf6 17. Bc6 Ra5 18. a4 Ba6 19. Bb5 Bb7 20. Ne5 Bd6

21. Nc6??

This looks like a natural move, but is actually a losing tactical mistake. Glaurung's score instantly climbed to +2 after this move.

21... Bxc6 22. Bxc6 Ng4

There is no defence against the threats against white's king. Black threatens both Qd8-g5-h5 and Qc7 followed by Bxg3.

23. Rfd1 Qc7 24. b4

24... Bxg3!

Black has a decisive attack. The rest is easy.

25. fxg3 Qxg3 26. Qd2 cxb4 27. Ne2 Qf2+ 28. Kh1 Nxe3 29. Ng1 Nxd1 30. Rxd1 Qh4+ 31. Nh3 Rc8 32. Bb5 g5 33. Rb1 g4 34. Qf2 Qh5 35. Qe2 Ra7 36. Rf1 Rac7 37. Kg1 Rc1 38. Nf4 Qh4 39. Qe3 R8c3 40. Qxc1 g3 41. Nh3 Rxc1 42. Rxc1 Qxd4+ 43. Kh1 b3 44. Rf1 b2 45. Rb1 Qc3 46. Ng1 Qc1 47. Bd3 Kg7 0-1

The final position is amusing: White is in zugzwang, which is unusual with so many pieces left on the board.

The other top encounter in round 4 was the game Booot-WildCat, which was won by Booot. This put Booot and Glaurung on shared first place with 3.5/4, with WildCat and Matacz following closely behind with 3/4.

Round 5

In round 5, Glaurung faced another fearsome opponent: WildCat, written by the Belorussian programmer Igor Korshunov. In addition to his chess program, Igor is also the author of the strong Russian checkers program Kallisto , and has recently started working on a poker program.

WildCat is one of the strongest free chess programs, and was among the favorites to win the tournament.

Glaurung - WildCat

1. e4 c5 2. Nf3 Nc6 3. Bb5

Objectively a sound and strong move, but I remember being a bit worried about how well Glaurung would handle this variation. As it turns out, there was no reason to worry. Glaurung handles the Rossolimo Sicilian splendidly - good work by Salvo in preparing this line.

3... g6 4. Bxc6 bxc6 5. O-O Bg7 6. Re1 e5 7. Na3

This was Glaurung's first move after leaving book. The knight might look strange on a3, but it can look forward to a bright future on c2 or c4.

7... d6 8. c3 Ne7

9. d4!

During the game, I thought this move was premature: White helps to open the position for black's bishop pair, and allows black to get rid of his doubled c pawn. But as the next few moves demonstrate, Glaurung's decision to open the position was fully justified. White gets active play, and quickly develops a strong initiative.

9... cxd4 10. cxd4 exd4 11. Nxd4 O-O 12. Bg5 Bb7 13. Nc4 h6 14. Bh4 Qc7 15. Bg3

Glaurung, being optimistic as always, already had a score of +1.21 at this point of the game.

15... Rad8 16. Nf3 Nc8

White is very actively placed, and has some pressure against the d6 pawn. But how can he improve the position? Glaurung finds an elegant and (at least to me) surprising way to build up the pressure:

17. e5!

Temporarily sacrificing a pawn and allowing black to get rid of the weak d6 pawn, but the pin along the h2-b8 diagonal and black's weakness along the a2-g8 diagonal makes it impossible for black to keep the extra pawn. White is able to improve the activity of his heavy pieces, while also centralizing the f3 knight.

17... dxe5 18. Qb3 Rd5 19. Nfxe5 Rb5 20. Qa3 Qd8 21. Rad1

Notice the beautiful coordination of the white pieces. In the continuation, Glaurung manages to keep the pressure, and prevent black from activating the minor pieces on c8 and b7.

21... Rd5 22. Ne3 Rd2 23. N5c4 Rxd1 24. Rxd1 Qg5 25. Rd7 Qb5 26. Rc7 Rd8 27. h4 Ba6 28. b4 Nb6 29. Nd6

Because of the weaknesses on f7 and a7, black can no longer avoid losing material.

29... Qd3 30. Qa5 Rd7 31. Rxd7 Nxd7

32. a4!

Simple and strong. There is no defence against the threat of 33. b5.

32... Nb6 33. b5 Bf8 34. Nxf7 Kxf7 35. Qxa6 cxb5 36. Qxa7+ Nd7 37. Qa6

White wins a second pawn. The attempt to save a pawn by checking on b1 fails for tactical reasons: 37... Qb1+ 38. Kh2 bxa4 39. Qc4+ Ke7 (or 39... Kg7 40. Qd4+ Nf6 41. Be5 Be7 42. Nd5) 40. Nd5+ Kd8 (40... Ke6 or 40... Kf7 loses the queen after 41. Nc3+) 41. Qc7+ Kf7 42. Qxd7+, with mate in a few moves.

37... Nc5 38. Qxb5 Qxb5 39. axb5

With two extra pawns in the endgame, the rest is simple technique.

39... Ke6 40. Kf1 Be7 41. f3 Na4 42. Be1 Bf6 43. Ke2 Kd6 44. Bg3+ Kc5 45. Ng4 Be7 46. Nxh6 Nc3+ 47. Kd3 Nxb5 48. Nf7 Kd5 49. Nh8 g5 50. Ng6 Bf6 51. f4 gxh4 52. Bxh4 Ke6 53. g4 Kf7 54. Bxf6 Kxf6 55. Nf8 Nd6 56. Kd4 Nb5+ 57. Kc4 Nc7 58. Nh7+ Kg6 59. Ng5 Kg7 60. Kd4 Na6 61. f5 1-0

Resignation may look slightly premature to human observers, but both programs searched deeply enough to see that white would queen a pawn. This was probably Glaurung's best game in the tournament.

On board 2, Matacz won an exciting game against Booot, thus climbing to a shared second place. The top programs were now Glaurung with 4.5/5, Matacz with 4/5, and Boot and Butcher with 3.5/5.

Round 6

In round 6, Glaurung had black against Butcher by Marek Kolacz (also known by the Polish name Rzeznik), the reigning Polish champion. Butcher won the last time it played against Glaurung in a tournament (in CCT8), so I was prepared for a difficult fight.

Butcher-Glaurung

1. e4 c5 2. Nf3 Nc6 3. d4 cxd4

Around this point, I said to my opponent: "I really hope my program doesn't choose the Pelikan, because it always plays it extremely badly". Of course, a Pelikan is exactly what happens.

4. Nxd4 Nf6 5. Nc3 e5 6. Ndb5 d6 7. Bg5 a6 8. Na3 b5 9. Bxf6 gxf6 10. Nd5 f5 11. Bd3 Be6 12. O-O Bxd5 13. exd5 Ne7

Here, quite unexpectedly, Butcher was out of book. In most cases, one should be happy when the opponent is out of book early, but in this case I was worried: I was 99% sure that Butcher would play 14. Nxb5, which wins a pawn (because 14... axb5?? 15. Bxb5+ wins on the spot for white). Opening theory claims that black gets full compensation for the pawn (which is why 14. Nxb5 is hardly ever seen in games between strong human players), but I did not expect my program to understand how to play the resulting positions. The continuation of the game proved me right...

14. Nxb5 Bg7 15. Nc3 e4 16. Bc4 Ng6 17. Qh5 Bxc3 18. bxc3 Qf6 19. Qh6 Rg8 20. Rab1 Qxc3

This was Glaurung's first move out of book.

21. Bxa6 Qg7 22. Qxg7 Rxg7 23. Rb6

I am not sure whether Salvo's book or Glaurung's first few non-book moves are to blame, but this position looks hopeless for black. White has an extra pawn, and black has numerous weak pawns and an awkwardly placed rook on g7. Glaurung's evaluation was -0.64 for black, which (like always) seems rather too optimistic.

23... Nf4 24. g3 Nxd5 25. Rxd6 Nc3 26. Bc4 Rg6 27. Rd2 f4 28. Re1 Rc6 29. Bb3 f3 30. Kh1 Rc7 31. a4 f5 32. Rd3 Kf8

White has played too passively, and allowed black to get back in the game: White is still one pawn up, but the pawns on c2 and a4 are weak, and he has some difficulties activating the king and the rook on e1. The right plan for white would probably be to break up black's pawns by playing h3 and g4 at the right moment. Butcher does indeed try to do this, but chooses an unfortunate moment, and falls victim to a tactical trick:

33. Rd6 Kg7 34. Ra1 Ra5 35. h3

35... e3!

This unexpected move turns the tables. When white accepts the sacrifice, the knight fork on e4 combined with the passed f pawn gives black lots of dangerous tactical possibilities.

36. fxe3 Ne4 37. Rd8 Rc3 38. Rg8+ Kh6

For the first time in the game, Glaurung displays a small plus for black (+0.58). Optically it looks like white with his two extra pawns should win easily, but it seems that his poorly placed pieces are helpless against the knight on e4 and the passed pawn on f3.

39. Re1 Re5 40. g4 fxg4

41. Rxg4?

This move is clearly losing. Of course, 41. hxg4 is the correct move. After 41... Rg5 42. Rf8 f2 43. Rf1 Rxg4 black is clearly better, but white still has a chance to draw.

41... Nf2+ 42. Kh2 Nxg4+ 43. hxg4 f2 44. Rf1 Kg5 45. Rxf2 Kxg4

Materially, white is OK, but the more active black pieces quickly decide the game.

46. Rg2+ Kf3 47. Rg3+ Kf2 48. Rh3 Rc7 49. Kh1 Rd7 50. Rh2+ Kxe3 51. Rh3+ Kf2 52. c3 Re4 53. Rh5 Rd2 54. Rh3 Kf1 55. Rh2 Rf2 56. Bd1 Ke1 57. Bh5 Rxh2+ 0-1

A very lucky escape for Glaurung, who could easily have lost this game.

Glaurung increased its lead by half a point in this round, as Matacz only managed a draw against Diep. Booot won against Matant, while WildCat lost another half point against Tytan. At the end of day two, Glaurung was therefore leading by 5.5/6, with Matacz and Booot following on the next two places with 4.5/6.

I am not sure whether it was because everybody was tired, because people were less than excited with the nightlife of Lodz, or because most programmers were disappointed with their results, but on the second day only Maciej Pestka, Alex Morozov and myself (the three leaders of the tournament) went out in the evening. We spent a nice time in a pub (where we were almost the only customers, not unexpectedly), once again on the Piotrkowska street.

Day 3 (Sunday, July 1)

Round 7

Glaurung's opponent in round 7 was the Polish program Armageddon by my good friend Grzegorz Sidorowicz. Grzegorz and I have one unusual thing in common: We have written not only programs for normal chess, both of us have also written programs which play hexagonal chess, an interesting chess variant which was quite popular in some eastern European countries in the last half of the 20th century, but which sadly seems to be dead or dying today.

Glaurung - Armageddon

1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Bc5

An unusual move, which threw Glaurung out of book. Perhaps 5. Bc5 is not theoretically correct, but Glaurung's attempt to refute it is unconvincing.

6. Nxe5 Nxe5 7. d4 b5 8. Bb3 Bxd4 9. Qxd4 d6 10. f4 Nc6 11. Qc3 Bb7

Black can feel quite satisfied about the outcome of the opening: The position looks almost equal. White's only little advantage is the bishop pair, and if black tries to eliminate this advantage by Nc6-a5xb3, he risks falling behind in development.

Glaurung tries to open the position and obtain an attack against the black king:

12. e5 Ne4 13. Qe3 Na5 14. Nd2 Nxb3 15. axb3 Nxd2 16. Bxd2 O-O 17. Bc3 Qe7 18. b4

White's advantage is microscopic. If he can start a kingside attack, the opposite-colored bishops should secure an advantage, but for the moment black seems reasonably safe.

18... Rfd8?

A mistake: Black should have played 18... dxe5 at once. After 18... Rfd8, white gets the chance to activate his queenside rook with a win of tempo, which gives him the initiative:

19. Qg3 dxe5 20. Rae1 Rd5 21. fxe5 Bc8?

Probably the losing mistake: Black should have played Rad8, Re8 or Kh8. The plan behind Bc8 is clear and sound: Black wants to move his bishop to e6, after which his position is solid and a draw seems likely. The problem is that there is no time to play Be6...

22. e6!

Opening the a1-h8 for the bishop, and the e file for the rook. White's attack is devastating.

22. fxe6 23. Bf6 Qf7 24. Re4 g6 25. Be5 Qe7 26. Rg4 Qe8 27. Rf6 Rd1+ 28. Kf2 Rd2+ 29. Ke3

A colorful position. Of course, there is no defence against the threat of Rfxg6+.

29... Rd7 30. Rfxg6+ Qxg6 31. Rxg6+ 1-0

Boot and Matacz both lost their games in the 7th round, against Diep and WildCat respectively. This left Glaurung two points ahead of the closest competitors with only two rounds to go, thus securing at least a shared first place. The fight for second place was more exciting than ever: Booot, Butcher, Diep, Matacz and WildCat all had a shared second place with 4.5/7, with Gosu and Tytan following closely behind with 4/7.

Round 8

Gosu by Arkadiusz Paterek, Glaurung's opponent in the penultimate round, is commonly thought to be the strongest Polish chess program, but had bad luck throughout the tournament (beginning in the first round, where it lost on time against Armageddon, because Arkadiusz had made a mistake and set the program's clock to 40 moves/60 minutes instead of game/60 minutes).

An interesting thing about Gosu is that the evaluation weights are not hand-tuned, like in most other chess programs, but automatically tuned by the program itself. Arkadiusz is a PhD student with an interest in machine learning, and uses his chess program in his research.

Gosu - Glaurung

1. d4 Nf6 2. c4 e6 3. Nf3 b6 4. a3 Ba6 5. Qc2 Bb7 6. Nc3 c5 7. e4 cxd4 8. Nxd4 Nc6 9. Nxc6 Bxc6 10. Be2 Qc7 11. Nd5 Bxd5 12. exd5 exd5 13. Bg5 Be7 14. O-O O-O

14... O-O was Glaurung's first move out of book (Gosu left its book a few moves earlier, I don't remember exactly where). I don't know much about this variation of the Queen's Indian, but the position looks more or less equal. White's bishop pair and black's doubled isolated d pawns compensate for black's extra pawn.

15. Bf3

15... Qxc4!?

An interesting, but very risky and unexpected exchange sacrifice. Considering that Glaurung only needed half a point to secure a clear tournament victory with one round to go, a more solid move would have seemed more prudent.

Is the sacrifice sound? I really don't know. During the game I was skeptical, but Glaurung was always happy with its positions (+0.64 for black when playing 15... Qxc4), and managed to gradually improve its position, even though white makes no obvious mistakes (at least none which are obvious to me, but of course I am not a strong player).

16. Qxc4 dxc4 17. Bxa8 Rxa8 18. Rfe1 Kf8 19. Rad1 d5 20. Kf1 Rd8 21. Re5 h6 22. Be3 Bc5 23. Bd4 Bxd4 24. Rxd4

I (and my chess program) had seen this position coming several moves ago, and I was not happy about it. Black has a knight and two pawns for the rook, but his central pawns are blocked, and he seems to have problems activating his king. Nevertheless, Glaurung did not share my pessimism, and evaluated this position as +1.3 for black. As so often, it turned out that Glaurung was right and I was wrong.

24... Rd6 25. h4 Re6

This rook maneuvre is a nice (and in hindsight obvious) way to activate the black king. White's blockade of the d pawn suddenly seems less secure when the black king starts running towards c5 or e5.

26. Re3 Ke7 27. Rg3 g6 28. Re3 Kd6 29. Rf4 h5 30. b3 b5 31. a4 Rxe3 32. fxe3 Ne4

I don't know where white went wrong, but here it seems that black may already be winning. The black knight and king are very well placed, and it probably isn't possible for white to prevent black's queenside pawns from queening without losing some of his own weak pawns.

33. bxc4 bxc4 34. Ke1 f6 35. Rf1 Ke5 36. Kd1 Ng3 37. Rf3 Nf5 38. Rh3 Ke4 39. Kd2 a5 40. Rf3 g5 41. Rf1 g4

Glaurung has slowly and patiently improved the positions of its pieces, and black's win is now completely clear. White has the choice between giving away his e pawn, after which black's central pawns supported by the king and knight will quickly decide the game, or allowing the black knight to eat the g and h pawns, after which black's kingside passed pawn duo will start rolling.

42. g3 Nxg3 43. Rxf6 c3+ 44. Kxc3 Kxe3 45. Kb2 d4 46. Rf8 d3 47. Rd8 Ne4 48. Rd7 g3 0-1

A very interesting game, although I remain unconviced that black's early exchange sacrifice was correct.

The fight for second place remained exciting: Butcher lost its 8th round game against Diep, but Booot, Diep, Matacz and WildCat all won their games and shared the second place with 5.5/8 before the last round.

Round 9

In the 9th and last round, Glaurung had white against Tytan by Tomasz Michniewski. Tomasz, like Vincent Diepeveen (author of Diep) and Mateusz Luksik (Atak), is among the minority of chess programmers who are also very strong chess players. I learned a lot from his insightful comments during our game.

Glaurung - Tytan

1. d4

At this point of the tournament, I was beginning to get tired of seeing Glaurung opening with 1. e4 in all white games, and I was pleased to finally see a different opening choice.

1... d5 2. Nf3 Nf6 3. c4 c6 4. Nc3 dxc4 5. a4 Bf5 6. e3 e6 7. Bxc4 Bb4 8. O-O O-O 9. Qb3 Qe7 10. Nh4

This was Glaurung's first non-book move in the game. 10. Nh4 and the subsequent pushes of the f and g pawns look risky to me, but according to Tomasz it is a standard way to play in this variation of the Slav defence.

10... Bg4 11. f3 Bh5 12. g4 Bg6 13. Nxg6 hxg6 14. e4 a5 15. Bf4

15... Nbd7?

Now white gets a clear advantage. 15... Rd8, preventing 16. Na2, would have been preferable.

16. Na2 e5

Giving a pawn, but black's position was already very difficult.

17. Nxb4 axb4 18. dxe5 Nxe5 19. Bxe5 Qxe5 20. Qxb4

White has an extra pawn, but white's exposed king and weak dark squares give black some compensation.

20... Rad8 21. Rad1 c5 22. Qc3 Rd4 23. Rxd4 cxd4 24. Qb3

Evaluating passed pawns is difficult for chess programs. Is black's passed pawn on d4 an advantage or a weakness? Glaurung thought it was primarily a weakness, while Tytan thought it was more of an advantage. To a large extent, it depends on whether black is able to move his knight to c5 or e5.

24... Qc5 25. Rd1 b6 26. Qb5 Rd8 27. b4!

Securing the c5 square, and preparing to create a passed pawn with a later a5.

27... Qc7 28. Kg2 Kf8 29. Rd3 Ne8

Ugly, but probably necessary: Black's problem is that Nf6-d7-e5 is never possible because white can capture the d4 pawn.

30. Bb3 Nd6 31. Qg5 Ne8 32. h4

Attacking on both wings: Black's passive pieces can't defend both sides of the board.

32... Nf6 33. Qb5 Ne8 34. a5 bxa5 35. bxa5 Qe7 36. Qc4

White wins a second pawn: Black can't defend on d4 while preventing mate on f7. Attempting to protect the pawn by 36... Qa7 fails to 37. e5! followed by e6.

36... Nd6 37. Qxd4 Nb7 38. Bd5 Nc5

38... Nxa5 loses after 39. Qc3 Nb7 (39... Qa7 40. Qb4+ Ke8 41. Ra3) 40. Bxb7 Rxd3 41. Qxd3, and black cannot capture on b7 because of 42. Qxd8 mate.

39. Rc3 Ne6 40. Qe3 Qf6 41. Kg3 Qe7 42. Rc6 g5 43. hxg5 Nxg5 44. Qc3 Kg8 45. a6 Re8 46. Qc1 Kh7 47. Rc7 Qd6+ 48. Qf4 Qb6 49. Rc1

Black is now forced to give the knight to defend against white's kingside attack. The game is over.

49... Qxa6 50. Qxg5 Qd6+ 51. Kg2 Kg8 52. Qh5 Qf4 53. g5 Kf8 54. Ra1 Ke7 55. Ra7+ Kd8 56. Bxf7 Qb8 57. Ra2 Rf8 58. g6 Qd6 59. Ra8+ Ke7 60. Ra7+ Kd8 61. Qa5+ Kc8 62. Be6+ Kb8 63. Ra8+ Kb7 64. Bd5+ Qxd5 65. Ra7+ Kc6 66. Qxd5+ Kb6 67. Rb7+ Ka6 68. Qb5# 1-0

In the fight for second place, Booot, Diep, Matacz and WildCat all won in the last round, and finished at 6.5/9. After counting the tiebreak points, it turned out that WildCat got the second place, closely followed by Diep on the third place. Matacz won the title for the strongest Polish program.

After the prize ceremony, most of the Polish participants went home, while the foreign programmers (and ICGA president David Levy, who was invited as a special guest during the tournament) stayed until the next day. David Levy, Alex Morozov, Igor Korshunov, Vincent Diepeveen, Aleksandrs Saveljevs and I went out for a nice dinner.