Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Questions to Paul Hunter about the assembly

Author: Lance Perkins

Date: 11:00:44 08/23/04

Go up one level in this thread


Hi Gerd,

Can't you see. The NextMove is "identical"? That's the entire move ordering code
of Crafty.

But that's not the smoking gun. Its EvaluateMate and how it is used. This
function is identical to that of Crafty. Plus, its use has a bug. In Evaluate,
it calls EvaluateMate and checks for the return value 99999. The funny thing is,
EvaluateMate will never return 99999. Why would you copy a bug?

I have posted how you can disassemble it yourself. Why not try it and see and
Bob and Paul are correct.
http://www.talkchess.com/forums/1/message.html?383731

Cheers...

On August 23, 2004 at 13:47:53, Gerd Isenberg wrote:

>Dear Mr. Hunter,
>
>some questions about the // comments in the El Chinito assembly.
>Are these symbols from the executable, mapping those ip-addresses?
>Or did you insert them manually with crafty source in mind?.
>
>Using constants like 999999 is quite common, doing some switch case too.
>A return of 1 may be return TRUE for instance.
>
>GetMove data structures and pattern may also likely the same.
>Puplishing open source code implies sharing of data structures, like arrays of
>moves and how to do some bookholding.
>
>The source code might be quiet different and independently developed with
>similar data structures, solving a _standard_ pattern, getting a move out of an
>array of moves with different states, _and_ compiler may produce similar
>assembly for that.
>
>Such "standard" code like NextMove is IMHO not sufficent to proof El Chinito as
>Crafty clone. Did i missed something?
>
>BTW. Is it legal to disassembly others executables?
>
>Gerd
>
>
>
>// NextMove() from ElChinito 3.25
>// -------------------------------
>
>Fun42f9a0 :: ; proc near // NextMove()
>sub esp , 0Ch
>push ebx
>push ebp
>mov ebp , dword ptr [ esp + 24 ]
>push esi
>push edi
>lea edi , dword ptr [ ebp + 2 * ebp ]
>shl edi , 02h
>mov eax , dword ptr [ edi + 04B35C8h ]
>dec eax
>cmp eax , 09h
>mov dword ptr [ esp + 20 ] , edi
>ja Label43009e
>jmp dword ptr [ 4 * eax + 04300D8h ]
>
>// case HASH_MOVE:
>mov dword ptr [ edi + 04B35C8h ] , 02h
>mov eax , dword ptr [ 4 * ebp + 04B47A8h ]
>test eax , eax
>je Label42fa1c
>push eax
>mov dword ptr [ 4 * ebp + 04B46A4h ] , eax
>mov eax , dword ptr [ esp + 40 ]
>push eax
>push ebp
>call Fun4308d0 // call ValidMove()
>add esp , 0Ch
>test eax , eax
>je Label42fa09
>pop edi
>pop esi
>pop ebp
>mov eax , 01h // return (HASH_MOVE);
>pop ebx
>add esp , 0Ch
>ret
>
>Label42fa09 ::
>push ebp
>pushd 0440558h
>pushd 080h
>call Fun405030
>add esp , 0Ch
>
>// case GENERATE_CAPTURE_MOVES:
>Label42fa1c ::
>mov edx , dword ptr [ esp + 36 ]
>mov dword ptr [ edi + 04B35C8h ] , 03h
>mov ecx , dword ptr [ 4 * ebp + 04B48A8h ]
>push ecx
>push edx
>push ebp
>call Fun4144a0
>mov dword ptr [ 4 * ebp + 04B48ACh ] , eax
>mov dword ptr [ edi + 04B35CCh ] , 00h
>mov eax , dword ptr [ 4 * ebp + 04B47A8h ]
>add esp , 0Ch
>test eax , eax
>je Label42fc0d
>mov ecx , dword ptr [ 4 * ebp + 04B48A8h ]
>cmp ecx , dword ptr [ 4 * ebp + 04B48ACh ]
>mov dword ptr [ esp + 16 ] , ecx
>mov esi , 04BDEFCh
>jnb Label42fd3c
>
>Label42fa79 ::
>mov eax , dword ptr [ecx]
>cmp eax , dword ptr [ 4 * ebp + 04B47A8h ]
>jne Label42faa0
>mov dword ptr [esi] , 0FFF0BDC1h // *sortv = -999999;
>mov dword ptr [ecx] , 00h // *movep = 0;
>mov dword ptr [ 4 * ebp + 04B47A8h ] , 00h // tree->hash_move[ply] = 0;
>jmp Label42fb50
>
>Label42faa0 ::
>mov edx , dword ptr [ esp + 36 ]
>mov ecx , eax
>sar ecx , 06h
>and ecx , 03Fh
>test edx , edx
>je Label42fb72
>and ecx , 0FFFFh
>mov dl , byte ptr [ ecx + 04BF860h ]
>test dl , dl
>mov dword ptr [ esp + 24 ] , ecx
>mov ecx , eax
>je Label42fbe5
>mov ebp , dword ptr [ esp + 24 ]
>xor ebx , ebx
>mov bl , byte ptr [ ebp + 04BFD00h ]
>sar ecx , 0Ch
>and ecx , 07h
>movsx edi ,word ptr [ 2 * ecx + 043EA70h ]
>and edx , 0FFh
>sub ebx , edi
>mov edi , dword ptr [ 4 * ecx + 043C7D4h ]
>shl edx , 08h
>add ebx , edx
>mov edx , dword ptr [ 4 * ebx + 06741C0h ]
>sub edx , edi
>jns Label42fb24
>movsx ecx ,word ptr [ 2 * ecx + 043EA80h ]
>sar eax , 0Fh
>and eax , 07h
>mov eax , dword ptr [ 4 * eax + 043C7D4h ]
>add eax , ecx
>add eax , edx
>mov dword ptr [esi] , eax
>jmp Label42fb3d
>
>Label42fb24 ::
>movsx ecx ,word ptr [ 2 * ecx + 043EA80h ]
>sar eax , 0Fh
>and eax , 07h
>mov edx , dword ptr [ 4 * eax + 043C7D4h ]
>add edx , ecx
>mov dword ptr [esi] , edx
>
>Label42fb3d ::
>cmp dword ptr [esi] , 00h
>mov edi , dword ptr [ esp + 20 ]
>jl Label42fb4c
>inc dword ptr [ edi + 04B35CCh ]
>
>Label42fb4c ::
>mov ebp , dword ptr [ esp + 32 ]
>
>Label42fb50 ::
>mov ecx , dword ptr [ esp + 16 ]
>mov eax , dword ptr [ 4 * ebp + 04B48ACh ]
>add ecx , 04h
>add esi , 04h
>cmp ecx , eax
>mov dword ptr [ esp + 16 ] , ecx
>jb Label42fa79
>jmp Label42fd3c
>
>Label42fb72 ::
>and ecx , 0FFFFh
>mov dl , byte ptr [ ecx + 04BFD00h ]
>test dl , dl
>mov dword ptr [ esp + 24 ] , ecx
>mov ecx , eax
>je Label42fbe5
>mov ebp , dword ptr [ esp + 24 ]
>xor ebx , ebx
>mov bl , byte ptr [ ebp + 04BF860h ]
>sar ecx , 0Ch
>and ecx , 07h
>movsx edi ,word ptr [ 2 * ecx + 043EA70h ]
>and edx , 0FFh
>sub ebx , edi
>mov edi , dword ptr [ 4 * ecx + 043C7D4h ]
>shl edx , 08h
>add ebx , edx
>mov edx , dword ptr [ 4 * ebx + 06741C0h ]
>sub edx , edi
>jns Label42fb24
>movsx ecx ,word ptr [ 2 * ecx + 043EA80h ]
>sar eax , 0Fh
>and eax , 07h
>mov eax , dword ptr [ 4 * eax + 043C7D4h ]
>add eax , ecx
>add eax , edx
>mov dword ptr [esi] , eax
>jmp Label42fb3d
>
>Label42fbe5 ::
>sar ecx , 0Ch
>and ecx , 07h
>movsx edx ,word ptr [ 2 * ecx + 043EA80h ]
>sar eax , 0Fh
>and eax , 07h
>add edx , dword ptr [ 4 * eax + 043C7D4h ]
>mov dword ptr [esi] , edx
>inc dword ptr [ edi + 04B35CCh ]
>jmp Label42fb50
>
>Label42fc0d ::
>mov eax , dword ptr [ 4 * ebp + 04B48A8h ]
>cmp eax , dword ptr [ 4 * ebp + 04B48ACh ]
>mov ebx , 04BDEFCh
>mov dword ptr [ esp + 16 ] , eax
>mov dword ptr [ esp + 32 ] , ebx
>jnb Label42fd3c
>
>Label42fc2e ::
>mov eax , dword ptr [ esp + 16 ]
>mov eax , dword ptr [eax]
>mov edx , dword ptr [ esp + 36 ]
>mov ecx , eax
>sar ecx , 06h
>and ecx , 03Fh
>test edx , edx
>mov esi , ecx
>je Label42fc6c
>and esi , 0FFFFh
>mov dl , byte ptr [ esi + 04BF860h ]
>test dl , dl
>mov ecx , eax
>je Label42fcf8
>sar ecx , 0Ch
>and ecx , 07h
>xor ebx , ebx
>mov bl , byte ptr [ esi + 04BFD00h ]
>jmp Label42fc8c
>
>Label42fc6c ::
>and esi , 0FFFFh
>mov dl , byte ptr [ esi + 04BFD00h ]
>test dl , dl
>mov ecx , eax
>je Label42fcf8
>sar ecx , 0Ch
>and ecx , 07h
>xor ebx , ebx
>mov bl , byte ptr [ esi + 04BF860h ]
>
>Label42fc8c ::
>movsx esi ,word ptr [ 2 * ecx + 043EA70h ]
>and edx , 0FFh
>sub ebx , esi
>mov esi , dword ptr [ 4 * ecx + 043C7D4h ]
>shl edx , 08h
>add ebx , edx
>mov edx , dword ptr [ 4 * ebx + 06741C0h ]
>sub edx , esi
>jns Label42fcd4
>movsx ecx ,word ptr [ 2 * ecx + 043EA80h ]
>mov ebx , dword ptr [ esp + 32 ]
>sar eax , 0Fh
>and eax , 07h
>mov eax , dword ptr [ 4 * eax + 043C7D4h ]
>add eax , ecx
>add eax , edx
>mov dword ptr [ebx] , eax
>jmp Label42fcf1
>
>Label42fcd4 ::
>movsx ecx ,word ptr [ 2 * ecx + 043EA80h ]
>mov ebx , dword ptr [ esp + 32 ]
>sar eax , 0Fh
>and eax , 07h
>mov edx , dword ptr [ 4 * eax + 043C7D4h ]
>add edx , ecx
>mov dword ptr [ebx] , edx
>
>Label42fcf1 ::
>cmp dword ptr [ebx] , 00h
>jl Label42fd1b
>jmp Label42fd15
>
>Label42fcf8 ::
>sar ecx , 0Ch
>and ecx , 07h
>movsx edx ,word ptr [ 2 * ecx + 043EA80h ]
>sar eax , 0Fh
>and eax , 07h
>add edx , dword ptr [ 4 * eax + 043C7D4h ]
>mov dword ptr [ebx] , edx
>
>Label42fd15 ::
>inc dword ptr [ edi + 04B35CCh ]
>
>Label42fd1b ::
>mov eax , dword ptr [ esp + 16 ]
>mov ecx , dword ptr [ 4 * ebp + 04B48ACh ]
>add eax , 04h
>add ebx , 04h
>cmp eax , ecx
>mov dword ptr [ esp + 16 ] , eax
>mov dword ptr [ esp + 32 ] , ebx
>jb Label42fc2e
>
>Label42fd3c ::
>mov eax , dword ptr [ 4 * ebp + 04B48A8h ]
>lea edx , dword ptr [ eax + 4 ]
>mov eax , dword ptr [ 4 * ebp + 04B48ACh ]
>cmp edx , eax
>mov dword ptr [ esp + 16 ] , eax
>jnb Label42fdc3
>lea eax , dword ptr [ edx - 4 ]
>mov esi , 04BDF00h
>mov dword ptr [ esp + 24 ] , eax
>
>Label42fd61 ::
>mov ecx , dword ptr [edx]
>cmp eax , dword ptr [ 4 * ebp + 04B48A8h ]
>mov dword ptr [ esp + 20 ] , ecx
>mov ecx , dword ptr [esi]
>mov dword ptr [ esp + 32 ] , ecx
>lea ecx , dword ptr [ esi - 4 ]
>jb Label42fd9c
>
>Label42fd79 ::
>mov ebx , dword ptr [ esp + 32 ]
>cmp dword ptr [ecx] , ebx
>jnl Label42fd9c
>mov ebx , dword ptr [ecx]
>mov dword ptr [ ecx + 4 ] , ebx
>mov ebx , dword ptr [eax]
>mov dword ptr [ eax + 4 ] , ebx
>mov ebx , dword ptr [ 4 * ebp + 04B48A8h ]
>sub eax , 04h
>sub ecx , 04h
>cmp eax , ebx
>jnb Label42fd79
>
>Label42fd9c ::
>mov ebx , dword ptr [ esp + 20 ]
>mov dword ptr [ eax + 4 ] , ebx
>mov eax , dword ptr [ esp + 32 ]
>mov dword ptr [ ecx + 4 ] , eax
>mov eax , dword ptr [ esp + 24 ]
>mov ecx , dword ptr [ esp + 16 ]
>add edx , 04h
>add eax , 04h
>add esi , 04h
>cmp edx , ecx
>mov dword ptr [ esp + 24 ] , eax
>jb Label42fd61
>
>Label42fdc3 ::
>mov ecx , dword ptr [ 4 * ebp + 04B48A8h ]
>mov dword ptr [ edi + 04B35D0h ] , ecx
>mov eax , dword ptr [ edi + 04B35CCh ]
>test eax , eax
>je Label42fde3
>mov byte ptr [ ebp + 04962C0h ] , 01h
>jmp Label42fdea
>
>Label42fde3 ::
>mov byte ptr [ ebp + 04962C0h ] , 00h
>
>// case CAPTURE_MOVES:
>Label42fdea ::
>mov eax , dword ptr [ edi + 04B35CCh ]
>test eax , eax
>je Label42fe3d
>mov edx , dword ptr [ edi + 04B35D0h ]
>mov eax , dword ptr [edx]
>mov dword ptr [ 4 * ebp + 04B46A4h ] , eax
>mov ecx , dword ptr [ edi + 04B35D0h ]
>mov dword ptr [ecx] , 00h
>mov edx , dword ptr [ edi + 04B35D0h ]
>mov eax , 04h
>add edx , eax
>mov dword ptr [ edi + 04B35D0h ] , edx
>dec dword ptr [ edi + 04B35CCh ]
>jne Label42fe30
>mov dword ptr [ edi + 04B35C8h ] , eax
>
>Label42fe30 ::
>pop edi
>pop esi
>pop ebp
>mov eax , 03h // return (CAPTURE_MOVES);
>pop ebx
>add esp , 0Ch
>ret
>
>Label42fe3d ::
>mov dword ptr [ edi + 04B35C8h ] , 04h
>
>// case KILLER_MOVE_1:
>mov eax , dword ptr [ 8 * ebp + 04B8CF4h ]
>cmp dword ptr [ 4 * ebp + 04B47A8h ] , eax
>je Label42fe8f
>mov ebx , dword ptr [ esp + 36 ]
>push eax
>push ebx
>push ebp
>call Fun4308d0
>add esp , 0Ch
>test eax , eax
>je Label42fe93
>mov edx , dword ptr [ 8 * ebp + 04B8CF4h ]
>mov dword ptr [ 4 * ebp + 04B46A4h ] , edx
>mov dword ptr [ edi + 04B35C8h ] , 05h // tree->next_status[ply].phase =
>KILLER_MOVE_2;
>pop edi
>pop esi
>pop ebp
>mov eax , 04h // return (KILLER_MOVE_1);
>pop ebx
>add esp , 0Ch
>ret
>
>Label42fe8f ::
>mov ebx , dword ptr [ esp + 36 ]
>
>// case KILLER_MOVE_2:
>Label42fe93 ::
>mov eax , dword ptr [ 8 * ebp + 04B8CF8h ]
>cmp dword ptr [ 4 * ebp + 04B47A8h ] , eax
>je Label42fed7
>push eax
>push ebx
>push ebp
>call Fun4308d0
>add esp , 0Ch
>test eax , eax
>je Label42fed7
>mov eax , dword ptr [ 8 * ebp + 04B8CF8h ]
>mov dword ptr [ 4 * ebp + 04B46A4h ] , eax
>mov dword ptr [ edi + 04B35C8h ] , 06h
>pop edi
>pop esi
>pop ebp
>mov eax , 05h
>pop ebx
>add esp , 0Ch
>ret
>
>Label42fed7 ::
>mov dword ptr [ edi + 04B35C8h ] , 06h
>jmp Label42fee7
>mov ebx , dword ptr [ esp + 36 ]
>
>Label42fee7 ::
>// case GENERATE_ALL_MOVES:
>mov ecx , dword ptr [ 4 * ebp + 04B48ACh ]
>push ecx
>push ebx
>push ebp
>call Fun416260
>mov dword ptr [ 4 * ebp + 04B48ACh ] , eax
>add esp , 0Ch
>mov dword ptr [ edi + 04B35C8h ] , 08h
>jmp Label42ff10
>mov ebx , dword ptr [ esp + 36 ]
>
>Label42ff10 ::
>mov dword ptr [ edi + 04B35CCh ] , 01h
>lea eax , dword ptr [ 4 * ebp + 04B48A8h ]
>mov dword ptr [ edi + 04B35C8h ] , 09h
>mov ecx , dword ptr [eax]
>mov dword ptr [ esp + 32 ] , eax
>mov eax , dword ptr [ 4 * ebp + 04B48ACh ]
>xor esi , esi
>xor edx , edx
>cmp ecx , eax
>jnb Label43005c
>
>Label42ff44 ::
>mov eax , dword ptr [ecx]
>test eax , eax
>je Label42ff8e
>cmp eax , dword ptr [ 4 * ebp + 04B47A8h ]
>je Label42ff88
>cmp eax , dword ptr [ 8 * ebp + 04B8CF4h ]
>je Label42ff88
>cmp eax , dword ptr [ 8 * ebp + 04B8CF8h ]
>je Label42ff88
>and eax , 0FFFh
>test ebx , ebx
>je Label42ff77
>mov eax , dword ptr [ 4 * eax + 06CD1E0h ]
>jmp Label42ff7e
>
>Label42ff77 ::
>mov eax , dword ptr [ 4 * eax + 06C4760h ]
>
>Label42ff7e ::
>cmp eax , esi
>jle Label42ff8e
>mov esi , eax
>mov edx , ecx
>jmp Label42ff8e
>
>Label42ff88 ::
>mov dword ptr [ecx] , 00h
>
>Label42ff8e ::
>mov eax , dword ptr [ 4 * ebp + 04B48ACh ]
>add ecx , 04h
>cmp ecx , eax
>jb Label42ff44
>test edx , edx
>je Label43005c
>mov eax , dword ptr [edx]
>pop edi
>mov dword ptr [ 4 * ebp + 04B46A4h ] , eax
>pop esi
>pop ebp
>mov dword ptr [edx] , 00h
>mov eax , 08h
>pop ebx
>add esp , 0Ch
>ret
>mov ecx , dword ptr [ 4 * ebp + 04B48A8h ]
>mov ebx , dword ptr [ 4 * ebp + 04B48ACh ]
>lea eax , dword ptr [ 4 * ebp + 04B48A8h ]
>xor esi , esi
>xor edx , edx
>cmp ecx , ebx
>mov dword ptr [ esp + 32 ] , eax
>jnb Label43005c
>
>Label42ffe1 ::
>mov eax , dword ptr [ecx]
>test eax , eax
>je Label43000b
>and eax , 0FFFh
>cmp dword ptr [ esp + 36 ] , 00h
>je Label42fffc
>mov eax , dword ptr [ 4 * eax + 06CD1E0h ]
>jmp Label430003
>
>Label42fffc ::
>mov eax , dword ptr [ 4 * eax + 06C4760h ]
>
>Label430003 ::
>cmp eax , esi
>jle Label43000b
>mov esi , eax
>mov edx , ecx
>
>Label43000b ::
>add ecx , 04h
>cmp ecx , ebx
>jb Label42ffe1
>test esi , esi
>je Label43005c
>mov ecx , dword ptr [edx]
>mov dword ptr [ 4 * ebp + 04B46A4h ] , ecx
>mov dword ptr [edx] , 00h
>mov ecx , dword ptr [ edi + 04B35CCh ]
>inc ecx
>mov eax , ecx
>cmp eax , 03h
>mov dword ptr [ edi + 04B35CCh ] , ecx
>jle Label43004f
>mov edx , dword ptr [ esp + 32 ]
>mov dword ptr [ edi + 04B35C8h ] , 0Ah // tree->next_status[ply].phase =
>REMAINING_MOVES;
>mov eax , dword ptr [edx]
>mov dword ptr [ edi + 04B35D0h ] , eax
>
>Label43004f ::
>pop edi
>pop esi
>pop ebp
>mov eax , 09h // return (HISTORY_MOVES_2);
>pop ebx
>add esp , 0Ch
>ret
>
>Label43005c ::
>// (label) remaining_moves:
>mov ecx , dword ptr [ esp + 32 ]
>mov dword ptr [ edi + 04B35C8h ] , 0Ah
>mov edx , dword ptr [ecx]
>mov dword ptr [ edi + 04B35D0h ] , edx
>mov eax , dword ptr [ edi + 04B35D0h ]
>cmp eax , dword ptr [ 4 * ebp + 04B48ACh ]
>jnb Label43009e
>
>Label430081 ::
>mov eax , dword ptr [ edi + 04B35D0h ]
>cmp dword ptr [eax] , 00h
>jne Label4300a8
>add eax , 04h
>mov dword ptr [ edi + 04B35D0h ] , eax
>cmp eax , dword ptr [ 4 * ebp + 04B48ACh ]
>jb Label430081
>
>Label43009e ::
>pop edi
>pop esi
>pop ebp
>xor eax , eax
>pop ebx
>add esp , 0Ch
>ret
>
>Label4300a8 ::
>mov ecx , dword ptr [ edi + 04B35D0h ]
>mov edx , dword ptr [ecx]
>mov dword ptr [ 4 * ebp + 04B46A4h ] , edx
>mov eax , dword ptr [ edi + 04B35D0h ]
>mov dword ptr [eax] , 00h
>add dword ptr [ edi + 04B35D0h ] , 04h
>pop edi
>pop esi
>pop ebp
>mov eax , 0Ah
>pop ebx
>add esp , 0Ch
>ret



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.