javabot
Class JBot

Package class diagram package JBot
java.lang.Object
  extended by javabot.JBot

public class JBot
extends Object

Based on DefCon JavaBot v0.9

Author:
Robin Baumgarten, Jimmy, Radek 'Black_Hand' Pibil

Nested Class Summary
static class JBot.EventData
           
static class JBot.FleetData
           
static class JBot.UnitData
           
 
Field Summary
static int EventCeasedFire
           
static int EventDestroyed
           
static int EventHit
           
static int EventNewVote
           
static int EventNukeLaunchSilo
           
static int EventNukeLaunchSub
           
static int EventPingCarrier
           
static int EventPingDetection
           
static int EventPingSub
           
static int EventSharedRadar
           
static int EventTeamRetractedVote
           
static int EventTeamVoted
           
static int EventUnceasedFire
           
static int EventUnsharedRadar
           
static int EventVoteFinishedNo
           
static int EventVoteFinishedYes
           
static int CHATCHANNEL_ALLIANCE
           
static int CHATCHANNEL_PUBLIC
           
static int CHATCHANNEL_SPECTATORS
           
static int NumObjectTypes
           
static int NumTerritories
           
static int STATE_AIRBASEBOMBERLAUNCH
           
static int STATE_AIRBASEFIGHTERLAUNCH
           
static int STATE_BATTLESHIPATTACK
           
static int STATE_BOMBERATTACK
           
static int STATE_BOMBERINQUEUE
           
static int STATE_BOMBERNUKE
           
static int STATE_CARRIERANTISUB
           
static int STATE_CARRIERBOMBERLAUNCH
           
static int STATE_CARRIERFIGHTERLAUNCH
           
static int STATE_FIGHTERATTACK
           
static int STATE_FIGHTERINQUEUE
           
static int STATE_NUKEDISARM
           
static int STATE_NUKEONTARGET
           
static int STATE_RADARACTIVE
           
static int STATE_SILOAIRDEFENSE
           
static int STATE_SILONUKE
           
static int STATE_SUBACTIVESONAR
           
static int STATE_SUBNUKE
           
static int STATE_SUBPASSIVESONAR
           
static int TerritoryAfrica
           
static int TerritoryEurope
           
static int TerritoryNorthAmerica
           
static int TerritoryRussia
           
static int TerritorySouthAmerica
           
static int TerritorySouthAsia
           
static int TypeAirBase
           
static int TypeBattleShip
           
static int TypeBomber
           
static int TypeCarrier
           
static int TypeCity
           
static int TypeExplosion
           
static int TypeFighter
           
static int TypeFleet
           
static int TypeGunshot
           
static int TypeInvalid
           
static int TypeNuke
           
static int TypeQueueItem
           
static int TypeRadarStation
           
static int TypeSaucer
           
static int TypeSilo
           
static int TypeSub
           
static int TypeTornado
           
static int VoteAbstain
           
static int VoteNo
           
static int VoteTypeInvalid
           
static int VoteTypeJoinAlliance
           
static int VoteTypeKickPlayer
           
static int VoteTypeLeaveAlliance
           
static int VoteUnknown
           
static int VoteYes
           
 
Constructor Summary
JBot()
           
 
Method Summary
static void addEvent(int _eventType, int _causeObjectId, int _targetObjectId, int _unitType, float _longitude, float _latitude)
           
static boolean DebugIsReplayingGame()
          True if the game is currently replayed (Timeline has been clicked).
static void DebugLog(String entry)
          Prints a line in the debug console in the specified color
static void DebugLog(String entry, int objectId)
          Prints a line in the debug console in the specified color.
static void DebugLog(String entry, int objectId, String tags)
          Prints a line in the debug console.
static void DebugLog(String entry, int objectId, String tags, int colorR, int colorG, int colorB)
          Prints a line in the debug console in the specified color.
static void DebugLog(String entry, int objectId, String tags, int colorR, int colorG, int colorB, int colorAlpha)
          Prints a line in the debug console in the specified color.
