Author: Pham Minh Tri
Date: 09:29:45 09/30/00
Hello,
I am still new to chess and trying to learn from Crafty source code. The LookUp
function makes me very confused.
I understand the piece of code as following when computer checks the first parts
of the hash table based on color to see if the position is in it.
// First part
switch (type) {
case EXACT_SCORE:
*alpha=val;
return(EXACT_SCORE);
case UPPER_BOUND:
if (val <= *alpha) {
*alpha=val;
return(UPPER_BOUND);
}
break;
case LOWER_BOUND:
if (val >= *beta) {
*beta=val;
return(LOWER_BOUND);
}
break;
}
But I dont understand when see the same code for checking the second part. The
second part is for opponent side, thefore the value must be negative and I think
the code should be:
// Second part
switch (type) {
case EXACT_SCORE:
*alpha= -val;
return(EXACT_SCORE);
case UPPER_BOUND:
if (-val >= *beta) {
*beta=-val;
return(LOWER_BOUND);
}
break;
case LOWER_BOUND:
if (-val <= *alpha) {
*alpha=-val;
return(UPPER_BOUND);
}
break;
}
Could anyone shows me what is my misunderstand?
Thank in advance for any help.
Pham
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.