bug fixing

This commit is contained in:
Maurizio Bruetsch 2017-10-20 21:45:09 +02:00
parent b2500b0c86
commit 0f3490cc65

View file

@ -36,7 +36,7 @@ public class MaurizioAI implements Player {
for(int i=0;i<Game.GAME_COLUMNS;i++){ for(int i=0;i<Game.GAME_COLUMNS;i++){
boolean loser = false; boolean loser = false;
if(board[i][0] == 0){ if(board[i][0] == 0){
int[][] boardNew = makeMove(board, i); int[][] boardNew = makeMove(board, i, 1);
for(int j=0;j<Game.GAME_COLUMNS;j++){ for(int j=0;j<Game.GAME_COLUMNS;j++){
if(boardNew[j][0] != 0 && checkWin(boardNew,j,1)){ if(boardNew[j][0] != 0 && checkWin(boardNew,j,1)){
loser = true; loser = true;
@ -59,7 +59,7 @@ public class MaurizioAI implements Player {
return choice; return choice;
} }
private int[][] makeMove(int[][] board, int choice) { private int[][] makeMove(int[][] board, int choice, int id) {
// Check his choice against the current board. // Check his choice against the current board.
if (choice < 0 || choice > Game.GAME_COLUMNS || board[choice][0] != 0) { if (choice < 0 || choice > Game.GAME_COLUMNS || board[choice][0] != 0) {
System.err.println("Illegal Move!"); System.err.println("Illegal Move!");