by H.G.Muller » 24 Jan 2006, 10:36
Well, I am working on building a generator that works exactly along the lines described above. The description is the design that came out after some trials with earlier versions. My PC has only 0.5GB of memory, though, so I still could not do KqpKrb even if my code could in principle do it. My interest goes out to end-games like KrpKrp, KbpKnp, or even KrppKrp and KbpppKr. Ignoring the pawns there remain only 4 pieces, resulting in 16M positions for each pawn formation. This is just as well, because - unlike the example above with a single pawn - from every position you can go to (or come from) several positions with another pawn formation, by advancing each of the pawns. So in KbpppKr to make the fragment of the TB with pawns on e3,d4 and g4 you would have to consult the (e4,d4,g4), (e3,d5,g4) and (e3,d4,g5) fragment of that same TB, and to do that efficiently all three have to be kept in memory. And you don't want to discard them immediately after you're done, because sometimes they are needed again later. So with multiple pawns you need to hold many fragments in memory simultaneously, but if the fragments are only 16MB that is no problem even if your DRAM totals only 512M.
Although TBs like KbppKnp are of course huge, in a specific match you would need only a very small part of it, because you know where your pawns are in the current position (e.g. that they are e,d and g pawns, so that only 1/8x8x8 = 1/512 of the TB can be of relevance, even much less if the pawns are already advanced. So I hope it will be able to build the part of the TB that it needs during the match (e.g. while pondering). This seems a more realistic approach than having to pre-compute and store all complete 7-men TBs. From my previous experiments I know that a 16MB fragment with KbKn can be built in ~10 sec.
Main obstacle at the moment is that to build a TB with pawns (let's stick to the KqpKrb example), you need to know which queening positions are won, e,g, you need KqqKrb. This is a much harder nut to crack (despite the fact that you can make use of 8-fold symmetry then). I still don't feel like maintaining a library of all such TBs, even if you would need to store only the fragments that can result from queening, i.e. with one of the Queens on the 8th rank.
So my research at this time focuses on how I can efficiently obtain the won queening positions that I need as a starting point for building the TB with pawns (KqqKrb with one Queen on e8 in the example). I want to solve that before I actually implement the described algorithm, because for my intended application of the TB generator this is a real obstacle. That would not have to stop people that want to build TBs for storage on disk, though.
Fortunately the situation seems far from hopeless. This is mainly because in an end-game that is interesting before queening, you have an overwhelming advantage after queening. (Unless both sides promote a Pawn at the same time, in which case it is almost always a draw.) This means that any position that is won, usually remains won if you change the rules a little bit to give the winning side a handicap. With KqqKrb the handicap could be that the side with the Queens has to keep one of the Queens on the promotion square as long as you stay in KqqKrb. This handicap means that you confine the game to a fragment of KqqKrb that is only as large as KqKrb: one of the Queens does not participate other than by capturing enemy pieces (which would leave KqqKrb by conversion to KqqKx, also small). At the moment I cannot imagine positions that stay in KqqKrb for several moves (i.e. no immediate conversion to KqKrb because one of the Queens was hanging) and that cannot be won even with the handicap of only using one Queen and keeping the other as a 'spare' that becomes fully active after you sacrifice the moving one. The very small fraction of promotion positions that does not get labelled as 'won', you can probably analyze by more expensive means without much impact on performance.