static int[] GetActionQueue(int unitId)
          Array of unitIds of currently queued actions, for example nukes in a silo or planes on a carrier
static List<JBot.FleetData> GetAllFleetData()
          Data about all visible fleets, contained in the struct fleetData (see enums).
static int GetAllianceId(int teamId)
          Id of alliance.
static List<JBot.UnitData> GetAllUnitData()
          Data about all visible units, contained in the struct unitData (see enums).
static int[] GetAllUnits()
          All visible unit ids.
static float[] GetBomberNukeTarget(int _unitId)
          Target of the nuke carried by given bomber.
static int[] GetCityIds()
          Array of City Ids.
static int GetCityPopulation(int cityId)
          Population (in millions)
static int GetCollateralDamage(int teamId)
          Sum of collateral damage deaths (deaths in own population) of the given team.
static int GetCurrentState(int unitId)
          State of unit, specified in enum STATE_*.
static int GetCurrentTargetId(int unitId)
          Current target id. -1 if no target is set or target is location.
static int GetDefcon()
          Current Defcon Stage, game starts with 5
static int GetDesiredGameSpeed(int teamId)
          Currently requested game speed of given team.
static float GetDistance(float longitude1, float latitude1, float longitude2, float latitude2)
          Distance in game between given coordinates.
static int GetEnemyKills(int teamId)
          Sum of enemy kills of the given team (for scoring).
static int GetFleetId(int unitId)
          Id of fleet of given unit.
static float[] GetFleetMemberOffset(int memberCount, int memberId)
          Offset of ship number memberId from center of fleet, given fleet has memberCount ships
static int[] GetFleetMembers(int _fleetId)
          Ids of ships in given fleet.
static int[] GetFleets(int teamId)
          Fleet ids of given team.
static int GetFriendlyDeaths(int teamId)
          Sum of friendly deaths (deaths in allied populations) of the given team.
static int GetGameSpeed()
          Current speed-up factor of the game over the real time passed.
static int GetGameTick()
          Amount of update cycles (ticks) passed since game start
static float GetGameTime()
          Current Game Time, measured in seconds.
static float GetLatitude(int id)
          Latitude of given unit, city, or event.
static float GetLongitude(int id)
          Longitude of given unit, city, or event.
static float[] GetMovementTargetLocation(int unitId)
          Current target location. (0,0) if no target location is set.
static int GetNukeSupply(int _unitId)
          Number of available nukes.
static int GetOptionValue(String name)
          Value of certain option
static int[] GetOwnFleets()
          Own fleet ids.
static int GetOwnTeamId()
          Own team id.
static int[] GetOwnUnits()
          All own unit ids.
static float GetRange(int unitId)
          Remaining range of unit.
static int GetRemainingPopulation(int teamId)
          Remaining population of given team
static int GetRemainingUnits(int typeId)
          Amount of remaining units of given type that can be placed.
static float GetSailDistance(float longitude1, float latitude1, float longitude2, float latitude2)
          Distance in game between given coordinates on sea (performs pathfinding).
static int GetStateCount(int unitId, int stateId)
          Number of activations of given state in given unit
static float GetStateTimer(int unitId)
          Time until current state is active.
static int[] GetSuccessfulCommands()
          CommandIds of all commands that have been executed in previous cycle.
static int GetTeamId(int id)
          Team Id of given unit.
static int[] GetTeamIds()
          List of Team Ids in the game.
static String GetTeamName(int teamId)
          Name of the given team.
static int[] GetTeamTerritories(int teamId)
          Territory Ids of territories that the given team owns.
static int GetTeamTerritoriesCount(int teamId)
          Number of territories for given team, usually 1.
static int[] GetTeamUnits(int teamId)
          All visible units of a given team.
static int GetTerritoryId(float longitude, float latitude)
          Territory Id of territory at given coordinates.
static int GetType(int id)
          Type of unit, event or team, specified in enum TYPE_*, EVENT_* or TEAM_TYPE_*.
static int GetUnitCredits()
          Credits available for placement (if in variable unit mode).
