fixed bug in AI
This commit is contained in:
parent
dd68bbf6c7
commit
101ef5bd89
|
@ -36,14 +36,18 @@ public class MaurizioAI implements Player {
|
|||
for(int i=0;i<Game.GAME_COLUMNS;i++){
|
||||
if(board[i][0] == 0){
|
||||
int[][] boardNew = makeMove(board, i, id);
|
||||
boolean loser = false;
|
||||
for(int j=0;j<Game.GAME_COLUMNS;j++){
|
||||
if(boardNew[j][0] == 0 && checkWin(boardNew, j, enemyID)){
|
||||
return j; // NOPE !!!
|
||||
loser = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!loser){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return moveRandom(board);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue