Difference between revisions of "User:BenHorner/Calculations"

From Robowiki
Jump to navigation Jump to search
(change a couple of details, thanks to Rednaxela)
m (fixing)
 
(3 intermediate revisions by the same user not shown)
Line 62: Line 62:
 
----
 
----
 
=== Anatomy of a turn ===
 
=== Anatomy of a turn ===
this is from [[http://robocode.sourceforge.net/help/ The Robocode Help]]
+
this is from [[http://robowiki.net/w/index.php?title=Robocode/Game_Physics The Game Physics Page]]
 
(altered so that everything happens with the same time value)
 
(altered so that everything happens with the same time value)
 
----
 
----
Line 70: Line 70:
 
*** BulletHitEvent data collected
 
*** BulletHitEvent data collected
 
** robots move
 
** robots move
*** bullets are fired (energy is charged for firing)
+
*** bullets are fired, energy is charged for firing
*** adjust heading
+
*** adjust heading (gun, then radar, then body)
*** adjust acceleration
+
*** determine acceleration
 
*** adjust velocity
 
*** adjust velocity
 
*** adjust position
 
*** adjust position
 +
*** gun cools
 
** ScannedRobotEvent data collected
 
** ScannedRobotEvent data collected
 
** events are fired in priority order using previously collected data
 
** 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)
+
** robots execute their run() method until their thread is blocked (through taking action, or time out)
 
----
 
----
 
----
 
----

Latest revision as of 06:42, 5 March 2021


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 Game Physics Page] (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 (gun, then radar, then body)
      • determine acceleration
      • adjust velocity
      • adjust position
      • gun cools
    • ScannedRobotEvent data collected
    • events are fired in priority order using previously collected data
    • robots execute their run() method until their thread is blocked (through taking 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)