static int GetUnitValue(int _typeId)
          Value of given unit type (if in variable unit mode).
static float[] GetVelocity(int unitId)
          Movement direction of given unit, in longitude and latitude parts.
static float GetVictoryTimer()
          Time remaining in game, if victory timer was started.
static boolean initialise(String[][] _commandLineOptions)
           
static boolean IsBorder(float longitude, float latitude)
          True if given coordinates are on the border.
static boolean IsCeaseFire(int teamId1, int teamId2)
          True iff the first team is in cease fire mode with the second team.
static boolean IsRetaliating(int _unitId)
          True iff given unit is automatically retaliating an earlier attack.
static boolean IsSharingRadar(int teamId1, int teamId2)
          True iff the first team is sharing its radar with the second team.
static boolean IsValidPlacementLocation(float longitude, float latitude, int typeId)
          True iff given location is valid for placement of given type.
static boolean IsValidTerritory(int teamId, float longitude, float latitude, boolean seaArea)
          True if the given coordinates belong to the given Team.
static boolean IsVictoryTimerActive()
          True iff the victory-timer has been started
static boolean IsVisible(int _unitId, int _byTeamId)
          True iff given unit is visible to given team.
static void PlaceFleet(float longitude, float latitude, int[] shipTypes)
          Tries to place a given amount of battlecruisers, carriers and subs into a fleet at the given location.
static void PlaceStructure(int typeId, float longitude, float latitude)
          Tries to place a given structure to the given coordinates.
static void RequestAlliance(int allianceId)
          Sends requests to the alliance members to join alliance.
static void RequestCeaseFire(int teamId)
          Send request to cease fire with given team.
static void RequestGameSpeed(int requestedSpeedIdentifier)
          Send request to change game speed to given speed.
static void RequestShareRadar(int teamId)
          Send request to share radar with given team.
static void SendChatMessage(String chatMessage, int receiverId)
          Sends a chat message.
static void SendVote(int _voteId, int _vote)
          TODO: documentation?
static void SetActionTarget(int _unitId, int _targetUnitId, float _longitude, float _latitude)
          Set target location for given unit.
static void SetLandingTarget(int _unitId, int _targetUnitId)
          TODO: what's this?
static void SetMovementTarget(int unitId, float longitude, float latitude)
          TODO: do the movement?
static void SetState(int unitId, int stateId)
          Set state of given unit.
static boolean update()
           
static void WhiteboardClear()
          Clears the whiteboard.
static void WhiteboardDraw(float longitude1, float latitude1, float longitude2, float latitude2)
          Draws a line on the whiteboard.
static void WriteToConsole(String logLine)
          Outputs a string to console
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_AIRBASEFIGHTERLAUNCH

public static final int STATE_AIRBASEFIGHTERLAUNCH
See Also:
Constant Field Values

STATE_AIRBASEBOMBERLAUNCH

public static final int STATE_AIRBASEBOMBERLAUNCH
See Also:
Constant Field Values

STATE_BATTLESHIPATTACK

public static final int STATE_BATTLESHIPATTACK
See Also:
Constant Field Values

STATE_BOMBERATTACK

public static final int STATE_BOMBERATTACK
See Also:
Constant Field Values

STATE_BOMBERNUKE

public static final int STATE_BOMBERNUKE
See Also:
Constant Field Values

STATE_BOMBERINQUEUE

public static final int STATE_BOMBERINQUEUE
See Also:
Constant Field Values

STATE_CARRIERFIGHTERLAUNCH

public static final int STATE_CARRIERFIGHTERLAUNCH
See Also:
Constant Field Values

STATE_CARRIERBOMBERLAUNCH

public static final int STATE_CARRIERBOMBERLAUNCH
See Also:
Constant Field Values

STATE_CARRIERANTISUB

public static final int STATE_CARRIERANTISUB
See Also:
Constant Field Values

STATE_FIGHTERATTACK

public static final int STATE_FIGHTERATTACK
See Also:
Constant Field Values

STATE_FIGHTERINQUEUE

public static final int STATE_FIGHTERINQUEUE
See Also:
Constant Field Values

