|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsmithers.logicpuzzles.SlitherlinkState
public class SlitherlinkState
Represents a state of a slitherlink puzzle. Note: isSolved() is not
implemented yet.
| Constructor Summary | |
|---|---|
SlitherlinkState(Slitherlink puzzle)
Constructs a state for the specified puzzle. |
|
| Method Summary | |
|---|---|
void |
clearState()
Clears the state of the puzzle. |
int |
getHorizontalState(int row,
int column)
Gets the state of the specified horizontal wall. |
Slitherlink |
getPuzzle()
Returns the puzzle which this is a state of. |
int |
getVerticalState(int row,
int column)
Gets the state of the specified vertical wall. |
boolean |
isSolved()
Determines whether or not the puzzle has been completely solved. |
void |
setHorizontalState(int row,
int column,
int state)
Adds or removes a horizontal wall. |
void |
setVerticalState(int row,
int column,
int state)
Adds or removes a vertical wall. |
java.lang.String |
toString()
Generates a String representing the current situation of the
puzzle. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SlitherlinkState(Slitherlink puzzle)
puzzle - the puzzle that this is a state of| Method Detail |
|---|
public Slitherlink getPuzzle()
PuzzleState
getPuzzle in interface PuzzleState<Slitherlink>Puzzle which this PuzzleState relates to.
public int getHorizontalState(int row,
int column)
row - the row index (from 0)column - the column index (from 0)
public int getVerticalState(int row,
int column)
row - the row index (from 0)column - the column index (from 0)
public void setHorizontalState(int row,
int column,
int state)
row - the row index (from 0)column - the column index (from 0)state - 1 to add the wall, 0 to remove, or -1 to set unknown
public void setVerticalState(int row,
int column,
int state)
row - the row index (from 0)column - the column index (from 0)state - 1 to add the wall, 0 to remove, or -1 to set unknownpublic void clearState()
public boolean isSolved()
PuzzleState
isSolved in interface PuzzleState<Slitherlink>true iff the puzzle has been completely solvedpublic java.lang.String toString()
String representing the current situation of the
puzzle. Represents a wall as '|' or '-', corners as '+', no wall as ' ',
and unsure as '?'.
toString in interface PuzzleState<Slitherlink>toString in class java.lang.ObjectString representing the state
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||