Computer Chess Club Archives


Search

Terms

Messages

Subject: question about using of global varaibles

Author: Uri Blass

Date: 13:42:17 06/21/04


As far as I see fruit does not use global varaibles for calculating the stage of
the game and I ask if there is a good reason for it.

I think to change my evaluation not to jump between stages and the first test of
it is going to be to change the king square table not to jump between middle
game and endgame.

Later I will care about better pawn evaluation.

I have simply global varaible valpieces[] that give me the value of pieces for
every side(it's value in the opening is 31=9+5*2+4*3) and I think to use the
code at the bottom of this post in order to calculate the stage of the game frm
white and black point of view(but maybe it is better to do it in the way of
fruit because in that way you get more flexibility in changing parameters and
for example you may use not 12 and not 9 for queen in calculating stage of the
game).

I think that it may be also better not to calculate phasewhite and phaseblack
and to use global varaibles that are updated during makemove and unmakemove but
I decided not to care about this speed optimization now.

I also wonder if it is a real speed optimization and maybe with a lot of global
varaibles another global varaible that you do not need to calculate make the
program slower.


Here is the code:

int phasewhite=31-valpieces[DARK];
int phaseblack=31-valpieces[LIGHT];
if (phasewhite<0)
  phasewhite=0;
if (phaseblack<0)
 phaseblack=0;

phasewhite=(phasewhite*256+15)/31;
phaseblack=(phaseblack*256+15)/31;

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.