|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.blackledge.david.game.crossword.CrosswordPuzzle
public class CrosswordPuzzle
Embodiment of a Crossword puzzle. Needs to be populated, but knows how to validate that the population is correct.
Nested Class Summary | |
---|---|
static class |
CrosswordPuzzle.Puzzleword
Embodiment of an entry in a Crossword Puzzle - word, position, direction, and clue. |
Field Summary | |
---|---|
static char |
BLACKED_OUT
|
static char |
BLANK
|
Constructor Summary | |
---|---|
CrosswordPuzzle(int width,
int height)
Create a new Crossword Puzzle core of the given width and height. |
Method Summary | |
---|---|
void |
addCrossword(CrosswordPuzzle.Puzzleword crossword)
Add an entry to the puzzle. |
boolean |
checkWin()
See if the current state of the puzzle matches the solution. |
int |
getHeight()
|
CrosswordPuzzle.Puzzleword |
getPuzzleword(int x,
int y,
boolean horizontal)
|
char |
getState(int x,
int y)
Gets the current character entered at the position. |
int |
getWidth()
|
boolean |
isValidated()
|
void |
setGuess(int x,
int y,
String letter)
Sets the letter guessed for a particular position. |
String |
toString()
Prints out the solution and clues. |
void |
validatePuzzle()
Ensure validity and assign clue numbers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final char BLACKED_OUT
public static final char BLANK
Constructor Detail |
---|
public CrosswordPuzzle(int width, int height)
width
- height
- Method Detail |
---|
public void setGuess(int x, int y, String letter)
x
- (left-to-right position)y
- (top-to-bottom position)letter
- public char getState(int x, int y)
x
- (left-to-right position)y
- (top-to-bottom position)
public CrosswordPuzzle.Puzzleword getPuzzleword(int x, int y, boolean horizontal)
public int getWidth()
public int getHeight()
public boolean isValidated()
public boolean checkWin()
public void validatePuzzle()
IllegalArgumentException
- if any tests fail.public void addCrossword(CrosswordPuzzle.Puzzleword crossword)
crossword
- public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |