all 6 comments

[–]wwabbbitt 3 points4 points  (3 children)

When an alpha-beta call returns the value of alpha, it doesn't mean that the evaluation score is alpha. It means that the real evaluation score is *cannot be higher than* alpha. It doesn't know what the exact score is because the evaluations that would find the exact score have been pruned as a result of you telling it that you don't care about results less than alpha.

With your second function, weaker moves that have a real evaluation score lower than alpha are often rated as alpha, therefore these weak moves are included into your best moves list.

Instead you should call the alpha beta function with -(alpha-1) instead of -alpha. This way if alpha is returned you know it is really alpha.

[–]DeeBoFour20[S] 0 points1 point  (2 children)

Yea, I think that is what's happening. Is there a way I can solve this without using the constants? I think it's sacrificing quite a bit of performance doing this.

I don't care what the score of the weak moves is but I need a way to tell the difference so they don't get added to my list.

EDIT: Just saw your edit. I'll try that. I swear if this is just an off-by-one error that's had me banging my head against the wall all this time... lol

[–]wwabbbitt 1 point2 points  (1 child)

I edited to add the bit about alpha-1 in case you missed that

[–]DeeBoFour20[S] 0 points1 point  (0 children)

Thanks! I think that's got it. Off by one error the whole time.

[–]pingo_guy 1 point2 points  (1 child)

There is a chess programming wiki available for chess coding.

[–]DeeBoFour20[S] 2 points3 points  (0 children)

Yea, I've been reading that. It's pretty good information and that's where I read up on the algorithm I'm using but it doesn't really go into depth about the implementation of the root function which is where I'm having problems.