|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsudoku.Field
public class Field
The Sudoku playing field and methods to evaluate and manipulate it.
Field Summary | |
---|---|
static int |
COLUMNS
Number of columns in playing field |
static int |
LOCATIONS
Number of locations in playing field |
static int |
MAXVAL
Maximum value in square (minimum is 1, and 0 indicates vacant |
int[] |
possibles
Bit array of possible values for this location, if not assigned. |
int[] |
possiblesCount
Count of possible values for this location, if not assigned |
static int |
QUADRANTS
Number of quadrants |
static int |
ROWS
Number of rows in playing field |
int[] |
squares
Playing location and value 1-9 assigned. |
Constructor Summary | |
---|---|
Field()
Create a new playing Field with no locations assigned. |
|
Field(Field f)
Create a Field that is a copy of an existing Field. |
Method Summary | |
---|---|
void |
calculatePossibles()
Fills in possibles, possiblesCount, and _hintValues arrays based. |
static int |
coordinatesToIndex(int x,
int y)
Convert row and column numbers to a location number |
void |
fillAt(int index,
int value)
Fill in a location. |
GameState |
getState()
Examine current field to determine if there are available moves. |
int |
hints()
Calculate the total number of hints (locations with values). |
Hints |
hintValue(int i)
The hint value is one of NO_HINT, ONE_HINT, or TWO_HINT and should be displayed if hints are enabled. |
static int |
indexToColumn(int index)
Convert a location number to a column number |
static int |
indexToQuadrant(int index)
Convert a location number to a quadrant number |
static int |
indexToRow(int index)
Convert a location number to a row number |
boolean |
isLocked(int i)
A locked location is presumably one that was initially hinted. |
void |
lockArray(boolean flag)
Either locks locations that have values or unlocks all locations |
void |
setMarks()
Correct the mark values after changing or removing a value in a location. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MAXVAL
public static final int ROWS
public static final int COLUMNS
public static final int LOCATIONS
public static final int QUADRANTS
public int[] possibles
public int[] possiblesCount
public int[] squares
Constructor Detail |
---|
public Field()
public Field(Field f)
f
- Field to copyMethod Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public int hints()
public static int indexToRow(int index)
index
- location
public static int indexToColumn(int index)
index
- location
public static int indexToQuadrant(int index)
index
- location
public static int coordinatesToIndex(int x, int y)
x
- columny
- row
public void fillAt(int index, int value)
index
- location to fillvalue
- value to fill location withpublic void setMarks()
public void lockArray(boolean flag)
flag
- true to lock, false to unlockpublic void calculatePossibles()
public GameState getState()
public boolean isLocked(int i)
i
- location index
public Hints hintValue(int i)
i
- location index
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |