|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectGuessBoard
Records all the guesses and their results of a player
Field Summary | |
private Location[] |
guess
An array holding all locations guessed so far |
private int |
numGuess
Number of guesses so far |
private boolean[] |
result
Results of all guesses so far. |
Constructor Summary | |
(package private) |
GuessBoard()
Initializes the arrays to the maximum size (100) |
Method Summary | |
boolean |
isNew(Location l)
|
void |
markGuess(Location l,
boolean res)
Marks the result of a guess |
int |
numGuesses()
|
boolean |
wasHit(Location l)
Tests whether a location was guessed and hit |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private Location[] guess
private boolean[] result
private int numGuess
Constructor Detail |
GuessBoard()
Method Detail |
public boolean isNew(Location l)
l
- Location to be checked
public void markGuess(Location l, boolean res)
l
- Location corresponding to the guessres
- Result of the guess at location l (true=hit, false=miss)public boolean wasHit(Location l)
l
- Location to test
public int numGuesses()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |