battlecode.common
Class Message

java.lang.Object
  extended by battlecode.common.Message
All Implemented Interfaces:
Cloneable

public final class Message
extends Object
implements Cloneable

A Message is an object that can be broadcast to other robots. You may freely assign arrays or null to an instance's fields, and when the Message is broadcast it is copied into the receiving robots' message queues. Message instances may be mutated and rebroadcast.

See the specs for more information about communication.


Field Summary
 int[] ints
          An array of ints to broadcast.
 MapLocation[] locations
          An array of MapLocations to broadcast.
 String[] strings
          An array of Strings to broadcast.
 
Constructor Summary
Message()
          Constructs an instance with a null value in each field.
 
Method Summary
 Object clone()
          
 double getFluxCost()
          Returns the cost in flux to broadcast the message.
 int getNumBytes()
          Returns the number of bytes in this message, which can be used to determine the cost of broadcasting it in energon.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ints

public int[] ints
An array of ints to broadcast.


strings

public String[] strings
An array of Strings to broadcast.


locations

public MapLocation[] locations
An array of MapLocations to broadcast.

Constructor Detail

Message

public Message()
Constructs an instance with a null value in each field.

Method Detail

getNumBytes

public int getNumBytes()
Returns the number of bytes in this message, which can be used to determine the cost of broadcasting it in energon.

Bytecode cost:
10

getFluxCost

public double getFluxCost()
Returns the cost in flux to broadcast the message.

Bytecode cost:
10

clone

public Object clone()

Overrides:
clone in class Object
Bytecode cost:
25