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.

20 lines
689 B

  1. import java.util.Scanner;
  2. public class ShipTest{
  3. public static void createTestShips(int[] start,int[] end, Ship[] fill){
  4. for (int i = 0; i < fill.length; i++){
  5. fill[i] = Ship.randomShip(start,end,Ship.randint(2,4),true);
  6. }
  7. }
  8. public static void main(String[] args){
  9. Ship[] test_ships = new Ship[5];
  10. createTestShips(new int[] {0,0}, new int[] {5,5},test_ships);
  11. for (int i = 0; i < test_ships.length-1;i++){
  12. test_ships[i].print();
  13. System.out.println();
  14. test_ships[i+1].print();
  15. System.out.println(test_ships[i].isIntersecting(test_ships[i+1]));
  16. System.out.println();
  17. }
  18. }
  19. }