Browse Source
Added neccesary methods for BattleshipMain
Added neccesary methods for BattleshipMain
Home stretch I think I might be donemaster
5 changed files with 52 additions and 33 deletions
@ -1,4 +0,0 @@ |
|||
public class GameBoard{ |
|||
private int xDim; |
|||
private int yDim; |
|||
private Battleship[5] ships; |
|||
@ -1,21 +0,0 @@ |
|||
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(); |
|||
} |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue