## Alpha-beta algorithm, game tree

Hi,

I am creating a Draughts game and currently implementing alpha beta to create a computer opponent. Currently my code is testing all legal moves from the current board state for each player which is okay, but it is not 'deepening' on each piece, I.E. - it does not test farther than the first legal move for each piece. This means than in my game tree, when a piece is moved, it will not move again at lower nodes of the tree, so a complete 'play' (or anywhere near it) cannot be retrieved at any branch. My source code for this follows. Any help on resolving this issue will be great.

Java Code:
```Position best2(Player p)
{
long time= (new Date()).getTime();
Position best=new Position(0,0,0,0);
int alpha= Integer.MIN_VALUE;
int beta= Integer.MAX_VALUE;
int level=Draughts.level;

//set up copy of draughts board for testing moves
new_board = copy_board(board.men);

//test for legal moves (player2) + store in arrayList validMoves
if (getLegalMoves() && go)
{
//if only one move, no need to evaluate
if(validMoves.size()==1)
return (Position) validMoves.get(0);

for (int l = 0; l < validMoves.size(); l++)
{
Position dest = (Position)validMoves.get(l);
move(dest,1);

int v= evaluate1(level, alpha, beta);
unmove(dest, 1);

if (v < beta)
{
beta= v;
best= dest;
}
}//for
}//if
return best;
}//best2

//method to evaluate player 1 moves
int evaluate1(int level, int alpha, int beta)
{
if (win)
return -10000000 - level;
if (level == 0 || !go)
return value = Evaluation(new_board);
int v;
//get legal moves for player 1+store in arraylist validMoves1
if (getLegalMovesP1() &&go)
{
for (int l = 0; l < validMoves1.size(); l++)
{
Position dest1 = (Position)validMoves1.get(l);
move(dest1,0);

v= evaluate2(level - 1, alpha, beta);

unmove(dest1, 0);
if (v > alpha)
alpha= v;
if (beta <= alpha)
return beta;
}//for
}//if

return alpha;
}//evaluate1

//method to evaluate player 2 moves
int evaluate2(int level, int alpha, int beta)
{
if (win)
return 10000000 + level;
if (level == 0 || !go)
return value = Evaluation(new_board);
int v;

if (go)
{
//using valid moves obtained in method best2()
for (int l = 0; l < validMoves.size(); l++)
{
Position dest = (Position)validMoves.get(l);
move(dest,1);
v= evaluate1(level - 1, alpha, beta);
unmove(dest, 1);
if (v < beta)
beta= v;
if (beta <= alpha)
return alpha;
}//for
}//if
return beta;```