Browse Source

Update Implementation Methode AIGridGUI

main
Thoumi Ngonga Brice 2 years ago
parent
commit
cb07a19bb5
  1. 14
      src/main/java/BattleShip/AIGridGUI.java
  2. BIN
      target/classes/BattleShip/AIGridGUI.class

14
src/main/java/BattleShip/AIGridGUI.java

@ -206,6 +206,12 @@ public class AIGridGUI extends JPanel {
u = moveUp(u);
upCount++;
}
int d = guessLocation;
int downCount = -1;
while(d >= 0 && !cellsHit[d]) {
d = moveDown(d);
downCount++;
}
}
}
}
@ -221,4 +227,12 @@ public class AIGridGUI extends JPanel {
return dirUp;
}
}
public int moveDown(int d) {
int dirDown = d + columns;
if(dirDown >= (rows*columns)) {
return -1;
} else {
return dirDown;
}
}
}

BIN
target/classes/BattleShip/AIGridGUI.class

Loading…
Cancel
Save