Blue Shift

From Robowiki
Revision as of 22:59, 30 July 2009 by DBall (talk | contribs)
Jump to navigation Jump to search

Named after the Doppler Effect

It is the same as BulletDoubling (Old Wiki)

Blue Shift.JPG

The picture to the right shows a group of waves clustered together.

How it Works

Fire a group of bullets that reach your target at the same time, either by moving the robot, changing bullet power, or a combination of both.


Concept

Use only on stationary targets (shows concept when farther away).



package wiki;

import robocode.*;

public class BlueShift extends AdvancedRobot

{

double turns;

double time;

public void run()

{

setTurnRadarRightRadians(Double.POSITIVE_INFINITY);

}

public void onScannedRobot(ScannedRobotEvent e)

{

double absoluteBearing = e.getBearingRadians() + getHeadingRadians();

double distance = e.getDistance();

setTurnRightRadians(robocode.util.Utils.normalRelativeAngle(absoluteBearing - getGunHeadingRadians()));

turns -= getTime() - time;

time = getTime();

if (turns <= 0)

{

time = getTime();

turns = distance / 11;

setFire(3);

}

else

{

setFire((distance / turns - 20) / -3);

}

}

}



This is just a theory I had after viewing the Waves article. Please comment, add code, or expand this article.