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.world
Class C_World

    java.lang.Object
      de.farafin.snEADy.world.C_World

All Implemented Interfaces:
  I_Constants, I_PlayFieldConstants, I_RecordConstants, I_World_interface

    public final class C_World

extends java.lang.Object
implements I_World_interface, I_Constants, I_PlayFieldConstants, I_RecordConstants

this class contains all calculations of the play field. If something moves or runns against a wall, in world its the place where its calculated.

Version:
  $Revision: 1.44 $
Author:
  roland, lars

Field Summary
`private C_Arena` | `arena` arena of the game
`private long` | `lastSDTime` only one segment per cycle
`private long` | `nextGoodyTime` next time a goody occures
`private GameParameter` | `parameter` parameter set of GameParameter
`private java.util.Random` | `randGoody` computes the kind of goody than should placed
`private java.util.Random` | `randNextGoodyTime` computes the next time a goody occures
`private byte[]` | `recBuffer` the computed bytes for the record
`private long` | `recExitTime` comparing exit time for records
`private D_Level` | `recLevel` comparing level for records
`private D_PlayerData[]` | `recPlayerData` comparing player data for records:
`private long` | `recSDTime` comparing sd time for records

Fields inherited from interface de.farafin.snEADy.communication.I_Constants
`analyse_ms, auto_grow_delay, auto_slowdown_delay, autogamespeed, closemonitor, damage_length_grow, damage_points_radius, DEBUG, delplayer, easy_points, ejectreplay, emergencyPause, exit_time, FACE_EAST, FACE_NORTH, FACE_SOUTH, FACE_WEST, game_end, 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, loaddummy, loadhuman, loadlevel, loadplayer, loadscript, logging, max_goody_occ_delay, MAX_HUMAN_PLAYERS, max_mem_check_delay, max_move_delay, max_player_mem, MAX_PLAYERS, max_thinking_ms, memkill, min_cycle_ms, min_move_delay, MOVE_EAST, MOVE_NORTH, MOVE_SOUTH, MOVE_WEST, openmonitor, overalldelay, pause, player_controlling, print_calc_ms, print_parameter, print_player_mem, print_playfield, quit, record, recordname, replay, replay_reverse, replay_stepwidth, replay_stepwise, run, set, show_subcycles, start, stop, suddend_time, survival_points, timekill, tolerance_ms, TURN_LEFT, TURN_NONE, TURN_RIGHT`

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_LAST, GOODY_m, GOODY_n, GOODY_o, GOODY_p, GOODY_q, GOODY_r, GOODY_s, GOODY_START, 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`

Fields inherited from interface de.farafin.snEADy.inOut.I_RecordConstants
`byte_E, byte_EX, byte_H, byte_LE, byte_N, byte_P0, byte_P1, byte_P2, byte_P3, byte_P4, byte_P5, byte_P6, byte_P7, byte_P8, byte_P9, byte_PF, byte_PO, byte_S, byte_SP, byte_ST, byte_W`

Constructor Summary
`C_World(D_GameInfo gameInfo, GameParameter parameter)` constructor

Method Summary
`D_Level` | `generateLevel()`
`private void` | `placeGoody(D_GameInfo gameInfo)` sets a new goody and estimates the next goody time
`void` | `recordGameCycle(D_GameInfo gameInfo)` computes the record of a game cycle (level + player => recordFile) WARNING there are no control routines if the numbers fit to its range because we do not expact that this could happen in teh game.
`boolean` | `replayGameCycle(D_GameInfo gameInfo, D_PlayerData[] playerData)` computes the replay of a game cycle (replayFile => level + player)
`boolean` | `replayGameCycle1011(D_GameInfo gameInfo, D_PlayerData[] playerData)` replay vis snEADy version 1.011
`boolean` | `replayGameCycle1012(D_GameInfo gameInfo, D_PlayerData[] playerData)` replay vis snEADy version 1.012
`void` | `update(D_GameInfo gameInfo)` calculate the new playfield with the informations in gameInfo stores the changed data in gameInfo
`void` | `updateInfos(D_GameInfo gameInfo)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### arena

    private final C_Arena arena

  arena of the game

### nextGoodyTime

    private long nextGoodyTime

  next time a goody occures

### randNextGoodyTime

    private java.util.Random randNextGoodyTime

  computes the next time a goody occures

### randGoody

    private java.util.Random randGoody

  computes the kind of goody than should placed

### parameter

    private final GameParameter parameter

  parameter set of GameParameter

### lastSDTime

    private long lastSDTime

  only one segment per cycle

### recPlayerData

    private D_PlayerData[] recPlayerData

  comparing player data for records:

  See Also:
    `C_LogFileWriter`, `C_LogFileReader`, `D_PlayerData`

### recLevel

    private D_Level recLevel

  comparing level for records

### recExitTime

    private long recExitTime

  comparing exit time for records

### recSDTime

    private long recSDTime

  comparing sd time for records

### recBuffer

    private byte[] recBuffer

  the computed bytes for the record

Constructor Detail

### C_World

    public C_World(D_GameInfo gameInfo,
                   GameParameter parameter)

  constructor

  Parameters:
    `gameInfo` -
    `parameter` -

Method Detail

### placeGoody

    private void placeGoody(D_GameInfo gameInfo)

  sets a new goody and estimates the next goody time

  Parameters:
    `gameInfo` -

### recordGameCycle

    public void recordGameCycle(D_GameInfo gameInfo)

  Description copied from interface: `I_World_interface`
  computes the record of a game cycle (level + player => recordFile) WARNING there are no control routines if the numbers fit to its range because we do not expact that this could happen in teh game. If there are later modifications, we strongly recommand to analyse the new game and maybe change the replay/record functions!! reads a record file:
  file scheme:
  for each gameCycle:
  what is stored (consumtion)
  - Number bytes (2Byte) (number range: 0x0000 to 0xFFFF)
  - Player Nr and status changes (1 Byte)
  = Data: (first 4 bit) (number range: 0x10 to 0xF0)
  case: 0 - 9 : representation of player number
  + speed changed? (5. bit)
  + length changed? (6. bit)
  + Points changed? (7. bit)
  + Status changed? (8. bit)
  case: A: play field changes case: B: gameTime and SDTime changes case: C - F: not used - Nnumber of playfield changes (2Byte) (number range: 0x0000 to 0xFFFF)
  - relative Playfield changes (3 Byte each)
  y-value (number range: 0x00 to 0xFF)
  x-value (number range: 0x00 to 0xFF)
  relative char changes: excample: 'a' - '.' (number range: -0x80 to +0x7F)
  - playerdata (max 7 Byte)
  = speed changes (1 Byte) [only if change bit is 1] (number range: -0x80 to +0x7F)
  + Length changes (2 Byte) [only if change bit is 1] (number range: -0x8000 to +0x7FFF)
  + points changes (2 Byte) [only if change bit is 1] (number range: -0x8000 to +0x7FFF)
  + Status changes (1 Byte) [only if change bit is 1] (number range: -0x80 to +0x7F)
  + head move direction (1 Byte) (number range: 0x00 to 0xFF)
  - if player Nr == 11: Exit Time changes (4 Byte) (number range: -0x80000000 to +0x7FFFFFFF) + SDTime changes (4 Byte) (number range: -0x80000000 to +0x7FFFFFFF) = 17 Byte
  - Number bytes again (2Byte) (number range: 0x0000 to 0xFFFF)

  Specified by:
    `recordGameCycle` in interface `I_World_interface`

### replayGameCycle

    public boolean replayGameCycle(D_GameInfo gameInfo,
                                   D_PlayerData[] playerData)

  Description copied from interface: `I_World_interface`
  computes the replay of a game cycle (replayFile => level + player)

  Specified by:
    `replayGameCycle` in interface `I_World_interface`
  Returns:
    returns true if EOF has reached.
  See Also:
    `I_World_interface.updateInfos(de.farafin.snEADy.communication.D_GameInfo)`

### replayGameCycle1011

    public boolean replayGameCycle1011(D_GameInfo gameInfo,
                                       D_PlayerData[] playerData)

  replay vis snEADy version 1.011

  Parameters:
    `gameInfo` -
    `playerData` -
  Returns:

### replayGameCycle1012

    public boolean replayGameCycle1012(D_GameInfo gameInfo,
                                       D_PlayerData[] playerData)

  replay vis snEADy version 1.012

  Parameters:
    `gameInfo` -
    `playerData` -
  Returns:

### update

    public void update(D_GameInfo gameInfo)

  Description copied from interface: `I_World_interface`
  calculate the new playfield with the informations in gameInfo stores the changed data in gameInfo

  Specified by:
    `update` in interface `I_World_interface`

### generateLevel

    public D_Level generateLevel()

  Specified by:
    `generateLevel` in interface `I_World_interface`
  Returns:
    a copy of the contained Level

### updateInfos

    public void updateInfos(D_GameInfo gameInfo)

  Specified by:
    `updateInfos` in interface `I_World_interface`
  Parameters:
    `gameInfo` - a instance the informations should be filled in

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