Difference between revisions of "User:BenHorner/Calculations"

From Robowiki
Jump to navigation Jump to search
(copied this info from my page on the old wiki)
 
m (cleaned up syntax a bit)
Line 1: Line 1:
 
----
 
----
=== ## Units of measure ===
+
=== Units of measure ===
 
these are the units I use throughout this page
 
these are the units I use throughout this page
 
----
 
----
Line 13: Line 13:
 
----
 
----
 
----
 
----
=== ## Movement and Combat ===
+
=== Movement and Combat ===
 
all of this is taken from the [[http://robocode.sourceforge.net/help/robocode.faq.txt Robocode FAQ]] it's just condensed here for my easy use.
 
all of this is taken from the [[http://robocode.sourceforge.net/help/robocode.faq.txt Robocode FAQ]] it's just condensed here for my easy use.
 
----
 
----
Line 49: Line 49:
 
----
 
----
 
----
 
----
=== ## Scoring ===
+
=== Scoring ===
 
this part is from [[http://robocode.sourceforge.net/help/scoring/scoring.html The Robocode Help]]
 
this part is from [[http://robocode.sourceforge.net/help/scoring/scoring.html The Robocode Help]]
 
----
 
----
Line 61: Line 61:
 
----
 
----
 
----
 
----
=== ## Anatomy of a turn ===
+
=== Anatomy of a turn ===
 
this is from [[http://robocode.sourceforge.net/help/ The Robocode Help]]
 
this is from [[http://robocode.sourceforge.net/help/ The Robocode Help]]
 
(altered so that everything happens with the same time value)
 
(altered so that everything happens with the same time value)

Revision as of 03:43, 23 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: (cycled so that everything happens with the same time value)

  • time is incremented
  • bullets move and check for collisions
  • robots move
    • adjust heading
    • adjust acceleration
    • adjust velocity
    • adjust position
  • scans are made
  • robots execute their code 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)