STATE_NUKEONTARGET

public static final int STATE_NUKEONTARGET
See Also:
Constant Field Values

STATE_NUKEDISARM

public static final int STATE_NUKEDISARM
See Also:
Constant Field Values

STATE_RADARACTIVE

public static final int STATE_RADARACTIVE
See Also:
Constant Field Values

STATE_SILONUKE

public static final int STATE_SILONUKE
See Also:
Constant Field Values

STATE_SILOAIRDEFENSE

public static final int STATE_SILOAIRDEFENSE
See Also:
Constant Field Values

STATE_SUBPASSIVESONAR

public static final int STATE_SUBPASSIVESONAR
See Also:
Constant Field Values

STATE_SUBACTIVESONAR

public static final int STATE_SUBACTIVESONAR
See Also:
Constant Field Values

STATE_SUBNUKE

public static final int STATE_SUBNUKE
See Also:
Constant Field Values

CHATCHANNEL_PUBLIC

public static final int CHATCHANNEL_PUBLIC
See Also:
Constant Field Values

CHATCHANNEL_ALLIANCE

public static final int CHATCHANNEL_ALLIANCE
See Also:
Constant Field Values

CHATCHANNEL_SPECTATORS

public static final int CHATCHANNEL_SPECTATORS
See Also:
Constant Field Values

TerritoryNorthAmerica

public static final int TerritoryNorthAmerica
See Also:
Constant Field Values

TerritorySouthAmerica

public static final int TerritorySouthAmerica
See Also:
Constant Field Values

TerritoryEurope

public static final int TerritoryEurope
See Also:
Constant Field Values

TerritoryRussia

public static final int TerritoryRussia
See Also:
Constant Field Values

TerritorySouthAsia

public static final int TerritorySouthAsia
See Also:
Constant Field Values

TerritoryAfrica

public static final int TerritoryAfrica
See Also:
Constant Field Values

NumTerritories

public static final int NumTerritories
See Also:
Constant Field Values

EventPingSub

public static final int EventPingSub
See Also:
Constant Field Values

EventPingCarrier

public static final int EventPingCarrier
See Also:
Constant Field Values

EventNukeLaunchSilo

public static final int EventNukeLaunchSilo
See Also:
Constant Field Values

EventNukeLaunchSub

public static final int EventNukeLaunchSub
See Also:
Constant Field Values

EventHit

public static final int EventHit
See Also:
Constant Field Values

EventDestroyed

public static final int EventDestroyed
See Also:
Constant Field Values

EventPingDetection

public static final int EventPingDetection
See Also:
Constant Field Values

EventCeasedFire

public static final int EventCeasedFire
See Also:
Constant Field Values

EventUnceasedFire

public static final int EventUnceasedFire
See Also:
Constant Field Values

EventSharedRadar

public static final int EventSharedRadar
See Also:
Constant Field Values

EventUnsharedRadar

public static final int EventUnsharedRadar
See Also:
Constant Field Values

EventNewVote

public static final int EventNewVote
See Also:
Constant Field Values

EventTeamVoted

public static final int EventTeamVoted
See Also:
Constant Field Values

EventTeamRetractedVote

public static final int EventTeamRetractedVote
See Also:
Constant Field Values

EventVoteFinishedYes

public static final int EventVoteFinishedYes
See Also:
Constant Field Values

EventVoteFinishedNo

public static final int EventVoteFinishedNo
See Also:
Constant Field Values

TypeInvalid

public static final int TypeInvalid
See Also:
Constant Field Values

TypeCity

public static final int TypeCity
See Also:
Constant Field Values

TypeSilo

public static final int TypeSilo
See Also:
Constant Field Values

TypeRadarStation

public static final int TypeRadarStation
See Also:
Constant Field Values

TypeNuke

public static final int TypeNuke
See Also:
Constant Field Values

TypeExplosion

public static final int TypeExplosion
See Also:
Constant Field Values

TypeSub

public static final int TypeSub
See Also:
Constant Field Values

TypeBattleShip

