Author: Sune Fischer

Date: 17:02:54 08/14/01

Hi I have been trying to implement an AB algorithm. I have done a lot of searching on the net, the best pseudo code I found was here: http://www.xs4all.nl/~verhelst/chess/search.html#alpha-beta Something is missing though, this function returns only a value, not the best move. Seems there must be designed a function that should call this AB algo. I have tried to do so, but I'm very confused about the logic here ;) Below is pseudo code for what I have running, it is not working. I can see one problem for sure, I put alpha=-INFINITY, then pass alpha to the AB function, in it the first check is if(.... && bestvalue<alpha), so it will never run since bestvalue is also -INFINITY! So what I ask, can someone fix this code, or can you give me a link that has the full pseudo code for an alpha beta search? // called at the root to start the AB search. AMOVE ABsearch(position,depth,InTheMove) { long alpha=-INFINITY; long beta = INFINITY; long bestscore=-INFINITY; long score; AMOVE bestmove; ListOfMoves=FindAllTheMoves(position); for(i=1;NumberOfMoves) { DoMove(position,ListOfMoves[i]); score = AB(position,depth+1,alpha,beta); if(score*InTheMove>bestscore) { bestscore=score*InTheMove; bestmove=ListOfMoves[i]; } UndoMove(position,ListOfMoves[i]); } return bestmove; } long AB(position,depth,alpha,beta) { long bestscore=-INFINITY; long score,i=1; ListOfMoves=FindAllTheMoves(position); while(i<=NumberOfMoves && bestscore<alpha) { if(bestscore>alpha) alpha=bestmove; DoMove(position,ListOfMoves[i]); if (depth+1==MaxPlyDepth) return (Evaluate(position)); score = -AB(position,depth+1,-beta,-alpha); if (score>bestscore) bestscore=score; UndoMove(position,ListOfMoves[i]); i++; } return (bestscore); } // returns positive if good for white // and negative if good for black long Evaluate(position); Thanks, S. Fischer

- Re: The Alpha-Beta search!
**Colin Frayn***03:58:50 08/15/01* - Re: The Alpha-Beta search!
**Leen Ammeraal***22:15:23 08/14/01*- Re: The Alpha-Beta search!
**Sune Fischer***22:37:41 08/14/01*- Re: The Alpha-Beta search!
**Bruce Moreland***22:55:22 08/14/01*- Re: The Alpha-Beta search!
**José de Jesús García Ruvalcaba***02:47:31 08/15/01*- Re: The Alpha-Beta search!
**Sune Fischer***15:21:51 08/18/01*- Re: The Alpha-Beta search!
**Bo Persson***10:28:48 08/21/01*

- Re: The Alpha-Beta search!

- Re: The Alpha-Beta search!

- Re: The Alpha-Beta search!

- Re: The Alpha-Beta search!

- Re: The Alpha-Beta search!

This page took 0.01 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.