You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
674 B
21 lines
674 B
import java.util.Scanner;
|
|
public class ShipTest{
|
|
public static void createTestShips(int[] start,int[] end, Ship[] fill){
|
|
for (int i = 0; i < fill.length; i++){
|
|
fill[i] = Ship.randomShip(start,end,Ship.randint(2,4),true);
|
|
}
|
|
}
|
|
|
|
public static void main(String[] args){
|
|
Ship[] test_ships = new Ship[5];
|
|
createTestShips(new int[] {0,0}, new int[] {5,5},test_ships);
|
|
for (int i = 0; i < test_ships.length-1;i++){
|
|
test_ships[i].print();
|
|
System.out.println();
|
|
test_ships[i+1].print();
|
|
|
|
System.out.println(test_ships[i].isIntersecting(test_ships[i+1]));
|
|
System.out.println();
|
|
}
|
|
}
|
|
}
|