s3games.engine

## Class Game

- java.lang.Object
- - java.lang.Thread
  - - s3games.engine.Game

- All Implemented Interfaces:
    java.lang.Runnable

      public class Game
      extends java.lang.Thread

  The Game class represents a single instance of game - it asks players to provide their moves, verifies if they conform with the rules and performs all the follow-up actions, including instructing the robot arm to perform the requested actions

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.lang.Thread

      `java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `Config` | `config` config can contain some configuration options
    `GameSpecification` | `gameSpecification` specification of the game
    `GameLogger` | `logger` logger is used to write informative messages about game progress to file
    `Player[]` | `players` all players that are currently playing the game
    `GameState` | `state` current state of the game
    `GameWindow` | `window` board of the game shown in window

    - ### Fields inherited from class java.lang.Thread

      `MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Game(Config config, GameLogger logger, GameWindow window, Switch gameRuns, Robot robot)` constructs a new game, saves references to the objects passed in arguments

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `run()` game runs in separate thread, here
    `void` | `setGameAndPlayers(GameSpecification gameSpecification, Player[] players)` setup game specification and players objects

    - ### Methods inherited from class java.lang.Thread

      `activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### state

          public GameState state

      current state of the game

    - #### gameSpecification

          public GameSpecification gameSpecification

      specification of the game

    - #### window

          public GameWindow window

      board of the game shown in window

    - #### config

          public Config config

      config can contain some configuration options

    - #### logger

          public GameLogger logger

      logger is used to write informative messages about game progress to file

    - #### players

          public Player[] players

      all players that are currently playing the game

  - ### Constructor Detail

    - #### Game

          public Game(Config config,
              GameLogger logger,
              GameWindow window,
              Switch gameRuns,
              Robot robot)

      constructs a new game, saves references to the objects passed in arguments

  - ### Method Detail

    - #### setGameAndPlayers

          public void setGameAndPlayers(GameSpecification gameSpecification,
                               Player[] players)

      setup game specification and players objects

    - #### run

          public void run()

      game runs in separate thread, here
      Specified by:
        `run` in interface `java.lang.Runnable`
      Overrides:
        `run` in class `java.lang.Thread`