Class games.Battle.shared.comm.TurnDiff
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class games.Battle.shared.comm.TurnDiff

java.lang.Object
   |
   +----games.Battle.shared.comm.BattlePacket
           |
           +----games.Battle.shared.comm.TurnDiff

public class TurnDiff
extends BattlePacket
A TurnDiff is a delta of the game board sent to every player on every "iteration" of the game. It only contains the differences in the game board that are the result of this turn to help keep transmission costs to a minimum.

Variable Index

 o GAMEOVER
GAMEOVER is the used to say hasta la vista, baby.
 o NORMAL
NORMAL is the usual tag placed on a turndiff.
 o board
the board.
 o player
the player whose point of view this turndiff is from.

Constructor Index

 o TurnDiff(Board, int)
Constructor which indicates which game board this TurnDiff is going to be reading/writing to, and which player in the game the diff is being constructed for.
 o TurnDiff(Board, int, byte)
Constructor which indicates which game board this TurnDiff is going to be reading/writing to, and which player in the game the diff is being constructed for.

Method Index

 o asciiDump(byte[])
Debugging output
 o fromBytes(byte[])
Build a turn diff based on the data inside the given array of bytes
 o getTag()
return the tag associated with this turn diff.
 o makeBytes()
Produce an array of bytes representing the turn diff.
 o toBytes()
return the bytes for the turn diff.

Variables

 o board
  protected Board board
the board.
 o player
  protected int player
the player whose point of view this turndiff is from.
 o NORMAL
  public final static byte NORMAL
NORMAL is the usual tag placed on a turndiff.
 o GAMEOVER
  public final static byte GAMEOVER
GAMEOVER is the used to say hasta la vista, baby.

Constructors

 o TurnDiff
  public TurnDiff(Board board,
                  int player)
Constructor which indicates which game board this TurnDiff is going to be reading/writing to, and which player in the game the diff is being constructed for.
Parameters:
board - the board the turn diff is representing
the - player the turn diff is representing
 o TurnDiff
  public TurnDiff(Board board,
                  int player,
                  byte tag)
Constructor which indicates which game board this TurnDiff is going to be reading/writing to, and which player in the game the diff is being constructed for. Also takes a tag, so that the server can indicate game over.
Parameters:
board - the board the turn diff is representing
player - the player the turn diff is representing
tag - the tag for game over or not

Methods

 o getTag
  public final byte getTag()
return the tag associated with this turn diff.
 o makeBytes
  public void makeBytes()
Produce an array of bytes representing the turn diff.
 o toBytes
  public byte[] toBytes()
return the bytes for the turn diff.
Overrides:
toBytes in class BattlePacket
 o fromBytes
  public void fromBytes(byte array[])
Build a turn diff based on the data inside the given array of bytes
Parameters:
array - the array of bytes
Overrides:
fromBytes in class BattlePacket
 o asciiDump
  public void asciiDump(byte array[])
Debugging output

All Packages  Class Hierarchy  This Package  Previous  Next  Index