|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--PrintSuperClass
|
+--Board
Creates Board - Note board Matrix is public
Normal Board Access Uses... public boolean set( char c, Coordinates p ) set location p to c - returns false if unable to set contents public char get( Coordinates c ) returns char at location c Child class Ships clears board between games; Board Declares Global Constants MAXROWS, MAXCOLSEMPTYCHAR, HITCHAR, MISSCHAR Poosible Future Upgrade: Board extends Coordinates, Coordinate is current guess
| Field Summary | |
char[][] |
board
board represents, the guessing board or your defensive ships board |
static char |
EMPTYCHAR
Global constant represent the board character for an empty coordinate Initially the entire guessing board is empty |
static char |
HITCHAR
Global constant represent the board character for a hit coordinate |
static int |
MAXCOLS
Global constant number of columns on each board |
static int |
MAXROWS
Global constant number of rows on each board a Coordinate is row, column |
static char |
MISSCHAR
Global constant represent the board character for a missed coordinate |
| Constructor Summary | |
Board()
creates the board matrix and sets all coordinates to EMPTYCHAR |
|
| Method Summary | |
void |
clear()
|
void |
copy(Board b)
|
char |
get(Coordinates c)
|
char |
get(int r,
int c)
|
static void |
main(java.lang.String[] args)
used for testing board and print method |
void |
print(java.io.PrintWriter pw)
prints the entire board, for subclass ship prints the ship character codes for a guessing board will print EMPTYCHAR, MISSCHAR and HITCHAR ar each coordinate |
void |
println(java.io.PrintWriter pw)
|
boolean |
set(char c,
Coordinates p)
sets the coordinate p on board to the char c |
| Methods inherited from class PrintSuperClass |
print, print, print, println, println, println |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int MAXROWS
public static final int MAXCOLS
public static final char EMPTYCHAR
public static final char HITCHAR
public static final char MISSCHAR
public char[][] board
| Constructor Detail |
public Board()
| Method Detail |
public boolean set(char c,
Coordinates p)
public char get(Coordinates c)
public char get(int r,
int c)
public void copy(Board b)
b - board is copied into the calling objectpublic void clear()
public void print(java.io.PrintWriter pw)
print in class PrintSuperClasspublic void println(java.io.PrintWriter pw)
println in class PrintSuperClasspublic static void main(java.lang.String[] args)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||