Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.farafin.snEADy
Class M_GameEngine

    java.lang.Object
      java.lang.Thread
          de.farafin.snEADy.M_GameEngine

All Implemented Interfaces:
  I_Constants, I_PlayFieldConstants, I_GameStats, java.lang.Runnable

    public final class M_GameEngine

extends java.lang.Thread
implements I_Constants, I_GameStats, I_PlayFieldConstants

Version:
  $Revision: 1.75 $
Author:
  roland, lars GameEngine is the Module that organize the game flow and all its data transportation. its for organizing the communication between @see C_Wworld, @see M_PlayerHandler and @see M_Main

Nested Class Summary

Nested classes/interfaces inherited from class java.lang.Thread
`java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler`

Field Summary
`private D_GameInfo` | `gameInfo` the gameInfo instance from whitch a copy is given to other modules
`private C_Human[]` | `humanInstances` The instances of human Player
`private boolean` | `imergencyPaused` flag that controlls if the class is suspended
`private static M_GameEngine` | `instance` own instance to prevent multible instanzes
`private GameParameter` | `parameter` parameter set of GameParameter
`private D_PlayerData[]` | `playerData` data of the managed player
`private M_PlayerHandler` | `playerHandler` The instance of the player handler.. the class that handles the player management
`private Player[]` | `playerInstances` The player Instances which are loaded
`private C_World` | `world` an instance of the world, the class that computes all moves and stuff world also includes the arena as final. if you like to create a new arena, you need to create a new world-object.

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Fields inherited from interface de.farafin.snEADy.communication.I_Constants
`analyse_ms, auto_grow_delay, auto_slowdown_delay, closemonitor, commandConstants, damage_length_grow, damage_points_radius, DEBUG, delplayer, easy_points, emergencyPause, exit_time, FACE_EAST, FACE_NORTH, FACE_SOUTH, FACE_WEST, goody_length_occ, goody_length_value, goody_points_occ, goody_points_value, goody_shorter_occ, goody_shorter_value, goody_slowdown_occ, goody_speed_occ, IN_ACTION, IN_ERROR_EXC, IN_ERROR_INIT, IN_ERROR_SPACE, IN_ERROR_TIME, IN_EXIT, IN_HEAVEN, init_length, init_move_delay, kill, kill_point_goodies, kill_points_radius, loadhuman, loadlevel, loadplayer, logging, max_goody_occ_delay, MAX_HUMAN_PLAYERS, max_mem_check_delay, max_move_delay, max_player_mem, MAX_PLAYERS, max_thinking_ms, min_cycle_ms, min_move_delay, openmonitor, overalldelay, pause, print_calc_ms, print_parameter, print_player_mem, print_playfield, quit, run, show_subcycles, start, stop, suddend_time, survival_points, timeout_ms, TURN_LEFT, TURN_NONE, TURN_RIGHT`

Fields inherited from interface de.farafin.snEADy.I_GameStats
`GAME_ABBORT, GAME_INIT, GAME_PAUSE, GAME_RECOVER, GAME_RUNNING, GAME_SAFE, PROG_END, PROG_INIT`

Fields inherited from interface de.farafin.snEADy.communication.I_PlayFieldConstants
`EXIT, FIELD_B, FIELD_C, FIELD_D, FIELD_E, FIELD_F, FIELD_G, FIELD_H, FIELD_I, FIELD_J, FIELD_K, FIELD_L, FIELD_M, FIELD_N, FIELD_O, FIELD_P, FIELD_Q, FIELD_R, FIELD_S, FIELD_T, FIELD_U, FIELD_V, FIELD_W, FIELD_X, FIELD_Y, FIELD_Z, FREE, GOODY_f, GOODY_g, GOODY_h, GOODY_i, GOODY_j, GOODY_k, GOODY_l, GOODY_m, GOODY_n, GOODY_o, GOODY_p, GOODY_q, GOODY_r, GOODY_s, GOODY_t, GOODY_u, GOODY_v, GOODY_w, GOODY_x, GOODY_y, GOODY_z, LENGTH, PLAYER_0, PLAYER_1, PLAYER_2, PLAYER_3, PLAYER_4, PLAYER_5, PLAYER_6, PLAYER_7, PLAYER_8, PLAYER_9, POINTS, SHORT, SLOW, SPEED, WALL`

