Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Algorithms for solving helpmates?

Author: Heiner Marxen

Date: 09:31:44 01/09/00

Go up one level in this thread


On January 07, 2000 at 21:22:36, Ian Osgood wrote:

>On January 07, 2000 at 15:39:02, Dann Corbit wrote:
>
>>On January 07, 2000 at 15:05:09, Ian Osgood wrote:
>>[snip]
>>>Thank you very much, for the link and for the Windows port!  This is an ideal
>>>starting point for me.
>>>
>>>Do you know much about the technology used in Chest?
>>
>>It's very portable ANSI C.  All the source is included.  Well written, too.
>>
>>> Which source would I
>>>modify to restrict a helpmate solution condition even further (NxR at move 5)?
>>
>>I suspect that Heiner Marxen would be the person to ask.  I have created module
>>diagrams and done a bit of study because I want to understand it, but I am not
>>the author and might lead you astray.
>
>Well, I did figure it out (I believe), but helpmates are not supported as nicely
>as other types of problems (no specialized pruning).  Putting in performance
>metrics, I found that it was searching 4x more slowly than the full-width
>version of TSCP I had cobbled together.

Yes, I would expect CHEST to be slower than a simple but fast searcher, here.
Help mates are currently included just for fun (and for completeness).
There are some vague ideas how to do helpmates really fast, but they
are far from ready.

For the NxR puzzle I have done a hack myself inside the formoves() loop
in do_help_rest(), before and after the recursive call.  The latter
is necessary to mask sub-solutions in zero moves.  Here is the relevant part:

#if WITH_XMAS_99
        if( plies <= 1 ) { /* Weihnachts-Raetsel: NxR# */
            if( (bp->b_f[mp->m_from].f_f != springer)
             || (bp->b_f[mp->m_to  ].f_f != turm)
             || (bp->b_f[mp->m_to  ].f_c == empty) ) {
                subres = ANARES(ANA_MANY&~1, FALSE);
                goto have_subres;
            }
        }
#endif
        move_execute(bp, mp); APC_CINC(); scinc(mvx_def((plies+1)/2));
        if( plies > 1 ) {
            subres = do_help_full(bp, plies-1, (AnaOut*)0);
        }else {                         /* plies==1: must be [stale]mate, now */
            if( (!!in_check(bp)) == mustmate ) {
                APC_CINC();
                subres = ANARES(0, !move_gen(bp, (Movelist*)0));
            }else {
                subres = ANARES(0, FALSE);
            }
        }
        move_undo(bp);                  /* move back */
#if WITH_XMAS_99
        if( (subres == ANARES(0,TRUE)) && (plies>1) ) {
            if( (bp->b_f[mp->m_from].f_f != springer)
             || (bp->b_f[mp->m_to  ].f_f != turm)
             || (bp->b_f[mp->m_to  ].f_c == empty) ) {
                subres = ANARES(ANA_MANY&~1, FALSE);
                goto have_subres;
            }
        }
#endif
have_subres:;

It was fast enough for me, to do the NxR puzzle completely on a fast machine,
(500 Mhz, 350MB TT), thus verifying that the intended solution is unique.

>(Oh, I found another bug reading FEN ('F') tags.  The inner while loop in
>grok_fen() should read  while (*ip && !IS_SPACE(*ip)) {... )

Rats!  You are right.  :-(

>I'm not sure I'd agree that it was well written (for maintainance, that is; it
>seems pretty heavily performance tuned).

Hmmmm, as author I disagree.  But I understand that you do not perceive
it as being maintainance friendly.  The sources are the result of many
years of experiments, some of them rather complex.  Also, performance
is THE issue for CHEST, so that part should not come as a surprise.

>I'm still looking for public source for other search techniques, such as
>proof-number search.
>
>IanO

Heiner



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.