Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How to compare the current_material with the root_material?

Author: Pallav Nawani

Date: 10:55:38 05/15/05

Go up one level in this thread


On May 15, 2005 at 03:34:11, Alvaro Jose Povoa Cardoso wrote:

>On May 15, 2005 at 00:16:39, Pallav Nawani wrote:
>
>>Use another variable to store the side to move at root.
>>side_root = wtm;
>>score_root = compute_material();
>>...
>>
>>>int current_material, root_mat;
>>>makemove(wtm, ply)
>>>  current_material=ComputeMaterialScore(); root_mat=root_material;
>>>  if (wtm == side_root) {current_material=-current_material; root_mat=-root_mat};
>>>unmakemove(wtm, ply)
>>
>>etc.
>>
>>Pallav
>
>Thanks, Pallav
>but shouldn't it be:
>   if (wtm != side_root) {current_material=-current_material;
>root_mat=-root_mat};
>
>Or am I wrong?
>
>Alvaro

I did not read you code very carefully first time, sorry.
This depends on how you calculate current_material. If the current_material is
calculated for the moving side, then you should not reverse its sign. If it is
calculated for white always, them you need to do something like:

if(!wtm)
current_material=-current_material;
if(wtm != root_mat)
root_mat =-root_mat;

Either way, you need to make sure that when you are doing the comparison, both
root_mat and current_material are calculated from the perspective of the same
side, that is, the side on move.

Pallav


Pallav



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.