Difference between revisions of "Talk:CalculatingScore"

From Robowiki
Jump to navigation Jump to search
(Is it possible to calculate the score for an AdvancedRobot?)
 
m (Using <syntaxhighlight>.)
 
Line 1: Line 1:
 
Is it possible to calculate the score for an AdvancedRobot? I'm having problems with the HitRobotEvent
 
Is it possible to calculate the score for an AdvancedRobot? I'm having problems with the HitRobotEvent
  
<pre>
+
<syntaxhighlight>
 
public void onHitRobot(HitRobotEvent e) {
 
public void onHitRobot(HitRobotEvent e) {
 
   ramDamage[e.isMyFault() ? 0 : 1] += robocode.Rules.ROBOT_HIT_DAMAGE;
 
   ramDamage[e.isMyFault() ? 0 : 1] += robocode.Rules.ROBOT_HIT_DAMAGE;
 
}
 
}
</pre>
+
</syntaxhighlight>
  
 
When isMyFault=false the enemy doesn't always get points for it. For instance a RamBot against SittingDuck.
 
When isMyFault=false the enemy doesn't always get points for it. For instance a RamBot against SittingDuck.
 
The underDevelopment class is here [[Talk:CalculatingScore/ScoreWithRamming]]
 
The underDevelopment class is here [[Talk:CalculatingScore/ScoreWithRamming]]

Latest revision as of 09:33, 1 July 2010

Is it possible to calculate the score for an AdvancedRobot? I'm having problems with the HitRobotEvent

public void onHitRobot(HitRobotEvent e) {
   ramDamage[e.isMyFault() ? 0 : 1] += robocode.Rules.ROBOT_HIT_DAMAGE;
}

When isMyFault=false the enemy doesn't always get points for it. For instance a RamBot against SittingDuck. The underDevelopment class is here Talk:CalculatingScore/ScoreWithRamming