diff --git a/src/main/java/BattleShip/AIGridGUI.java b/src/main/java/BattleShip/AIGridGUI.java new file mode 100644 index 0000000..1e9c686 --- /dev/null +++ b/src/main/java/BattleShip/AIGridGUI.java @@ -0,0 +1,6 @@ +package BattleShip; +import javax.swing.*; + +public class AIGridGUI extends JPanel { + +} diff --git a/src/main/java/BattleShip/BSButton.java b/src/main/java/BattleShip/BSButton.java new file mode 100644 index 0000000..3262b23 --- /dev/null +++ b/src/main/java/BattleShip/BSButton.java @@ -0,0 +1,26 @@ +package BattleShip; + +import javax.swing.*; + +public class BSButton extends JButton { + + int gridLocation; + Ship cellContents = null; + + public void setGridLocation(int l) { + gridLocation = l; + } + + public int getGridLocation() { + return gridLocation; + } + + public void setCellContents(Ship s) { + cellContents = s; + } + + public Ship getCellContents() { + return cellContents; + } + +} \ No newline at end of file diff --git a/src/main/java/BattleShip/BShip.java b/src/main/java/BattleShip/BShip.java new file mode 100644 index 0000000..386888c --- /dev/null +++ b/src/main/java/BattleShip/BShip.java @@ -0,0 +1,4 @@ +package BattleShip; + +public class BShip { +} diff --git a/src/main/java/BattleShip/Direction.java b/src/main/java/BattleShip/Direction.java new file mode 100644 index 0000000..29dcc6f --- /dev/null +++ b/src/main/java/BattleShip/Direction.java @@ -0,0 +1,23 @@ +package BattleShip; + +class Direction { + + int countHits, cellLocation; + + + public void setCount(int a) { + countHits = a; + } + + public int getCount() { + return countHits; + } + + public void setCell(int b) { + cellLocation = b; + } + + public int getCell() { + return cellLocation; + } +} diff --git a/src/main/java/BattleShip/Ship.java b/src/main/java/BattleShip/Ship.java new file mode 100644 index 0000000..40c9648 --- /dev/null +++ b/src/main/java/BattleShip/Ship.java @@ -0,0 +1,35 @@ +package BattleShip; + +public class Ship { + + String name; + int length; + public int numOfHits = 0; + boolean kill = false; + + public Ship(int l, String n) { + length = l; + name = n; + } + + public String getName() { + return name; + } + + public int getLength() { + return length; + } + + public boolean isKilled() { + return kill; + } + + public boolean counter() { + //Count hits until number of hits equals ship length, then mark as killed. + numOfHits++; + if(numOfHits == length) { + kill = true; + } + return kill; + } +}