public static final int TypeBattleShip
See Also:
Constant Field Values

TypeAirBase

public static final int TypeAirBase
See Also:
Constant Field Values

TypeFighter

public static final int TypeFighter
See Also:
Constant Field Values

TypeBomber

public static final int TypeBomber
See Also:
Constant Field Values

TypeCarrier

public static final int TypeCarrier
See Also:
Constant Field Values

TypeTornado

public static final int TypeTornado
See Also:
Constant Field Values

TypeSaucer

public static final int TypeSaucer
See Also:
Constant Field Values

TypeFleet

public static final int TypeFleet
See Also:
Constant Field Values

TypeGunshot

public static final int TypeGunshot
See Also:
Constant Field Values

TypeQueueItem

public static final int TypeQueueItem
See Also:
Constant Field Values

NumObjectTypes

public static final int NumObjectTypes
See Also:
Constant Field Values

VoteTypeInvalid

public static final int VoteTypeInvalid
See Also:
Constant Field Values

VoteTypeJoinAlliance

public static final int VoteTypeJoinAlliance
See Also:
Constant Field Values

VoteTypeKickPlayer

public static final int VoteTypeKickPlayer
See Also:
Constant Field Values

VoteTypeLeaveAlliance

public static final int VoteTypeLeaveAlliance
See Also:
Constant Field Values

VoteUnknown

public static final int VoteUnknown
See Also:
Constant Field Values

VoteYes

public static final int VoteYes
See Also:
Constant Field Values

VoteNo

public static final int VoteNo
See Also:
Constant Field Values

VoteAbstain

public static final int VoteAbstain
See Also:
Constant Field Values
Constructor Detail

JBot

public JBot()
Method Detail

GetDefcon

public static int GetDefcon()
Current Defcon Stage, game starts with 5

Returns:
int Defcon stage

GetGameTime

public static float GetGameTime()
Current Game Time, measured in seconds. Each tick, the game progresses by 0.1 sec * GameSpeed

Returns:
game time

GetGameTick

public static int GetGameTick()
Amount of update cycles (ticks) passed since game start

Returns:
number of game ticks

GetGameSpeed

public static int GetGameSpeed()
Current speed-up factor of the game over the real time passed. Usually has values from 0 (paused), 1 (real time), 5, 10, 20, see enum GAMESPEED (GameSpeed class)

Returns:

GetVictoryTimer

public static float GetVictoryTimer()
Time remaining in game, if victory timer was started. Test this with IsVictoryTimerStarted

Returns:

IsVictoryTimerActive

public static boolean IsVictoryTimerActive()
True iff the victory-timer has been started

Returns:

GetOptionValue

public static int GetOptionValue(String name)
Value of certain option

Parameters:
name -
Returns:

GetCityIds

public static int[] GetCityIds()
Array of City Ids. The amount of cities does not change during a game.

Returns:

GetCityPopulation

public static int GetCityPopulation(int cityId)
Population (in millions)

Parameters:
cityId -
Returns:

GetRemainingPopulation

public static int GetRemainingPopulation(int teamId)
Remaining population of given team

Parameters:
teamId -
Returns:

IsValidTerritory

public static boolean IsValidTerritory(int teamId,
                                       float longitude,
                                       float latitude,
                                       boolean seaArea)
True if the given coordinates belong to the given Team. If seaArea is set to true, then Coordinates must be on sea area, otherwise land. If teamId = -1, then function returns if coordinates are land or sea terrain respectively. Note that there can be coordinates which are neither land nor sea

Parameters:
teamId -
longitude -
latitude -
seaArea -
Returns:

IsBorder

public static boolean IsBorder(float longitude,
                               float latitude)
True if given coordinates are on the border. Compare "data/earth/coastlines.bmp".

Parameters:
longitude -
latitude -
Returns:

GetTerritoryId

public static int GetTerritoryId(float longitude,
                                 float latitude)
Territory Id of territory at given coordinates.

Parameters:
longitude -
latitude -
Returns:

GetOwnTeamId

