Class GameController
java.lang.Object
core.GameController
Controls the game logic and flow.
Connects all core components.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
changeConfig
(boolean useLive, boolean useTaskTime, boolean useRoundTime, int numTasks, int numRange, int numLives) Changes the saved configuration.checkTask
(int in) Compares input to calculated result, prints result strings.Stops the Round Timer (if active)Prints round statistics and remaining lives (if active).int
Returns number of tasks per round.boolean
returns the activation state of the lives functionboolean
Returns if the game is still active (relevant for Lives feature).newRound
(int num) adds one live for the next round (if Lives feature is active).void
newTask()
Generates new math task and starts timer (if active).void
Starts the Round Timer (if active)
-
Constructor Details
-
GameController
public GameController()Standard constructor.
-
-
Method Details
-
changeConfig
public void changeConfig(boolean useLive, boolean useTaskTime, boolean useRoundTime, int numTasks, int numRange, int numLives) Changes the saved configuration. Checks validity of configured parameters.- Parameters:
useLive
- activate/deactivate the Lives feature.useTaskTime
- activate/deactivate the Task Timer feature.useRoundTime
- activate/deactivate the Round Timer feature.numTasks
- number of tasks per round.numRange
- upper bound for operands.numLives
- number of max lives.
-
newTask
public void newTask()Generates new math task and starts timer (if active). -
checkTask
Compares input to calculated result, prints result strings. Influences current lives and stops timer (if active).- Parameters:
in
- input value to compare to calculated result.
-
getLiving
public boolean getLiving()Returns if the game is still active (relevant for Lives feature). -
startRoundTime
public void startRoundTime()Starts the Round Timer (if active) -
endRoundTime
Stops the Round Timer (if active) -
getLength
public int getLength()Returns number of tasks per round. -
gameEnding
Prints round statistics and remaining lives (if active). -
newRound
adds one live for the next round (if Lives feature is active).- Parameters:
num
- number of added lives after
-
getLiveUse
public boolean getLiveUse()returns the activation state of the lives function
-