universum.bi
Interface EntityInterface

All Known Subinterfaces:
BeingInterface

public interface EntityInterface

Interface between engine and entity.


Method Summary
 Location createLocation(java.lang.Object... args)
          Creates location in specific for the topology way, for example createLocation(2,1)
 float distance(Location one, Location another)
          Compute distance in some metrics, depending on current topology of space
 float entityCost(Entity me, java.lang.String entityKind)
          Return cost of particular entity kind.
 java.lang.Integer getId(Entity me)
          Gives unique integer id for entiry, to be used as a handle for it.
 Location getLocation(Entity me)
          Figure out current position of entity
 int getTurnsCount()
           
 int timeTillKilled(Entity me)
          Return approximate amount of time remaining till this entity will be killed by engine as hang.
 

Method Detail

getId

java.lang.Integer getId(Entity me)
Gives unique integer id for entiry, to be used as a handle for it. In debug version (-debug switch) id is sequential, otherwise there are random to prevent cheating.

Returns:
id

getLocation

Location getLocation(Entity me)
Figure out current position of entity

Returns:
location where entity is

distance

float distance(Location one,
               Location another)
Compute distance in some metrics, depending on current topology of space

Returns:
distance between 2 locations

getTurnsCount

int getTurnsCount()
Returns:
current turn number

timeTillKilled

int timeTillKilled(Entity me)
Return approximate amount of time remaining till this entity will be killed by engine as hang. This method gives you no real warranties, because of garbage collection and multithreaded nature of engine and should be used with great care. Typical creature turn must be much shorter than this, and only on rare occassions of long computations this function should be used.

Returns:
number of milliseconds, -1 if entity not currently executed

createLocation

Location createLocation(java.lang.Object... args)
Creates location in specific for the topology way, for example createLocation(2,1)

Returns:
newly created location
Throws:
java.lang.IllegalArgumentException - if argument set not suitable for current topology

entityCost

float entityCost(Entity me,
                 java.lang.String entityKind)
Return cost of particular entity kind. For contest there's no avaliable entitites, so it's only for future engine development.

Returns:
entity energy cost, or negative value if not available