public static int GetOwnTeamId()
Own team id.

Returns:

GetTeamIds

public static int[] GetTeamIds()
List of Team Ids in the game.

Returns:

GetTeamTerritoriesCount

public static int GetTeamTerritoriesCount(int teamId)
Number of territories for given team, usually 1.


GetTeamTerritories

public static int[] GetTeamTerritories(int teamId)
Territory Ids of territories that the given team owns. The enum TERRITORY_* relates the ids to starting positions

Parameters:
teamId -
Returns:
territories belonging to the team

GetAllianceId

public static int GetAllianceId(int teamId)
Id of alliance. Each team belongs to exactly one alliance.

Parameters:
teamId -
Returns:

GetDesiredGameSpeed

public static int GetDesiredGameSpeed(int teamId)
Currently requested game speed of given team.

Parameters:
teamId -
Returns:

GetEnemyKills

public static int GetEnemyKills(int teamId)
Sum of enemy kills of the given team (for scoring).

Parameters:
teamId -
Returns:

GetFriendlyDeaths

public static int GetFriendlyDeaths(int teamId)
Sum of friendly deaths (deaths in allied populations) of the given team.

Parameters:
teamId -
Returns:

GetCollateralDamage

public static int GetCollateralDamage(int teamId)
Sum of collateral damage deaths (deaths in own population) of the given team.

Parameters:
teamId -
Returns:

GetTeamName

public static String GetTeamName(int teamId)
Name of the given team.

Parameters:
teamId -
Returns:

IsSharingRadar

public static boolean IsSharingRadar(int teamId1,
                                     int teamId2)
True iff the first team is sharing its radar with the second team.

Parameters:
teamId1 -
teamId2 -
Returns:

IsCeaseFire

public static boolean IsCeaseFire(int teamId1,
                                  int teamId2)
True iff the first team is in cease fire mode with the second team.

Parameters:
teamId1 -
teamId2 -
Returns:

RequestAlliance

public static void RequestAlliance(int allianceId)
Sends requests to the alliance members to join alliance. Replies are handled by the event system.

Parameters:
allianceId -

RequestCeaseFire

public static void RequestCeaseFire(int teamId)
Send request to cease fire with given team.

Parameters:
teamId -

RequestShareRadar

public static void RequestShareRadar(int teamId)
Send request to share radar with given team.

Parameters:
teamId -

RequestGameSpeed

public static void RequestGameSpeed(int requestedSpeedIdentifier)
Send request to change game speed to given speed. Must be one of the values specified in GAMESPEED.

Parameters:
requestedSpeedIdentifier -

GetAllUnits

public static int[] GetAllUnits()
All visible unit ids.

Returns:

GetOwnUnits

public static int[] GetOwnUnits()
All own unit ids.

Returns:

GetTeamUnits

public static int[] GetTeamUnits(int teamId)
All visible units of a given team.

Parameters:
teamId -
Returns:

GetType

public static int GetType(int id)
Type of unit, event or team, specified in enum TYPE_*, EVENT_* or TEAM_TYPE_*.

Parameters:
id -
Returns:

GetTeamId

public static int GetTeamId(int id)
Team Id of given unit.

Parameters:
id -
Returns:

GetOwnFleets

public static int[] GetOwnFleets()
Own fleet ids.

Returns:

GetFleets

public static int[] GetFleets(int teamId)
Fleet ids of given team. Only fleets ids with visible members are returned.

Parameters:
teamId -
Returns:

GetFleetMembers

public static int[] GetFleetMembers(int _fleetId)
Ids of ships in given fleet.

Parameters:
_fleetId -
Returns:

GetFleetId

public static int GetFleetId(int unitId)
Id of fleet of given unit.

Parameters:
unitId -
Returns:

GetCurrentState

public static int GetCurrentState(int unitId)
State of unit, specified in enum STATE_*.

Parameters:
unitId -
Returns:

GetStateCount

public static int GetStateCount(int unitId,
                                int stateId)
Number of activations of given state in given unit

Parameters:
unitId -
stateId -
Returns:

