public class ControlInterface
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.lang.String |
FILE_EXTENSION
The file extension for saving.
|
private Game |
game |
private boolean |
loaded
Identifier for loaded games.
|
Constructor and Description |
---|
ControlInterface() |
Modifier and Type | Method and Description |
---|---|
int |
getActiveRowNumber()
Getter for the active Row number.
|
boolean |
getGameEnded()
Getter for game ended state.
|
Row |
getGameFieldRow(int row)
Get a specific game Row.
|
Row |
getLastResultRow()
Get the newest results.
|
boolean |
getLoaded()
Getter for loaded game state.
|
Row |
getResultRow(int row)
Get a specific result Row.
|
Row |
getSecretCode()
Get the secret code.
|
boolean |
getSettingAiMode()
Getter for AI mode.
|
int |
getSettingColQuant()
Getter for the color quantity.
|
boolean |
getSettingDoubleCol()
Getter for double colors allowance.
|
int |
getSettingMaxTries()
Getter for max. number of tries (guesses).
|
int |
getSettingWidth()
Getter for the game width.
|
void |
load()
Load a game from "savegame" file.
|
void |
load(java.lang.String fileName)
Load a game from a specific path/filename.
|
void |
newGame()
Start a new game.
|
void |
save()
Save the game with settings as "savegame" file.
|
void |
save(java.lang.String fileName)
Save the game with settings to a specific path/filename.
|
void |
setSecretCode(Color[] colors)
Set the secret code.
|
void |
setSettingAiMode(boolean status)
Setter for AI mode.
|
void |
setSettingColQuant(int quant)
Setter for the color quantity.
|
void |
setSettingDoubleCol(boolean allow)
Setter for double colors allowance.
|
void |
setSettingMaxTries(int max)
Setter for max. number of tries (guesses).
|
void |
setSettingWidth(int width)
Setter for the game width.
|
int |
turn()
Do a full game turn.
|
void |
writeToGameField(Color[] colors)
Set a Row of colors to the active game Row.
|
private Game game
public final java.lang.String FILE_EXTENSION
private boolean loaded
public int getActiveRowNumber()
public int turn()
public void writeToGameField(Color[] colors)
colors
- The colors to set as active game Row.public Row getLastResultRow()
public Row getResultRow(int row)
row
- The Row number.public Row getGameFieldRow(int row)
row
- The Row number.public Row getSecretCode()
public void setSecretCode(Color[] colors)
colors
- The secret code to set.public int getSettingColQuant()
public void setSettingColQuant(int quant)
quant
- Quantity of colors in the game. (Between 1 and 15).public int getSettingWidth()
public void setSettingWidth(int width)
width
- The width of a guess Row. (Between 1 and 8).public void setSettingMaxTries(int max)
max
- Max. number of tries / guesses.
(Between 1 and Integer.MAX_VALUE).public int getSettingMaxTries()
public void setSettingDoubleCol(boolean allow)
allow
- Allow double colors.public boolean getSettingDoubleCol()
public boolean getSettingAiMode()
public void setSettingAiMode(boolean status)
status
- True for AI = Codebreaker, human = Codemaker.public void newGame()
public boolean getLoaded()
public boolean getGameEnded()
public void save() throws java.io.FileNotFoundException, java.lang.SecurityException, java.io.IOException
java.io.FileNotFoundException
java.lang.SecurityException
java.io.IOException
public void save(java.lang.String fileName) throws java.io.FileNotFoundException, java.lang.SecurityException, java.io.IOException
fileName
- Path and filename.java.io.FileNotFoundException
java.lang.SecurityException
java.io.IOException
public void load() throws java.io.FileNotFoundException, java.lang.SecurityException, java.io.IOException, java.lang.ClassNotFoundException
java.io.FileNotFoundException
java.lang.SecurityException
java.io.IOException
java.lang.ClassNotFoundException
public void load(java.lang.String fileName) throws java.io.FileNotFoundException, java.lang.SecurityException, java.io.IOException, java.lang.ClassNotFoundException
fileName
- Path and filename.java.io.FileNotFoundException
java.lang.SecurityException
java.io.IOException
java.lang.ClassNotFoundException