Author: Robert Hyatt
Date: 16:02:52 09/30/00
Go up one level in this thread
On September 30, 2000 at 12:29:45, Pham Minh Tri wrote:
>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
I don't understand your reference to "second part". It seems that you are
concerned about the minimax idea, when crafty is not using 'minimax'. Instead
it uses 'negamax' which means at any ply in the tree, scores for the side are
+=good, -=bad. This makes the code simpler. And that is why the hash lookup
works the same whether it is wtm or btm.
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.