|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object smithers.logicpuzzles.HanjieState
public class HanjieState
Class to store the state of a hanjie puzzle.
Constructor Summary | |
---|---|
HanjieState(Hanjie puzzle)
Constructs new solver for the specified puzzle. |
Method Summary | |
---|---|
void |
clearState()
Clears the state of the puzzle. |
Hanjie |
getPuzzle()
Returns the puzzle which this is a state of. |
int |
getState(int row,
int column)
Gets the state of a specificate pixel. |
boolean |
isSolved()
Determines whether or not the puzzle has been completely solved. |
void |
setState(int row,
int column,
int state)
Adds to the attempt at solving the puzzle. |
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 HanjieState(Hanjie puzzle)
puzzle
- the puzzleMethod Detail |
---|
public Hanjie getPuzzle()
PuzzleState
getPuzzle
in interface PuzzleState<Hanjie>
Puzzle
which this PuzzleState
relates to.public int getState(int row, int column)
row
- the row index (from 0)column
- the column index (from 0)
row
, column column
public void setState(int row, int column, int state)
row
- the row index (from 0)column
- the column index (from 0)state
- the index of the colour to set coloured, 0 for not
coloured, or -1 to resetpublic void clearState()
public boolean isSolved()
PuzzleState
isSolved
in interface PuzzleState<Hanjie>
true
iff the puzzle has been completely solvedpublic java.lang.String toString()
String
representing the current situation of the
puzzle. Represents unknown as a grave accent '`', white (unfilled) as a
space ' ' and colour 1 as a hash '#'. In colour puzzles, for i>1
it represents colour i
as (char)(0x0022+i)
, i.e. Unicode
characters continuing from '#'.
toString
in interface PuzzleState<Hanjie>
toString
in class java.lang.Object
String
representing the state
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |