|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectGrid
public class Grid
| Field Summary | |
|---|---|
private Space[][] |
grid
|
(package private) int |
guix
|
(package private) int |
guiy
|
(package private) int |
height
|
(package private) int |
length
|
| Constructor Summary | |
|---|---|
Grid(int l,
int h,
int who)
The Grid class is where the grid matrix is created for the grid classes |
|
| Method Summary | |
|---|---|
int |
checkCord(int row,
int col,
int o,
int sLength)
Used to check a to see if a ship goes off the grid |
int |
checkspot(int row,
int col)
Used to check to see if the selected space has been already hit or miss |
int |
getGX()
Used to get the row coordinate for the grid buttons for when the AI shoots |
int |
getGY()
Used to get the col coordinate for the grid buttons for when the AI shoots |
char |
LetterNum(int letter)
Used to convert coordinates to letters |
void |
printFullGrid()
Used to print out a full battleship grid displaying ships for one player |
java.lang.String |
printGrid(int row,
int col)
Used to print the grids to display where ships are on the grid buttons |
void |
setGX(int gx)
Used to set up the row coordinate for the grid buttons for when the AI shoots |
void |
setGY(int gy)
Used to set up the col coordinate for the grid buttons for when the AI shoots |
int |
setupShips(int player,
int type,
int sLength,
int row,
int col,
int o)
This sets up the ships on the grid for both players |
int |
shipCheckH(int cCol,
int row,
int sLength)
Used to check to see if a ship comes in conflict with another ship horizontally |
int |
shipCheckV(int col,
int rRow,
int sLength)
Used to check to see if a ship comes in conflict with another ship vertically |
java.lang.String |
shipHit(int row,
int col)
Used to get the ship that was hit |
int |
shoot(int row,
int col)
Used to check to see if a ship is at a point being shot at |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
int length
int height
int guix
int guiy
private Space[][] grid
| Constructor Detail |
|---|
public Grid(int l,
int h,
int who)
l - - This is the length size of the gridh - - This is the height size of the gridwho - - This identifies who belongs to the grid| Method Detail |
|---|
public int setupShips(int player,
int type,
int sLength,
int row,
int col,
int o)
player - - determines what player is setting up the shupstype - - identifies which ship is being setupsLength - - The length of the shiprow - - The starting row coordinate for the placement of the shipcol - - The starting column coordinate for the placement of the shipo - - the orientation of the ship, vertical or horizontal
public void printFullGrid()
public int shipCheckH(int cCol,
int row,
int sLength)
cCol - - column coordinate of the starting spot for the shiprow - - row coordinate of the starting spot of the gridsLength - - The length of the ship being placed
public int shipCheckV(int col,
int rRow,
int sLength)
col - - column coordinate of the starting spot for the shiprRow - - row coordinate of the starting spot of the gridsLength - - The length of the ship being placed
public char LetterNum(int letter)
letter - - the number passed to be converted to a letter
public int checkCord(int row,
int col,
int o,
int sLength)
col - - column coordinate of the starting spot for the shiprow - - row coordinate of the starting spot of the grido - - the orientation of the ship, vertical or horizontalsLength - - The length of the ship being placed
public int shoot(int row,
int col)
col - - column coordinate of the starting spot for the shiprow - - row coordinate of the starting spot of the grid
public java.lang.String shipHit(int row,
int col)
col - - column coordinate of the starting spot for the shiprow - - row coordinate of the starting spot of the grid
public int checkspot(int row,
int col)
col - - column coordinate of the starting spot for the shiprow - - row coordinate of the starting spot of the grid
public java.lang.String printGrid(int row,
int col)
col - - the row spot of the shiprow - - the column spot of the ship
public void setGX(int gx)
gx - - the row coordinate for the gui buttonpublic void setGY(int gy)
gy - - the col coordinate for the gui buttonpublic int getGY()
public int getGX()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||