bug fixing
This commit is contained in:
parent
a0b734e4c4
commit
f0c3999797
|
@ -33,21 +33,21 @@ public class MaurizioAI implements Player {
|
|||
}
|
||||
}
|
||||
//if no wins were found try avoiding losing on the next move
|
||||
for(int i=0;i<Game.GAME_COLUMNS;i++){
|
||||
boolean loser = false;
|
||||
if(board[i][0] == 0){
|
||||
int[][] boardNew = makeMove(board, i, 1);
|
||||
for(int j=0;j<Game.GAME_COLUMNS;j++){
|
||||
if(boardNew[j][0] != 0 && checkWin(boardNew,j,1)){
|
||||
loser = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!loser){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
// for(int i=0;i<Game.GAME_COLUMNS;i++){
|
||||
// boolean loser = false;
|
||||
// if(board[i][0] == 0){
|
||||
// int[][] boardNew = makeMove(board, i, id);
|
||||
// for(int j=0;j<Game.GAME_COLUMNS;j++){
|
||||
// if(boardNew[j][0] != 0 && checkWin(boardNew, j, 1)){
|
||||
// loser = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if(!loser){
|
||||
// return i;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return moveRandom(board);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue