Sunday, December 24, 2023

The Main Line of Chess

A "main line" in chess is a sequence of moves where each side plays the "best" move (for themselves) at each position. It's most often used in the context of an opening, as in "the main line of the queen's gambit", where the queen's gambit is defined as 1. d4 d5 2. c4. Of course it is debatable what the "best" move for Black now is -- accepted 2...dxc4 or declined 2...e6 -- which is why "best" above is in quotes. It's largely a matter of opinion in many or most positions as to which is the best move.

However, we have strong chess engines now, even in the opening, which can narrow the definition of "best" down considerably, often to a single move. Caveat: chess engines can only look ahead a finite "depth" and are also fickle as their depth of search increases as they "think"; and engines can disagree with one another.

But it should be possible to create better main lines using engines, and even a single candidate main line for chess itself if we start from the starting position. (I'm surprised no one has done this explicitly as a theoretical start to "solving" chess.) When I do this with Stockfish 13, I get the Berlin Defense of the Ruy Lopez:
1. e4 e5 2. Nf3 Nc6 3. Bb5 Nf6 4. O-O Nxe4 5. Re1 Nd6 6. Nxe5 Be7 7. Bf1 Nxe5
8. Rxe5 O-O 9. Nc3 Bf6 10. Re1 Re8 11. Nd5 Rxe1 12. Nxf6+ Qxf6 13. Qxe1 b6 14.
d3 Bb7

With a consistent engine evaluation throughout of about +0.20, which is another definition of an engine "main line" with a stable engine -- the evaluation stays the same throughout the line.

"What about theory?!" I hear you say. Well, from older/cruder to newer/more-refined, I have three main sources of "theory", so let's look.

1) Nunn's Chess Openings (1999). This source gets "alternate lines" out of the way at the top and so puts what would be its "main lines" at the bottom. For an idea of how it categorizes openings overall then, a look at the index on p. 541 shows that it considers the Sicilian (+0.30) the main line, but Ruy Lopez looks to be a close second. But not the Berlin; it likes 3...a6 (+0.40) as the main line. It covers Berlin on p. 326 but likes 5. d4 Nd6 (+0.14) as Berlin's main line. It does cover 5. Re1 Nd6 as the only alternate on the main page, but considers 7. Bd3 (-0.14) the main line after that. It covers the line above in note 20 but then only gives 9. d4 (+0.13).

2) Fritz 10 (2009) opening book. This source and the next seem to rely heavily on the popularity of moves in a curated high-rating database. Fritz also likes Sicilian, and 3...a6, and 5. d4, and 7. Bd3, and 9. d4, but it does have 9. Nc3 Bf6 10. Re1 as well, but then has an inferior line 10...Bd4 (+0.80) that a 2500 supposedly played against a 2250?

3) 365chess.com opening explorer (continuously updated, 2023). It does have 1...c5 (760586 games) over 1...e5 (442811 games), 3...a6 (117085 games) over 3..Nf6 (23854 games), 5. d4 (7034 games) over 5. Re1 (2950 games), 9. d4 (1139 games) over 9. Nc3 (397 games), 9...Ne8 (280 games) over 9...Bf6 (111 games). Other than that, it is in agreement. And apparently there are 25 games that reached the end position of the line above. Good!

Wednesday, July 12, 2023

e4, back to chess fundamentals

Chess is a bit of a philosophical paradox, simple in the basics (piece movements, rules) but intractably complex in gameplay. Every game, whether by rank amateur or grandmaster, is as unique as a snowflake (unless both players intentionally follow a previous published game or theory line all the way to the end). And yet at any given point during any game, the allowed moves are quite definite, of finite number (averaging something like 20 or 25 per move over the course of a game), and known to both players at all times.

The basic reason for the complexity is of course "combinatorial explosion", the exponential increase in the number of prospective positions as more than one move into the future is considered. For example, assuming for simplicity 20 choices at each move, while the player "on move" has to decide between only 20, the player waiting has 400 different decisions to consider (until the first player moves), and the first player wishing to consider a mere two-move combination has to consider 8000 different move sequences. Of course "shortcuts" like rules of thumb and preemptive elimination of "obviously bad" moves are absolutely necessary for practical play, but shortcuts are just as obviously suscepible to error (exceptions). Even computers cannot deal completely effectively with the complexities.

Star Trek TOS Goodness, 23 A Taste of Armageddon

Eminiar VII, principal planet of star cluster NGC-321, is the destination. Immediately the conflict is set up: The Enterprise has been ordered to establish diplomatic relations, but Eminiar VII is sending Code 710, meaning under no circumstances should they approach the planet. Of course, we have a diplomatic ambassador on board, Fox, who orders Kirk to proceed anyway, risking interplanetary war. Oh well.
We get an exposition dump from Spock, learning that the last ship to visit this system, the U.S.S. Valiant, never returned and was considered lost in space. Leaving Scotty in command, Kirk beams down with Spock and a security team.
Escorted by Mea-3, they are led to the planetary council headed by Anon-7. Much exposition necessarily follows. They were warned away because of "the war" which has been going on "for five hundred years!". But ship's scanners show no evidence of any war. Long story short, they "fight" the war with neighboring planet Vendakar with computers only, without physical damage. But one to three million inhabitants per year voluntarily enter disintegration (death) machines if they are registered as casualties.

And now the Enterprise, being in orbit, is also a "legitimate" war target, and wouldn't you know, just at this moment there happens to be an attack from Vendakar hitting both the city and the Enterprise. Oops. Everyone still aboard the Enterprise is registered as dead, and the landing party is taken hostage to ensure their cooperation in voluntary immolation of all other Enterprise personnel. Good luck with that!

Thus endeth the exposition.

The transition from exposition to development (complications) usually involves a scene of normalcy / pause / stasis / domesticity. This episode actually has two: 1) Kirk et al being confined as hostages, with some development as Mea-3 reveals that she has been declared a casualty, and 2) Scotty on the bridge, with some development as Anon-7 tries to fool him with a ventriloquism of Kirk's voice.





Chess Engine Paradox

There seems to be a paradox with regard to chess engine evaluations. Basically, 1) the deeper the depth of search, the better (more accurate) the engine evaluation, and 2) engine evaluations do not converge with depth -- going one ply deeper in search can completely overturn the previous evaluation. What does this mean?! Are evaluations completely meaningless ultimately, are evaluation only to be considered relative and not absolute at any fixed position, or are evaluations always a function of both depth and position? I suspect the latter, and thus that both of the others are also essentially true. Of what use are relative-only evaluations in comparing positions whose only common ancestor is horizon-effect distant?