[computer-go] Poetry in Motion

Jacques Basaldúa jacques at dybot.com
Sat Dec 2 05:05:06 PST 2006


My contribution to the Java question: I am working in go for
the pleasure and not as much as I would like to. Recently, I
was experimenting with the urgency of a shape as a sorting
method for ab-pruning. I needed to rotate 7x7 masks.

I wrote:

Procedure Rotate90cl (var jm    : jeitoMask);
{
            +---+---+---+                      +---+---+---+
            | 4 | 3 | 4 |                      | 23| 01| 01|
        +---+---+---+---+---+              +---+---+---+---+---+
        | 4 | 3 | 2 | 3 | 4 |              | 21| 23| 09| 03| 03|
    +---+---+---+---+---+---+---+      +---+---+---+---+---+---+---+
    | 4 | 3 | 2 | 1 | 2 | 3 | 4 |      | 19| 21| 23| 01| 11| 05| 05|
    +---+---+---+---+---+---+---+      +---+---+---+---+---+---+---+
    | 3 | 2 | 1 | · | 1 | 2 | 3 |      | 19| 21| 07| · | 03| 13| 07|
    +---+---+---+---+---+---+---+      +---+---+---+---+---+---+---+
    | 4 | 3 | 2 | 1 | 2 | 3 | 4 |      | 17| 17| 19| 05| 15| 09| 07|
    +---+---+---+---+---+---+---+      +---+---+---+---+---+---+---+
        | 4 | 3 | 2 | 3 | 4 |              | 15| 15| 17| 11| 09|
        +---+---+---+---+---+              +---+---+---+---+---+
            | 4 | 3 | 4 |                      | 13| 13| 11|
            +---+---+---+                      +---+---+---+
}
begin
    asm
        mov edx, eax        // @jm
        mov eax, [edx + 8]  // jm.mask4
        shl eax, 6
        mov ecx, eax
        and eax, 0ffFFFFh
        rol ecx, 8
        or  al, cl
        mov [edx + 8], eax  // jm.mask4

        mov eax, [edx + 4]  // jm.mask3
        shl eax, 6
        mov ecx, eax
        and eax, 0ffFFFFh
        rol ecx, 8
        or  al, cl
        mov [edx + 4], eax  // jm.mask3

        mov eax, [edx]      // jm.msk12
        mov ecx, eax
        shl eax, 4
        rol cl, 2
        mov al, cl
        mov ecx, eax
        shr ecx, 16
        and eax, 0ffF0FFh
        and ecx, 0000F00h
        or  eax, ecx
        mov [edx], eax      // jm.msk12
    end
end;

I don't even know if it will be part of a program, but it
is already as good as I can write it. If I need it someday,
I only have to cut and paste.

* Is that harder to write? No. At least for me.
* Is that version dependent? No. It didn't change since the
  386 was released (late 80s) and it won't change in 20 years.
* Do I have a nightmare of books/pdfs to find documentation?
  No. Just one paper "x86 Software Development.." @intel.com
* Is that harder to debug in a Borland environment? No.
* Will that code running on a 2007 machine be outperformed
  by the same function written in Java on a 2017 machine?
  (Assuming Java still exists in 2017) Probably not. As that
  code running on a 1997 machine is not outperformed today
  by Java on a 2007 machine.

I write efficient code, because inefficient code hurts my
eyes, and I can't figure out what advantages it may have.
Each time I have suffered it, it has made me loose much
more time than if I had controlled every detail from the
beginning. But returning to the go problem: It is unclear
if someone will write "the killer app" in the next ten
years, but if he/she writes it in Java he/she is giving
an additional "ten year handicap" to those who don't.

And I also try to improve my algorithms, of course. ;-)

Jacques.


More information about the computer-go mailing list