Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Programmer challenge

Author: Reinhard Scharnagl

Date: 05:30:27 02/20/03

Go up one level in this thread


Instead of:

> The main loop:
>
>         value=1;                 // work variable
>         x=....                   // pointer to move list table
>         y=-1;                    // pointer to highest value
>
> loop:   x++; if (move_value[x] <= value) goto loop;
>         if (move_value[x] == 255) return y;
>         value=move_value[x];
>         y=x;
>         goto loop;

try the following (now in C code):

The main loop:

        value=1;                 // work variable
        x=....                   // pointer to move list table
        y=-1;                    // pointer to highest value
        goto loop;

        do {
          value=move_value[x];
          y=x;
loop:     do {
            x++;
          } while (move_value[x] <= value);
        } while (move_value[x] != 255);

        return y;

Regards, Reinhard.

P.S.: your assembler code does not increment correctly
      corresponding to your C Source. There is something
      wrong. May be following is better:

The main loop:

        value=1;                 // work variable
        x=....                   // pointer to move list table
        y=-1;                    // pointer to highest value
        goto loop;

        do {
          unsigned char cx;
          value = cx;
          y = x;
          do {
            ++x;
     loop:  cx = move_value[x]
          } while (cx <= value);
        } while (cx != 255);

        return y;





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.