Author: Uri Blass
Date: 09:30:06 04/20/04
I want to give users of movei the option to create personality by changing text
files.
The question is what is the best way to do it.
I have a way that can work but I do not like it.
Here is my code to let the user to change the futilityprune array
Movei is using an array to tell it to prune based on evaluation and remaining
depth and other factors.
I have in the latest version
int futilityprune[6]={0,180,720,1620,2880,4500} when
the numbers in that array are never changed.
I can let the users to change numbers in a text file by the following code and
generate the text file in case that it does not exist but I do not like that
code and the question is if programmers use a better code to let the user to
change weights in the search or in the evaluation.
FILE *evalfile=fopen("movei_eval_details.ini", "r+t");
if (!evalfile)
{
evalfile=fopen("movei_eval_details.ini", "w+t");
fputs("0 180 720 1620 2880 4500",evalfile);
}
fseek(evalfile,0,SEEK_SET);
fgets(evalcharinfo,60,evalfile);
j=0;
i=0;
while (j<6)
{
futilityprune[j]=0;
while ((i<60)&&(evalcharinfo[i]>='0')&&(evalcharinfo[i]<='9'))
{
futilityprune[j]*=10;
futilityprune[j]=futilityprune[j]+(int)evalcharinfo[i]-(int)'0';
i++;
}
while (evalcharinfo[i]==' ')
i++;
j++;
}
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.