GetStateTimer

public static float GetStateTimer(int unitId)
Time until current state is active.

Parameters:
unitId -
Returns:

GetActionQueue

public static int[] GetActionQueue(int unitId)
Array of unitIds of currently queued actions, for example nukes in a silo or planes on a carrier

Parameters:
unitId -
Returns:

GetCurrentTargetId

public static int GetCurrentTargetId(int unitId)
Current target id. -1 if no target is set or target is location. If track of target is lost, the last known location is used instead

Parameters:
unitId -
Returns:

GetMovementTargetLocation

public static float[] GetMovementTargetLocation(int unitId)
Current target location. (0,0) if no target location is set.

Parameters:
unitId -
Returns:

GetNukeSupply

public static int GetNukeSupply(int _unitId)
Number of available nukes.

Parameters:
_unitId -
Returns:

GetBomberNukeTarget

public static float[] GetBomberNukeTarget(int _unitId)
Target of the nuke carried by given bomber.

Parameters:
_unitId -
Returns:

IsRetaliating

public static boolean IsRetaliating(int _unitId)
True iff given unit is automatically retaliating an earlier attack.

Parameters:
_unitId -
Returns:

IsVisible

public static boolean IsVisible(int _unitId,
                                int _byTeamId)
True iff given unit is visible to given team. In full information mode, visibility information about other teams is available. In limited information mode, only visible units are accessible.

Parameters:
_unitId -
_byTeamId -
Returns:

SetState

public static void SetState(int unitId,
                            int stateId)
Set state of given unit. See STATE_*

Parameters:
unitId -
stateId -

SetMovementTarget

public static void SetMovementTarget(int unitId,
                                     float longitude,
                                     float latitude)
TODO: do the movement? same as SetTargetLocation?

Parameters:
unitId -
longitude -
latitude -

SetActionTarget

public static void SetActionTarget(int _unitId,
                                   int _targetUnitId,
                                   float _longitude,
                                   float _latitude)
Set target location for given unit. If target id is also given, the id overrides the location. TODO: different name in documentation SetTargetLocation(unitId, longitude, latitude) ? TODO: also should be used for SetTargetId() (missing...)

Parameters:
_unitId -
_targetUnitId -
_longitude -
_latitude -

SetLandingTarget

public static void SetLandingTarget(int _unitId,
                                    int _targetUnitId)
TODO: what's this?

Parameters:
_unitId -
_targetUnitId -

GetLongitude

public static float GetLongitude(int id)
Longitude of given unit, city, or event.

Parameters:
id -
Returns:

GetLatitude

public static float GetLatitude(int id)
Latitude of given unit, city, or event.

Parameters:
id -
Returns:

GetVelocity

public static float[] GetVelocity(int unitId)
Movement direction of given unit, in longitude and latitude parts. The vector has the length of the unit speed (see also SPEED_*).

Parameters:
unitId -
Returns:

GetRange

public static float GetRange(int unitId)
Remaining range of unit. If unlimited, -1 is returned.

Parameters:
unitId -
Returns:

GetRemainingUnits

public static int GetRemainingUnits(int typeId)
Amount of remaining units of given type that can be placed.

Parameters:
typeId -
Returns:

IsValidPlacementLocation

public static boolean IsValidPlacementLocation(float longitude,
                                               float latitude,
                                               int typeId)
True iff given location is valid for placement of given type. For fleets use getFleetMemberOffset to get offset from fleet center.

Parameters:
longitude -
latitude -
typeId -
Returns:

GetFleetMemberOffset

public static float[] GetFleetMemberOffset(int memberCount,
                                           int memberId)
Offset of ship number memberId from center of fleet, given fleet has memberCount ships

Parameters:
memberCount -
memberId -
Returns:

PlaceStructure

public static void PlaceStructure(int typeId,
                                  float longitude,
                                  float latitude)
Tries to place a given structure to the given coordinates. Use IsValidStructureLocation to test if valid.

Parameters:
typeId -
longitude -
latitude -

PlaceFleet

