delete Add View.placeShipRandomly (already in Player.java)
This commit is contained in:
parent
1fc316b132
commit
eddd1940f8
@ -92,11 +92,11 @@ public abstract class Player {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void placeShipRandomly(Player player) {
|
||||
public void placeShipRandomly() {
|
||||
Random rand = new Random();
|
||||
for(int i : bato) {
|
||||
Ship ship = null;
|
||||
while(ship == null || !player.setShips(ship)) {
|
||||
while(ship == null || !setShips(ship)) {
|
||||
ship = new Ship(new Pair<>(rand.nextInt(10), rand.nextInt(10)), i, Direction.values()[rand.nextInt(Direction.values().length)]);
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class Terminal extends View {
|
||||
}
|
||||
} else {
|
||||
// Random
|
||||
placeShipRandomly(player);
|
||||
player.placeShipRandomly();
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,16 +25,6 @@ public abstract class View {
|
||||
|
||||
public abstract void displayBoard();
|
||||
|
||||
public void placeShipRandomly(Player player) {
|
||||
Random rand = new Random();
|
||||
for(int i : ships) {
|
||||
Ship ship = null;
|
||||
while(ship == null || !player.setShips(ship)) {
|
||||
ship = new Ship(new Pair<>(rand.nextInt(10), rand.nextInt(10)), i, Direction.values()[rand.nextInt(Direction.values().length)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
// String chain = "A vous de joueur "+game.currentPlayer.toString()+ "\n+ - - - - - - - - - - +\n";
|
||||
|
Loading…
Reference in New Issue
Block a user