Constructor Summary
`private` | `M_GameEngine()` constructor of M_GameEngine

Method Summary
`private boolean` | `checkGameState()` checks the gameSate
`protected static void` | `destroyInstance(M_GameEngine engine)` destroys the engine - instance to make it free for a new one.
`private D_GameInfo` | `generateGameInfo()` to send other modules the current gameState, its necessary to copy the data and send the data to all modules. this method just copys the data and stores them in a gameInfo instance.
`protected D_GameInfo` | `getGameInfo()`
`protected static M_GameEngine` | `getInstance()` prevents that more than one instance of the class exists in the program
`protected void` | `imergencyPause()` pauses/starts the actual player using deprecated methods!
`protected void` | `initGame(D_GameInfo initData)` init the game
`protected void` | `kill()` stops all threads that are running in the game!
`protected void` | `recover(D_RecoverData recoverData)` recover a before safed game
`private D_GameInfo` | `reGenerateGameInfo()`
`void` | `run()` The main cycle of the game. its a run-method from Thread, M_GameEngine is extended from.
`protected void` | `store(D_RecoverData dataStorage)` saves a game

Methods inherited from class java.lang.Thread
`activeCount, checkAccess, 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
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### world

    private C_World world

  an instance of the world, the class that computes all moves and stuff world also includes the arena as final. if you like to create a new arena, you need to create a new world-object.

  See Also:
    `C_World`

### playerData

    private D_PlayerData[] playerData

  data of the managed player

  See Also:
    `D_PlayerData`

### playerInstances

    private Player[] playerInstances

  The player Instances which are loaded

### humanInstances

    private C_Human[] humanInstances

  The instances of human Player

### playerHandler

    private M_PlayerHandler playerHandler

  The instance of the player handler.. the class that handles the player management

  See Also:
    `M_PlayerHandler`

### gameInfo

    private D_GameInfo gameInfo

  the gameInfo instance from whitch a copy is given to other modules

### parameter

    private final GameParameter parameter

  parameter set of GameParameter

### instance

    private static M_GameEngine instance

  own instance to prevent multible instanzes

### imergencyPaused

    private boolean imergencyPaused

  flag that controlls if the class is suspended

Constructor Detail

### M_GameEngine

    private M_GameEngine()

  constructor of M_GameEngine

  See Also:
    `getInstance()`

Method Detail

### generateGameInfo

    private D_GameInfo generateGameInfo()

  to send other modules the current gameState, its necessary to copy the data and send the data to all modules. this method just copys the data and stores them in a gameInfo instance.

  Returns:
    the gameInfos for the other modules

### reGenerateGameInfo

    private D_GameInfo reGenerateGameInfo()

  Returns:
    the gameInfo which is updated to the actual data and its stored in this.gameInfo

### checkGameState

    private boolean checkGameState()

  checks the gameSate

  Returns:
    if the process should be ended or not

### run

    public void run()

  The main cycle of the game. its a run-method from Thread, M_GameEngine is extended from.

  Specified by:
    `run` in interface `java.lang.Runnable`
  Overrides:
    `run` in class `java.lang.Thread`
  See Also:
    `Thread.run()`

### initGame

    protected void initGame(D_GameInfo initData)

  init the game

  Parameters:
    `initData` -

### recover

    protected void recover(D_RecoverData recoverData)

  recover a before safed game

  Parameters:
    `recoverData` -

### store

    protected void store(D_RecoverData dataStorage)

  saves a game

  Parameters:
    `dataStorage` -

### getGameInfo

    protected D_GameInfo getGameInfo()

  Returns:
    the actual gameInfo

### imergencyPause

    protected void imergencyPause()

  pauses/starts the actual player using deprecated methods! DO NOT USE IF YOU DO NOT REALLY NEED!!!

### kill

    protected void kill()

  stops all threads that are running in the game! DO NOT USE IF YOU DO NOT REALLY NEED!!!

### getInstance

    protected static M_GameEngine getInstance()

  prevents that more than one instance of the class exists in the program

  Returns:
    a new instance if it doesnt already exist, if so, it returns the old one

### destroyInstance

    protected static void destroyInstance(M_GameEngine engine)

  destroys the engine - instance to make it free for a new one.

  Parameters:
    `engine` -

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD