Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Open Source Chess Programs

Author: Uri Blass

Date: 23:04:38 06/07/05

Go up one level in this thread


On June 08, 2005 at 01:31:12, Dann Corbit wrote:

>On June 08, 2005 at 00:54:26, Uri Blass wrote:
>
>>On June 07, 2005 at 23:01:16, Dann Corbit wrote:
>>
>>>On June 07, 2005 at 21:32:33, Pedro Castro wrote:
>>>
>>>>Tord, how I can count the line number (code) of the program?,  some interface
>>>
>>>/* wc: count lines, words, chars */
>>>
>>>#include <stdio.h>
>>>
>>>int main(int argc, char *argv[])
>>>{
>>>    int             c,
>>>                    i,
>>>                    inword;
>>>    FILE           *fp;
>>>    long            linect,
>>>                    wordct,
>>>                    charct;
>>>    long            tlinect = 0,
>>>                    twordct = 0,
>>>                    tcharct = 0;
>>>
>>>    i = 1;
>>>    fp = stdin;
>>>    printf(" lines   words   chars   file\n");
>>>    printf("======= ======= =======  =====\n");
>>>    do {
>>>        if (argc > 1 && (fp = fopen(argv[i], "r")) == NULL) {
>>>            fprintf(stderr, "                        wc: can't open %s\n",
>>>argv[i]);
>>>            continue;
>>>        }
>>>        linect = wordct = charct = inword = 0;
>>>        while ((c = getc(fp)) != EOF) {
>>>            charct++;
>>>            if (c == '\n')
>>>                linect++;
>>>            if (c == ' ' || c == '\t' || c == '\n')
>>>                inword = 0;
>>>            else if (inword == 0) {
>>>                inword = 1;
>>>                wordct++;
>>>            }
>>>        }
>>>        printf("%7ld %7ld %7ld  ", linect, wordct, charct);
>>>        printf(argc > 1 ? "%s\n" : "\n", argv[i]);
>>>        fclose(fp);
>>>        tlinect += linect;
>>>        twordct += wordct;
>>>        tcharct += charct;
>>>    } while (++i < argc);
>>>    if (argc > 2)
>>>        printf("%7ld %7ld %7ld  total\n", tlinect, twordct, tcharct);
>>>    return 0;
>>>}
>>>
>>>>I always have remained astonished at the code of Olithink, very compact, some
>>>>times I wonder myself where is the evaluation?
>>>
>>>It just counts the wood.
>>>
>>>/* The complex evaluation function: */
>>>int eval(int on_move) {
>>>	return on_move ? matValue : -matValue;
>>>}
>>
>>No
>>
>>It is clearly more complex and it also evaluate pawn structure and mobility
>>
>>Here is the relevant code:
>>
>>int eval(int on_move, int alpha, int beta) {
>>	int i, j, c, p, poseval;
>>	u64 hbit;
>>	int teval = on_move ? -material : material;
>>	if (teval - 150 >= beta) return beta;
>>	if (teval + 150 <= alpha) return alpha;
>>	neval ++;
>>
>>	if (plookUpH(&poseval) != 1) {
>>		poseval = pawneval(R000BitB[PAW_W], R000BitB[PAW_B], COL_W);
>>		poseval += pawneval(R000BitB[PAW_B], R000BitB[PAW_W], COL_B);
>>		pstoreH(poseval);
>>	}
>>	poseval += material;
>>
>>	hbit = P000 & ~(R000BitB[PAW_W] | R000BitB[PAW_B]);
>>	while (hbit) {
>>		i = LSB(hbit);
>>		hbit ^= _r000m[i];
>>		j = board[i];
>>		p = j | 1;
>>		c = j & 1;
>>			if (p == KNI_B) { poseval += knightmobil[i] * pos_val[j]; continue; }
>>			if (p == BIS_B) { poseval += bitcount(A045(i) | A135(i)) * pos_val[j];
>>continue; }
>>			if (p == ROO_B) { poseval += bitcount(A000(i) | A090(i)) * pos_val[j];
>>continue; }
>>			if (p == KIN_B) { poseval -= kingmobil[i] * pos_val[j ^
>>(!R000BitB[QUEEN[c^1]])]; }
>>	}
>>
>>	if (!R000BitB[PAW_W] && poseval > 0) {
>>		if (!(QuRo & R000BitB[COL_W]) && bitcount(R000BitB[COL_W]) < 3) return 0;
>>	} else if (!R000BitB[PAW_B] && poseval < 0) {
>>		if (!(QuRo & R000BitB[COL_B]) && bitcount(R000BitB[COL_B]) < 3) return 0;
>>	}
>>
>>	return on_move ? - poseval : poseval;
>>}
>>
>>Uri
>
>That is the eval from Olithink5Prealpha.c on my machine.

I do not see olithink5Prealpha.c to download.

Uri



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.