Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bob: ELChinito a clone from Crafty ...

Author: Paul H

Date: 14:40:14 08/22/04

Go up one level in this thread


>
>
>I may have written that poorly.  "large" has not yet been proven.  "some chunks"
>has definitely been shown however.  When/if it becomes "large" is unknown at the
>moment...
>
>move generator, SEE, etc, would quickly make it "large" of course...

Below is the Crafty function NextMove() and disassembly of the corresponding
ElChinito code. I have added a few comments to the code so people can easily
recognize it. Adding more comments is very easy for anyone.

Again, notice that the ElChinito code is from the Crafty code.

There is another thing peculiar to Crafty here. It's not a bug. But if you are
not careful in copying the Crafty code, then it becomes your bug. In the case of
ElChinito, it again copied it without understanding what it is for. Hence it
becomes an ElChinito bug. I will leave that puzzle for some other time to warn
future cloners.

#define NONE                      0
#define HASH_MOVE                 1
#define GENERATE_CAPTURE_MOVES    2
#define CAPTURE_MOVES             3
#define KILLER_MOVE_1             4
#define KILLER_MOVE_2             5
#define GENERATE_ALL_MOVES        6
#define SORT_ALL_MOVES            7
#define HISTORY_MOVES_1           8
#define HISTORY_MOVES_2           9
#define REMAINING_MOVES          10
#define ROOT_MOVES               11

