• Create Account

### #ActualJaap85

Posted 20 May 2012 - 11:11 AM

Thanx!

Little update: If i change my code to this, it still doesnt work, however in this way the code never finishes (i guess it must be stuck in a loop somewhere).


//Execute a minimax on each child
//for (int i = 0; i < MoveList.Count; i++)
foreach (int i in MoveList)
{
//Make a move and create a new gamestate
int j = GetStateNumber(Depth+1);
AIStates[Depth + 1, j] = new gamestate(StateOfBoard, MoveList[i], size);

//Place a token in the new Gamestate
PlaceToken(AIStates[Depth + 1, j],MoveList[i], Player);

//Call minimax on the child
ReturnMove = RecursiveMiniMaxAI(Depth + 1, MaxDepth, AIStates[Depth + 1, j], 1);

//Evaluate return
if (ReturnMove.Score < BestScore)
{
BestScore = ReturnMove.Score;
BestMove = ReturnMove.Move;
}
}


### #2Jaap85

Posted 20 May 2012 - 11:00 AM

Thanx!

Little update: If i change my code to this, the same problem occurs.


//Execute a minimax on each child
//for (int i = 0; i < MoveList.Count; i++)
foreach (int i in MoveList)
{
//Make a move and create a new gamestate
int j = GetStateNumber(Depth+1);
AIStates[Depth + 1, j] = new gamestate(StateOfBoard, MoveList[i], size);

//Place a token in the new Gamestate
PlaceToken(AIStates[Depth + 1, j],MoveList[i], Player);

//Call minimax on the child
ReturnMove = RecursiveMiniMaxAI(Depth + 1, MaxDepth, AIStates[Depth + 1, j], 1);

//Evaluate return
if (ReturnMove.Score < BestScore)
{
BestScore = ReturnMove.Score;
BestMove = ReturnMove.Move;
}
}


### #1Jaap85

Posted 20 May 2012 - 03:20 AM

Thanx!

PARTNERS