Opening / Middle game

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

grant
Posts: 67
Joined: Mon Aug 06, 2007 4:42 pm
Location: London, England

Opening / Middle game

Post by grant »

Hi all

I'm trying to think of a way to determine when the opening finishes and the middle game begins.
In the past I've merely set the middle game to start after a certain number of half moves have been played (e.g. 16), but this is too rigid and not satisfactory. In some games the king(s) never castle so to say the middle game starts after the kings have castled is not good either.

The opening is all about development. If I set up a counter for moves that develop the pieces including castling, when the counter reaches a certain figure I could justifyably say that my development is just about done and I can start using the middle game values in my evaluation.

If a knight moves from B1 or G1, counter += 2;
If a bishop moves from C1 or F1, counter += 3;
If the king castles, counter += 2;

Then, if counter >= 10 start the middle game. This ensures that the opening must include castling plus 3 minor piece moves, or if the king does not castle, all minor pieces must move.

I've not implemented this into my program yet, nor do I know if anyone else uses something similar but I would be interested in your thoughts on this idea.

Thanks
Grant
User avatar
Bill Rogers
Posts: 3562
Joined: Thu Mar 09, 2006 3:54 am
Location: San Jose, California

Re: Opening / Middle game

Post by Bill Rogers »

This has been my bitch with opening books for a long time. A few years ago during a nation wide tournement one program mated another without ever leaving its 'opening books'. I'm not talking about 10 or 15 moves this game went over 40 moves, from the opening to the middle game to the end game.
I think it would make sense for some world wide chess federation to come up with some rules about how deep opening moves can be made, after all we are interested in how strong a program can play not how many millions of predetermined moves it has stored.
Bill
brianr
Posts: 536
Joined: Thu Mar 09, 2006 3:01 pm

Re: Opening / Middle game

Post by brianr »

Please keep in mind that book development is done both with and without "engine" integration. Either way, there is a lot of art and science in developing good books. Morevoer, it might be non-trival to even define an "opening move" (GUI only, GUI/Engine integration with "limited" searching, engine book only without any GUI book?).

In addition, there have been similar comments regarding endgame tablebases. Incidentally, Tinker's book has been terrible from day one, IMO.
Dirt
Posts: 2851
Joined: Wed Mar 08, 2006 10:01 pm
Location: Irvine, CA, USA

Re: Opening / Middle game

Post by Dirt »

grant wrote:If a knight moves from B1 or G1, counter += 2;
If a bishop moves from C1 or F1, counter += 3;
If the king castles, counter += 2;

Then, if counter >= 10 start the middle game. This ensures that the opening must include castling plus 3 minor piece moves, or if the king does not castle, all minor pieces must move.
That seems early to be the end of the opening to me, but if that's the point where different logic starts to work better in your program then it's right. Are you sure pawn moves, especially captures, should be ignored? What about basing the change from opening to middle game at least partially on total mobility?

Two knights moving, one bishop moving, and castling only counts for nine, so it's not just any three minor piece moves plus castling. But I'm sure that's by design.