int NextMove(TREE * tree, int ply, int wtm)
{
    register int   *bestp, *movep, *sortv;
    register int    history_value, bestval, index;
    switch (tree->next_status[ply].phase) {
    case HASH_MOVE:
        tree->next_status[ply].phase = GENERATE_CAPTURE_MOVES;
        if (tree->hash_move[ply]) {
            tree->current_move[ply] = tree->hash_move[ply];
            if (ValidMove(tree, ply, wtm, tree->current_move[ply]))
                return (HASH_MOVE);
            else
                Print(128, "bad move from hash table, ply=%d\n", ply);
        }
    case GENERATE_CAPTURE_MOVES:
        tree->next_status[ply].phase = CAPTURE_MOVES;
        tree->last[ply] = GenerateCaptures(tree, ply, wtm,
                                           tree->last[ply - 1]);
        tree->next_status[ply].remaining = 0;
        if (tree->hash_move[ply]) {
            for (movep = tree->last[ply - 1], sortv = tree->sort_value;
                 movep < tree->last[ply]; movep++, sortv++)
                if (*movep == tree->hash_move[ply]) {
                    *sortv = -999999;
                    *movep = 0;
                    tree->hash_move[ply] = 0;
                } else {
                    if (p_values[Piece(*movep) + 7] <
                            p_values[Captured(*movep) + 7]) {
                        *sortv = p_values[Captured(*movep) + 7] -
                                 p_values[Piece(*movep) + 7];
                        tree->next_status[ply].remaining++;
                    } else {
                        *sortv = Swap(tree, From(*movep), To(*movep), wtm);
                        if (*sortv >= 0)
                            tree->next_status[ply].remaining++;
                    }
                }
        } else {
            for (movep = tree->last[ply - 1], sortv = tree->sort_value;
                 movep < tree->last[ply]; movep++, sortv++)
                if (p_values[Piece(*movep) + 7] <
                       p_values[Captured(*movep) + 7]) {
                    *sortv = p_values[Captured(*movep) + 7] -
                             p_values[Piece(*movep) + 7];
                    tree->next_status[ply].remaining++;
                } else {
                    *sortv = Swap(tree, From(*movep), To(*movep), wtm);
                    if (*sortv >= 0)
                        tree->next_status[ply].remaining++;
                }
        }
        if (tree->last[ply] > tree->last[ply - 1] + 1) {
            int             temp1,
                            temp2,
                           *tmovep,
                           *tsortv;
            int            *end;
            sortv = tree->sort_value + 1;
            movep = tree->last[ply - 1] + 1;
            end = tree->last[ply];
            for (; movep < end; movep++, sortv++) {
                temp1 = *movep;
                temp2 = *sortv;
                tmovep = movep - 1;
                tsortv = sortv - 1;
                while (tmovep >= tree->last[ply - 1] && *tsortv < temp2) {
                    *(tsortv + 1) = *tsortv;
                    *(tmovep + 1) = *tmovep;
                    tmovep--;
                    tsortv--;
                }
                *(tmovep + 1) = temp1;
                *(tsortv + 1) = temp2;
            }
        }
        tree->next_status[ply].last = tree->last[ply - 1];
    case CAPTURE_MOVES:
        if (tree->next_status[ply].remaining) {
            tree->current_move[ply] = *(tree->next_status[ply].last);
            *tree->next_status[ply].last++ = 0;
            tree->next_status[ply].remaining--;
            if (!tree->next_status[ply].remaining)
                tree->next_status[ply].phase = KILLER_MOVE_1;
            return (CAPTURE_MOVES);
        }
        tree->next_status[ply].phase = KILLER_MOVE_1;
    case KILLER_MOVE_1:
        if ((tree->hash_move[ply] != tree->killers[ply].move1) &&
            ValidMove(tree, ply, wtm, tree->killers[ply].move1)) {
            tree->current_move[ply] = tree->killers[ply].move1;
            tree->next_status[ply].phase = KILLER_MOVE_2;
            return (KILLER_MOVE_1);
        }
    case KILLER_MOVE_2:
        if ((tree->hash_move[ply] != tree->killers[ply].move2) &&
            ValidMove(tree, ply, wtm, tree->killers[ply].move2)) {
            tree->current_move[ply] = tree->killers[ply].move2;
            tree->next_status[ply].phase = GENERATE_ALL_MOVES;
            return (KILLER_MOVE_2);
        }
        tree->next_status[ply].phase = GENERATE_ALL_MOVES;
    case GENERATE_ALL_MOVES:
        tree->last[ply] = GenerateNonCaptures(tree, ply, wtm, tree->last[ply]);
        tree->next_status[ply].phase = HISTORY_MOVES_1;
    case HISTORY_MOVES_1:
        tree->next_status[ply].remaining = 1;
        tree->next_status[ply].phase = HISTORY_MOVES_2;
        bestval = 0;
        bestp = 0;
        for (movep = tree->last[ply - 1]; movep < tree->last[ply]; movep++)
            if (*movep) {
                if (*movep == tree->hash_move[ply] ||
                    *movep == tree->killers[ply].move1 ||
                    *movep == tree->killers[ply].move2)
                    *movep = 0;
                else {
                    index = *movep & 4095;
                    history_value = (wtm) ? history_w[index] :
                                            history_b[index];
                    if (history_value > bestval) {
                        bestval = history_value;
                        bestp = movep;
                    }
                }
            }
        if (bestp) {
            tree->current_move[ply] = *bestp;
            *bestp = 0;
            return (HISTORY_MOVES_1);
        }
        goto remaining_moves;
    case HISTORY_MOVES_2:
        bestval = 0;
        bestp = 0;
        for (movep = tree->last[ply - 1]; movep < tree->last[ply]; movep++)
            if (*movep) {
                index = *movep & 4095;
                history_value = (wtm) ? history_w[index] : history_b[index];
                if (history_value > bestval) {
                    bestval = history_value;
                    bestp = movep;
                }
            }
        if (bestval) {
            tree->current_move[ply] = *bestp;
            *bestp = 0;
            tree->next_status[ply].remaining++;
            if (tree->next_status[ply].remaining > 3) {
                tree->next_status[ply].phase = REMAINING_MOVES;
                tree->next_status[ply].last = tree->last[ply - 1];
            }
            return (HISTORY_MOVES_2);
        }
remaining_moves:
        tree->next_status[ply].phase = REMAINING_MOVES;
        tree->next_status[ply].last = tree->last[ply - 1];
    case REMAINING_MOVES:
        for (; tree->next_status[ply].last < tree->last[ply];
             tree->next_status[ply].last++)
            if (*tree->next_status[ply].last) {
                tree->current_move[ply] = *tree->next_status[ply].last;
                *tree->next_status[ply].last++ = 0;
                return (REMAINING_MOVES);
            }
        return (NONE);
    default:
        Print(4095, "oops!  next_status.phase is bad! [normal %d]\n",
              tree->next_status[ply].phase);
        return (NONE);
    }
}

// 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.