public static void PlaceFleet(float longitude,
                              float latitude,
                              int[] shipTypes)
Tries to place a given amount of battlecruisers, carriers and subs into a fleet at the given location. Use IsValidFleedLocation to test.

Parameters:
longitude -
latitude -
typeShip1 -

GetUnitCredits

public static int GetUnitCredits()
Credits available for placement (if in variable unit mode).

Returns:

GetUnitValue

public static int GetUnitValue(int _typeId)
Value of given unit type (if in variable unit mode).

Parameters:
_typeId -
Returns:

SendVote

public static void SendVote(int _voteId,
                            int _vote)
TODO: documentation?

Parameters:
_voteId -
_vote -

SendChatMessage

public static void SendChatMessage(String chatMessage,
                                   int receiverId)
Sends a chat message. TODO: documentation for second param?

Parameters:
chatMessage -
receiverId -

GetDistance

public static float GetDistance(float longitude1,
                                float latitude1,
                                float longitude2,
                                float latitude2)
Distance in game between given coordinates.

Parameters:
longitude1 -
latitude1 -
longitude2 -
latitude2 -
Returns:

GetSailDistance

public static float GetSailDistance(float longitude1,
                                    float latitude1,
                                    float longitude2,
                                    float latitude2)
Distance in game between given coordinates on sea (performs pathfinding).

Parameters:
longitude1 -
latitude1 -
longitude2 -
latitude2 -
Returns:

DebugLog

public static void DebugLog(String entry)
Prints a line in the debug console in the specified color

Parameters:
entry -

DebugLog

public static void DebugLog(String entry,
                            int objectId)
Prints a line in the debug console in the specified color.

Parameters:
entry -
objectId -

DebugLog

public static void DebugLog(String entry,
                            int objectId,
                            String tags)
Prints a line in the debug console. TODO: param tags? objectId?

Parameters:
entry -
objectId -
tags -

DebugLog

public static void DebugLog(String entry,
                            int objectId,
                            String tags,
                            int colorR,
                            int colorG,
                            int colorB)
Prints a line in the debug console in the specified color.

Parameters:
entry -
objectId -
tags -
colorR -
colorG -
colorB -

DebugLog

public static void DebugLog(String entry,
                            int objectId,
                            String tags,
                            int colorR,
                            int colorG,
                            int colorB,
                            int colorAlpha)
Prints a line in the debug console in the specified color.

Parameters:
entry -
objectId -
tags -
colorR -
colorG -
colorB -
colorAlpha -

DebugIsReplayingGame

public static boolean DebugIsReplayingGame()
True if the game is currently replayed (Timeline has been clicked). TODO: e.g. game has been paused?

Returns:

WhiteboardDraw

public static void WhiteboardDraw(float longitude1,
                                  float latitude1,
                                  float longitude2,
                                  float latitude2)
Draws a line on the whiteboard.

Parameters:
longitude1 -
latitude1 -
longitude2 -
latitude2 -

WhiteboardClear

public static void WhiteboardClear()
Clears the whiteboard.


GetSuccessfulCommands

public static int[] GetSuccessfulCommands()
CommandIds of all commands that have been executed in previous cycle.

Returns:

WriteToConsole

public static void WriteToConsole(String logLine)
Outputs a string to console

Parameters:
logLine -

GetAllUnitData

public static List<JBot.UnitData> GetAllUnitData()
Data about all visible units, contained in the struct unitData (see enums). This function is for convenience only, as all data can be gathered through other functions, too.

Parse the unit data into a proper object array.

Returns:

GetAllFleetData

public static List<JBot.FleetData> GetAllFleetData()
Data about all visible fleets, contained in the struct fleetData (see enums). This function is for convenience only, as all data can be gathered through other functions, too.

Parse the unit data into a proper object array.

Returns:

update

public static boolean update()

initialise

public static boolean initialise(String[][] _commandLineOptions)

addEvent

public static void addEvent(int _eventType,
                            int _causeObjectId,
                            int _targetObjectId,
                            int _unitType,
                            float _longitude,
                            float _latitude)


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.