Hola, Álvaro:

Álvaro Begué wrote:

> "Could not compile libego" is not a very helpful error message. What
> exactly did the compiler complain about? My guess is that you don't
> have the required boost libraries installed.

Yes. It must be that. I didn't know about boost libraries. Where can I find that?

> Actually, in order to get the content of a
> particular point, we ask its neighbor on the right :) .

My biggest patterns are up to 40 neighbors (Manhattan distance <= 4) because
that includes all nobi, iken tobi, niken tobi, keima and ogeima relations (+ more)
and because it makes a difference between the third and the fourth line and
between the fourth line and above. But, as you do, I use the nearest neighbors in the lower bits as indices of many LUTs that give immediate answers to lots
of questions.

> Oh, I would be curious to see how you remove a captured string with
> no loops.

So would I. I did not say that the whole program is in assembly language.
The assembly language parts are rather short and straightforward. I change
conditional jumps by table xlat or by conditional moves. For instance, a
function that computes a Zobrist hash of a mask, cmoves a zero and xors
zero rather than jumping around the xor instruction if there is no stone.

And of course, rather than writing something ridiculously academic, like:

Function DoWhateverWith40neighbors(x, y : integer)
for dx := -4 to 4 do begin
  for dy := -4 to 4 do begin
    if     (x + dx >= 0)
    and (x + dx < 19)
    and (y + dy >= 0)
    and (y + dy < 19)
    and (ABS(dx - dy) <= 4) do whatever
end everything

I keep 81 different asm functions for each possible mapping of the borders

Instead of calling a function:

  MyFun(x, y, a, b, c)

I call

  MyFun[wMv9x9](a, b, c)

where MyFun[wMv9x9] is a array of pointers to functions and x, y are
implicit in the function called.

Example:

UpNeib_NI[wMv9x9](byte(bijNP), longint(pS), CardinalsBPR);

is compiled to:

mov  esi,[esi*4+UpNeib_NI]
xor  eax, eax
mov  al, bl
mov  ecx, [CardinalsBPR}
mov  edx, [ebp-$30]
call esi

(It wouldn't be better with a call to a fixed address.)

And the function, instead of the ridiculous loops and conditions is,
(say 150 lines) of:

          or      [edi + 2], al
          shl     al, 4
          or      [edi + 1 + 12], al
          mov     al, [edx + ecx*2 - SizeOf_bccCell + 3]
          xlat
          shl     al, 2
          or      [edi + 1 + 12], al
          shl     al, 4
          or      [edi + 2], al
          mov     al, [edx + ecx*4 + 3]
          xlat
          or      [edi + 4], al
          or      [edi + 4 + 12], al
          add     edx, ecx
          mov     al, [edx + ecx*2 + SizeOf_bccCell + 3]
          xlat
          shl     al, 2
          or      [edi + 4], al
          shl     al, 4
          or      [edi + 6 + 12], al
          mov     al, [edx + ecx + 2*SizeOf_bccCell + 3]
          xlat
          shl     al, 4

Now you understand why the board has over 80 000 lines of
asm source. Typical 40 neighbor functions have 81 clones and
150 lines.

It is only in these functions where there are no conditional jumps
or loops, not in the program. But I keep trying ;-)


Jacques.
_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

Reply via email to