Class GameController

java.lang.Object
core.GameController

public class GameController extends Object
Controls the game logic and flow. Connects all core components.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Standard constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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 function
    boolean
    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
    Generates new math task and starts timer (if active).
    void
    Starts the Round Timer (if active)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public String checkTask(int in)
      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

      public String endRoundTime()
      Stops the Round Timer (if active)
    • getLength

      public int getLength()
      Returns number of tasks per round.
    • gameEnding

      public String gameEnding()
      Prints round statistics and remaining lives (if active).
    • newRound

      public String newRound(int num)
      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