I have an assignment to create a connect 4 project that has user as a player, has a regular automatic player, and has the option of having a smart player. I have created the other players, but I am confused as to how to create the smart player. I have decided to use the minimax algorithm to do so but I cannot get the code together to create it......this is what I have so far.



import java.io.*;
import java.util.*;

public class PickNextMoveSmart implements PickNextMove {

int evaluate(Board b,Player me, Player opp, MyTimer t) {
return me.finalScore();
}

int recurEvaluate(Board b, Player me, Player opp, MyTimer t, int depth){

if (depth == 8)
{
return evaluate(b, me, opp, t);
}
else
{
depth = depth + 1;
int max = -1000;
int column = -1;
for (int i = 0; i < Board.allmoves.size(); i++)
{

if (b.isValidMove(Board.allmoves.get(i)))
{
Player newme = me;
Player newopp = opp.addScore(b.nextScore(Board.allmoves.get(i)));
Board newboard = b.nextMove(Board.allmoves.get(i));
int newscore = recurEvaluate(newboard, newme, newopp, t, depth);
if (max < newscore) {
max = newscore;
column = i;
}



}


}
return max;
}




}

public Move nextMove(Board b, Player me, Player opp, MyTimer t) {


int bestscore = -1000;
int bestpos = -1;

for (int i = 0; i < Board.allmoves.size(); i++)
{
if (b.isValidMove(Board.allmoves.get(i)))
{
Player new_me = me.addScore(b.nextScore(Board.allmoves.get(i)));
Board new_board = b.nextMove(Board.allmoves.get(i));
int score = recurEvaluate(new_board, new_me, opp, t, 0);
if (score >= bestscore)
{
bestscore = score;
bestpos = i;
}
}
}

return Board.allmoves.get(bestpos);
}
}




Can anybody point me in the right direction?