Difference between revisions of "User:BenHorner/Calculations"

From Robowiki
Jump to navigation Jump to search
m (cleaned up syntax a bit)
(change a couple of details, thanks to Rednaxela)
Line 65: Line 65:
 
(altered so that everything happens with the same time value)
 
(altered so that everything happens with the same time value)
 
----
 
----
each turn these things happen in order:
+
* each turn these things happen in order:
(cycled so that everything happens with the same time value)
+
** time is incremented
* time is incremented
+
** bullets move and check for collisions
* bullets move and check for collisions
+
*** BulletHitEvent data collected
* robots move
+
** robots move
** adjust heading
+
*** bullets are fired (energy is charged for firing)
** adjust acceleration
+
*** adjust heading
** adjust velocity
+
*** adjust acceleration
** adjust position
+
*** adjust velocity
* scans are made
+
*** adjust position
* robots execute their code until their thread is blocked (through action, or time out)
+
** ScannedRobotEvent data collected
 +
** events are fired in priority order using previously collected data
 +
** robots execute their run() method until their thread is blocked (through action, or time out)
 
----
 
----
 
----
 
----

Revision as of 04:19, 29 May 2009


Units of measure

these are the units I use throughout this page


  • time is measured in (t)urns (getTurn())
  • distance is measured in (p)ixels
  • angles are measured in (d)egrees or (r)adians
  • compound units
    • movement speed is measured in p/t (ppt)
    • rotational speed is measured in d/t (dpt) or r/t (rpt)
    • movement acceleration is measured in ppt/t (pptpt)
    • there is no automatic rotational acceleration


Movement and Combat

all of this is taken from the [Robocode FAQ] it's just condensed here for my easy use.


  • movement values determined in this order:
    • heading
      • max robot turn rate is 10 - 0.75 * getVelocity() dpt
    • acceleration
      • accelerating: 1 pptpt
      • decelerating: 2 pptpt
    • velocity
      • max velocity is 8 ppt
    • position

  • combat
    • tracking
      • radar turn rate is 45 dpt
    • targeting
      • gun turn rate is 20 dpt
    • ramming (what counts as "moving towards" when hit?)
      • both robots lose 0.6 energy
      • ram-er gain 1.2 score points
    • hitting the wall
      • AdvancedRobots lose energy max(abs(velocity) / 2 - 1, 0);
    • firing bullets
      • 0.1 <= bullet power (bp) <= 3.0
      • firing drains bp energy from firer
      • if (bp <= 1) struck robot loses 4 * bp energy
      • if (bp > 1) struck robot loses 6 * bp - 2 energy
      • firer gains 3 * bp energy when bullet hits
      • bullet speed is 20 - 3 * bp
      • gun heat (gh)
        • bullets cannot be fired when gh > 0
        • gh increases 1 + (bp / 5) when a bullet is fired
        • gh drops 0.1/turn (by default, can be changed in interface)


Scoring

this part is from [The Robocode Help]


  • the battle score is the sum of these:
    • survival score, 50 points for every robot that died before you
      • bonus: if you're last, 10 additional points for each robot that died
    • bullet damage, total amount of damage inflicted (including ramming?)
      • bonus: if you kill an enemy, 20% of the damage you did to that enemy
    • ram damage, 2 time the total amount of damage inflicted by ramming
      • bonus: if you kill an enemy by ramming, 30% of the damage you did to that enemy


Anatomy of a turn

this is from [The Robocode Help] (altered so that everything happens with the same time value)


  • each turn these things happen in order:
    • time is incremented
    • bullets move and check for collisions
      • BulletHitEvent data collected
    • robots move
      • bullets are fired (energy is charged for firing)
      • adjust heading
      • adjust acceleration
      • adjust velocity
      • adjust position
    • ScannedRobotEvent data collected
    • events are fired in priority order using previously collected data
    • robots execute their run() method until their thread is blocked (through action, or time out)


calculations:

maximize: bppt = bp / ((1+(bp/5))/(cool rate))

              = bp * (cool rate) / ((5+bp)/5)
              = 5 * bp * (cool rate) / (5 + bp)