Package de.sfuhrm.sudoku
Interface GameSchema
public interface GameSchema
Defines the dimensions of a GameMatrix.
Usually Sudokus are 9 x 9 fields and have blocks of
edge with of 3. The possible numbers are 1 to 9.
- Author:
- Stephan Fuhrmann
-
Method Summary
Modifier and TypeMethodDescriptionintA mask for all bits set from bit 0 to the bit $width-1.intThe total number of blocks in one dimension.intThe edge dimension of a NxN block.byteThe valid value that is the maximum (9).byteThe valid value that is the minimum (1).intThe total number of fields.byteThe value that is assigned to unset fields.intgetWidth()The size in one dimension.booleanvalidBitMask(int mask) Is the value passed in valid for a bit mask?booleanvalidCoords(int row, int column) Is the coordinate pair passed valid?booleanvalidValue(byte b) Is the value passed in valid for a field?
-
Method Details
-
getUnsetValue
byte getUnsetValue()The value that is assigned to unset fields.- Returns:
- the unset field representing value.
-
getMinimumValue
byte getMinimumValue()The valid value that is the minimum (1).- Returns:
- the minimum digit field representing value.
-
getMaximumValue
byte getMaximumValue()The valid value that is the maximum (9).- Returns:
- the maximum digit field representing value.
-
getWidth
int getWidth()The size in one dimension.- Returns:
- the size of the game matrix edge in one dimension.
-
getTotalFields
int getTotalFields()The total number of fields.- Returns:
- the total number of fields which is the width * width.
-
getBlockWidth
int getBlockWidth()The edge dimension of a NxN block.- Returns:
- the edge dimension of a block.
-
getBlockCount
int getBlockCount()The total number of blocks in one dimension.- Returns:
- the number of blocks in one dimension.
-
getBitMask
int getBitMask()A mask for all bits set from bit 0 to the bit $width-1.- Returns:
- the mask of all bits set for all valid number values except the unset value.
-
validValue
boolean validValue(byte b) Is the value passed in valid for a field?- Parameters:
b- value to check.- Returns:
trueif valid.
-
validCoords
boolean validCoords(int row, int column) Is the coordinate pair passed valid?- Parameters:
row- the row index.column- the column index.- Returns:
trueif valid.
-
validBitMask
boolean validBitMask(int mask) Is the value passed in valid for a bit mask?- Parameters:
mask- bit mask to check.- Returns:
trueif valid.
-