Class BattleCompletedEvent

java.lang.Object
robocode.control.events.BattleEvent
robocode.control.events.BattleCompletedEvent

public class BattleCompletedEvent extends BattleEvent
A BattleCompletedEvent is sent to onBattleCompleted() when the battle is completed successfully and results are available. This event will not occur if the battle is terminated or aborted by the user before the battle is completed.
Since:
1.6.2
Author:
Pavel Savara (original), Flemming N. Larsen (contributor)
See Also:
  • Constructor Details

    • BattleCompletedEvent

      public BattleCompletedEvent(BattleRules battleRules, BattleResults[] results)
      Called by the game to create a new BattleCompletedEvent. Please don't use this constructor as it might change.
      Parameters:
      battleRules - the rules that was used in the battle.
      results - the indexed results of the battle. These are unsorted, but using robot indexes.
  • Method Details

    • getBattleRules

      public BattleRules getBattleRules()
      Returns the rules used in the battle.
      Returns:
      the rules used in the battle.
    • getSortedResults

      public BattleResults[] getSortedResults()
      Returns the battle results sorted on score. Note that the robot index cannot be used to determine the score with the sorted results.
      Returns:
      an array of sorted BattleResults, where the results with the bigger score are placed first in the list.
      See Also:
    • getIndexedResults

      public BattleResults[] getIndexedResults()
      Returns the battle results that can be used to determine the score for the individual robot based on the robot index.
      Returns:
      an array of indexed BattleResults, where each index matches an index of a specific robot.
      See Also: