|
|
@ -64,7 +64,25 @@ public class AIGridGUI extends JPanel { |
|
|
|
allShips.add(battleship); |
|
|
|
allShips.add(aircraftCarrier); |
|
|
|
|
|
|
|
//Add all directions to an ArrayList to allow for comparing and sorting directions. |
|
|
|
|
|
|
|
directions.add(up); |
|
|
|
directions.add(down); |
|
|
|
directions.add(right); |
|
|
|
directions.add(left); |
|
|
|
|
|
|
|
//Make grid that consists of r rows and c columns of buttons. |
|
|
|
|
|
|
|
GridLayout g = new GridLayout(rows,columns); |
|
|
|
this.setLayout(g); |
|
|
|
|
|
|
|
for(int i = 0; i < (rows * columns); i++) { |
|
|
|
BSButton b = new BSButton(); |
|
|
|
b.setGridLocation(i); |
|
|
|
buttons.add(b); |
|
|
|
this.add(b); |
|
|
|
} |
|
|
|
|
|
|
|
defaultBorder = buttons.get(0).getBorder(); |
|
|
|
} |
|
|
|
} |