Difference between revisions of "Fusion"

From Robowiki
Jump to navigation Jump to search
(Created page with "{{Infobox Robot | image = data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQPEhAQDxQUFhUVEhYYFxUQFxQSEhUYFx0WFxcUFhgYHCggGRolHhUXIz0hJS03MS4uFyAzODYsNygt...")
 
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{Infobox Robot
 
{{Infobox Robot
| image          = data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQPEhAQDxQUFhUVEhYYFxUQFxQSEhUYFx0WFxcUFhgYHCggGRolHhUXIz0hJS03MS4uFyAzODYsNygtLisBCgoKDg0OGxAQGzcmICY3LywsLzc0LSwuLCwxLzQsLCssLDctMTcsLDA3NCwwNis3Li8sLywsLzQvLCwuLCwsLP/AABEIAMoA+QMBIgACEQEDEQH/xAAcAAEAAgIDAQAAAAAAAAAAAAAABQcGCAIDBAH/xABBEAABAwICBgcFBQcDBQAAAAABAAIDBBESIQUGFTFU0RMiQVFhcZMyNHSBsgczUpGhFCNCYnKSsVNjwRaCwvDx/8QAGgEBAAIDAQAAAAAAAAAAAAAAAAIFAQMEBv/EACsRAQACAgEDAwIFBQAAAAAAAAABAgMRBBIhMRNBUQXRIjJhobEVQoGR8P/aAAwDAQACEQMRAD8AtHQGhKY0tKTTwEmniJJijJJLW57lIbCpuGg9KPkvmrvutJ8PF9DVIoI/YVNw0HpR8k2FTcNB6UfJSCII/YVNw0HpR8k2FTcNB6UfJSCII/YVNw0HpR8k2FTcNB6UfJSCII/YVNw0HpR8k2FTcNB6UfJSCII/YVNw0HpR8k2FTcNB6UfJSCII/YVNw0HpR8k2FTcNB6UfJSCII/YVNw0HpR8k2FTcNB6UfJSCII/YVNw0HpR8k2FTcNB6UfJSCII/YVNw0HpR8k2FTcNB6UfJSCII/YVNw0HpR8k2FTcNB6UfJSCII/YVNw0HpR8k2FTcNB6UfJSCII/YVNw0HpR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yRUbt2q4mf1ZOabdquJn9WTmgvJa+qQ27VcTP6snNV7+2yf6j/AO53NB//2Q==
 
 
| name            = Fusion
 
| name            = Fusion
| author          = [[BeastBots]]
+
| author          = [[User:BeastBots101|BeastBots]]
 
| extends        = [[AdvancedRobot]]
 
| extends        = [[AdvancedRobot]]
 
| targeting      = [[linear targeting]]
 
| targeting      = [[linear targeting]]
| movement        = [[Multi mode]] [[ramming movement]]
+
| movement        = [[Multi-Mode]] [[:Category:Movement|Ramming Movement]]
 
| current_version = 0.2
 
| current_version = 0.2
 +
| [[CodeSize]]    = 680 bytes, microbot
 
| license        = None, I don't care
 
| license        = None, I don't care
 
| isOneOnOne      = true
 
| isOneOnOne      = true
 
| isMelee        = false
 
| isMelee        = false
| isOpenSource    = true
 
 
}}
 
}}
  
Line 22: Line 21:
  
 
; What's special about it?
 
; What's special about it?
: It's a micro rambot [[multimode]] that I made.
+
: It's a micro rambot [[Multi-Mode]] that I made.
  
 
; How competitive is it?
 
; How competitive is it?
: Not sure. I tested a bit on [[Impact]] and actually did okay.
+
: Not sure. I tested a bit on [[Impact]] and actually did okay. [[SuperRamFire]] was a bit pesky though.
 +
: Sep. 20; Not such a great success. Place 780.
  
 
== Strategy ==
 
== Strategy ==
  
 
; How does it [[:Category:Movement|move]]?
 
; How does it [[:Category:Movement|move]]?
: It has two forms of movement, one used for the first five rounds and the other for the rest, making it a [[multimode]].
+
: It has two forms of movement, one used for the first five rounds and the other for the rest, making it a [[Multi-Mode]].
: Drive: Go at the enemy robot with linear movement aim. Sometimes results in accidental [[:Category:Movement|mirror movement]].
+
: '''Drive''': Go at the enemy robot with linear movement aim. Sometimes results in accidental [[:Category:Movement|mirror movement]].
: Dodge: Like stop and go but goes back and forth and gradually gets closer to the enemy. Better on some bots.
+
: '''Dodge''': Like stop and go but goes back and forth and gradually gets closer to the enemy. Better on bots with unsegmented [[:Category:Targeting|linear targeting]] or [[:Category:Targeting|circular targeting]].
  
 
; How does it [[:Category:Targeting|fire]]?
 
; How does it [[:Category:Targeting|fire]]?
: Simple linear targeting from the wiki page. In the 'Drive' mode, it does not follow its bullets, the movement is like linear targeting but the rules.getBulletSpeed(bulletPower) is replaced with getVelocity().
+
: Simple linear targeting from the wiki page. In the 'Drive' mode, it does not follow its bullets, the movement is like linear targeting but the rules.getBulletSpeed(bulletPower) is replaced with getVelocity(). Maybe should get rid of it.
: Future gun: a new(tell me if I'm wrong) form of statistical targeting where the enemy velocity and turnrate is averaged and used to predict where it will move.
 
  
 
; How does it [[Dodging Bullets|dodge bullets]]?
 
; How does it [[Dodging Bullets|dodge bullets]]?
Line 47: Line 46:
 
; What does it save between rounds and matches?
 
; What does it save between rounds and matches?
 
: Currently nothing intentionally, but the future gun will save the average velocity  between round with static long, int, and double methods.
 
: Currently nothing intentionally, but the future gun will save the average velocity  between round with static long, int, and double methods.
 +
  
 
== Additional Information ==
 
== Additional Information ==
 +
  
 
; Where did you get the name?
 
; Where did you get the name?
Line 57: Line 58:
  
 
; What's next for your robot?
 
; What's next for your robot?
: The Avg. velocity gun. Nobody steal it(unless you created it before me yourself)!
+
: A movement tactic to spiral around the enemy getting closer over time, like in [[SuperRamFire]].
 +
: Linear painting
  
 
; Does it have any [[White Whale|White Whales]]?
 
; Does it have any [[White Whale|White Whales]]?
Line 66: Line 68:
 
: [[DodgeBot]] from the secrets from robocode masters site for the Dodging movement.
 
: [[DodgeBot]] from the secrets from robocode masters site for the Dodging movement.
 
: [[RamFire]] and [[SuperRamFire]] for the idea of rambots.
 
: [[RamFire]] and [[SuperRamFire]] for the idea of rambots.
 +
 +
 +
==Source Code==
 +
 +
This is the code for version 0.2.
 +
 +
<syntaxhighlight>
 +
package EH;
 +
import robocode.*;
 +
 +
import java.awt.Color;
 +
import java.awt.Graphics2D;
 +
import robocode.util.Utils;
 +
import static robocode.util.Utils.normalRelativeAngle;
 +
import static java.lang.Math.asin;
 +
import static java.lang.Math.sin;
 +
 +
public class Fusion extends AdvancedRobot
 +
{
 +
//for direct ramming movement
 +
int dir=1;
 +
//for paint stuff
 +
int scannedX = Integer.MIN_VALUE;
 +
int scannedY = Integer.MIN_VALUE;
 +
//for evasion attack movement
 +
double previousEnergy = 100;
 +
    int movementDirection = 1;
 +
 +
public void run() {
 +
 +
setColors(Color.gray,Color.lightGray,Color.yellow);
 +
setAdjustGunForRobotTurn(true);
 +
setAdjustRadarForGunTurn(true);
 +
 +
while(true){
 +
 +
turnRadarRightRadians(1);
 +
 +
}
 +
}
 +
 +
/**
 +
* onScannedRobot: What to do when you see another robot
 +
*/
 +
public void onScannedRobot(ScannedRobotEvent e) {
 +
 +
    // paint stuff- see graphical debugging page on robowiki
 +
//for more
 +
   
 +
    double angle = Math.toRadians((getHeading() + e.getBearing()) % 360);
 +
 +
    // Calculate the coordinates of the robot
 +
    scannedX = (int)(getX() + Math.sin(angle) * e.getDistance());
 +
    scannedY = (int)(getY() + Math.cos(angle) * e.getDistance());
 +
//gun and radar
 +
double enemyAbsB=
 +
e.getBearingRadians()+getHeadingRadians();
 +
 +
setTurnRadarRightRadians
 +
(Utils.normalRelativeAngle
 +
(enemyAbsB - getRadarHeadingRadians()) );
 +
 +
double bulletPower = 3;
 +
    double headOnBearing = getHeadingRadians() + e.getBearingRadians();
 +
    double linearBearing = headOnBearing + Math.asin(e.getVelocity() / Rules.getBulletSpeed(bulletPower) * Math.sin(e.getHeadingRadians() - headOnBearing));
 +
    setTurnGunRightRadians(Utils.normalRelativeAngle(linearBearing - getGunHeadingRadians()));
 +
    setFire(bulletPower);
 +
 +
//turn to enemy
 +
if (getRoundNum() <= 5) {
 +
double headOnTurn =
 +
  getHeadingRadians() + e.getBearingRadians();
 +
 +
double linearTurn=
 +
  headOnTurn + asin(e.getVelocity() / getVelocity() * sin(e.getHeadingRadians() - headOnTurn));
 +
    setTurnRightRadians(normalRelativeAngle(linearTurn - getHeadingRadians()));
 +
setAhead(Double.POSITIVE_INFINITY*dir);
 +
}
 +
if (getRoundNum() >5) {
 +
setTurnRightRadians(e.getBearing()+90-40*movementDirection);
 +
double changeInEnergy = previousEnergy-e.getEnergy();
 +
 +
if (changeInEnergy>0 && changeInEnergy<=3) {
 +
movementDirection=-movementDirection;
 +
setAhead((e.getDistance()/4+25)*movementDirection);
 +
}
 +
previousEnergy=e.getEnergy();
 +
}
 +
 +
}
 +
 +
public void onHitByBullet(HitByBulletEvent e) {
 +
}
 +
 +
public void onHitWall(HitWallEvent e) {
 +
//move in the opposite direction
 +
dir=-dir;
 +
}
 +
public void onHitRobot(HitRobotEvent e) {
 +
//turn gun directly at enemy
 +
double absB =
 +
getHeadingRadians() + e.getBearingRadians();
 +
setTurnGunRightRadians(
 +
normalRelativeAngle(absB-getGunHeading()));
 +
setAhead(10);
 +
}
 +
public void onBulletHit(BulletHitEvent e) {
 +
setFire(.1);
 +
}
 +
public void onPaint(Graphics2D g) {
 +
    g.setColor(Color.yellow);
 +
 +
    g.drawLine(scannedX, scannedY, (int)getX(), (int)getY());
 +
 +
    g.fillOval(scannedX - 5, scannedY - 5, 10, 10);
 +
 +
}
 +
}
 +
</syntaxhighlight>
  
 
[[Category:MicroBots]]
 
[[Category:MicroBots]]

Latest revision as of 03:21, 8 October 2013

Fusion
Author(s) BeastBots
Extends AdvancedRobot
Targeting linear targeting
Movement Multi-Mode Ramming Movement
Current Version 0.2
Code License None, I don't care

Background Information

Author
BeastBots, also known as beastbots101 or EH
Extends
AdvancedRobot
What's special about it?
It's a micro rambot Multi-Mode that I made.
How competitive is it?
Not sure. I tested a bit on Impact and actually did okay. SuperRamFire was a bit pesky though.
Sep. 20; Not such a great success. Place 780.

Strategy

How does it move?
It has two forms of movement, one used for the first five rounds and the other for the rest, making it a Multi-Mode.
Drive: Go at the enemy robot with linear movement aim. Sometimes results in accidental mirror movement.
Dodge: Like stop and go but goes back and forth and gradually gets closer to the enemy. Better on bots with unsegmented linear targeting or circular targeting.
How does it fire?
Simple linear targeting from the wiki page. In the 'Drive' mode, it does not follow its bullets, the movement is like linear targeting but the rules.getBulletSpeed(bulletPower) is replaced with getVelocity(). Maybe should get rid of it.
How does it dodge bullets?
Drive method: no dodging at all. Goes straight at the enemy.
Dodge method: reacts to bullets, but not to effectively, mainly to get closer
How does the melee strategy differ from one-on-one strategy?
I doubt rambots will do well in melee battles. Maybe I'm wrong. If so, then I'll get a way to select the closest or slowest target.
What does it save between rounds and matches?
Currently nothing intentionally, but the future gun will save the average velocity between round with static long, int, and double methods.


Additional Information

Where did you get the name?
Rambots collide with the enemy, hence the name Fusion.
Can I use your code?
Yes, I don't care really what you do, just don't make a total copy and change the colors or name(or something really minor). It's the same code license as my NanoBot NightBird.
What's next for your robot?
A movement tactic to spiral around the enemy getting closer over time, like in SuperRamFire.
Linear painting
Does it have any White Whales?
Nothing really. But maybe I'll find out.
What other robot(s) is it based on?
Impact for the basic movement structure, some of the code
DodgeBot from the secrets from robocode masters site for the Dodging movement.
RamFire and SuperRamFire for the idea of rambots.


Source Code

This is the code for version 0.2.

package EH;
import robocode.*;

import java.awt.Color;
import java.awt.Graphics2D;
import robocode.util.Utils;
import static robocode.util.Utils.normalRelativeAngle;
import static java.lang.Math.asin;
import static java.lang.Math.sin;

public class Fusion extends AdvancedRobot
{
	//for direct ramming movement
	int dir=1;
	//for paint stuff
 	int scannedX = Integer.MIN_VALUE;
 	int scannedY = Integer.MIN_VALUE;
	//for evasion attack movement
	double previousEnergy = 100;
    int movementDirection = 1;
	
	public void run() {
		
		setColors(Color.gray,Color.lightGray,Color.yellow);
		setAdjustGunForRobotTurn(true);
		setAdjustRadarForGunTurn(true);
		
		while(true){
			
		turnRadarRightRadians(1);
		
		}
	}

	/**
	 * onScannedRobot: What to do when you see another robot
	 */
	public void onScannedRobot(ScannedRobotEvent e) {
 
     // paint stuff- see graphical debugging page on robowiki
	 //for more
     
     double angle = Math.toRadians((getHeading() + e.getBearing()) % 360);
 
     // Calculate the coordinates of the robot
     scannedX = (int)(getX() + Math.sin(angle) * e.getDistance());
     scannedY = (int)(getY() + Math.cos(angle) * e.getDistance());
	 	//gun and radar
		double enemyAbsB=
		e.getBearingRadians()+getHeadingRadians();
		
		setTurnRadarRightRadians
		(Utils.normalRelativeAngle
		(enemyAbsB - getRadarHeadingRadians()) );
		
		double bulletPower = 3;
    double headOnBearing = getHeadingRadians() + e.getBearingRadians();
    double linearBearing = headOnBearing + Math.asin(e.getVelocity() / Rules.getBulletSpeed(bulletPower) * Math.sin(e.getHeadingRadians() - headOnBearing));
    setTurnGunRightRadians(Utils.normalRelativeAngle(linearBearing - getGunHeadingRadians()));
    setFire(bulletPower);
		
		//turn to enemy
		if (getRoundNum() <= 5) {
		double headOnTurn = 
			   getHeadingRadians() + e.getBearingRadians();
		
		double linearTurn=
			   headOnTurn + asin(e.getVelocity() / getVelocity() * sin(e.getHeadingRadians() - headOnTurn));
	    setTurnRightRadians(normalRelativeAngle(linearTurn - getHeadingRadians()));
		setAhead(Double.POSITIVE_INFINITY*dir);
		}
		if (getRoundNum() >5) {
			setTurnRightRadians(e.getBearing()+90-40*movementDirection);
			double changeInEnergy = previousEnergy-e.getEnergy();
		
			if (changeInEnergy>0 && changeInEnergy<=3) {
				movementDirection=-movementDirection;
				setAhead((e.getDistance()/4+25)*movementDirection);
			}
			previousEnergy=e.getEnergy();
		}
		
	}
	
	public void onHitByBullet(HitByBulletEvent e) {
	}
	
	public void onHitWall(HitWallEvent e) {
		//move in the opposite direction
		dir=-dir;
	}	
	public void onHitRobot(HitRobotEvent e) {
		//turn gun directly at enemy
		double absB =
			getHeadingRadians() + e.getBearingRadians();
		setTurnGunRightRadians(
			normalRelativeAngle(absB-getGunHeading()));
		setAhead(10);
	}
	public void onBulletHit(BulletHitEvent e) {
		setFire(.1);
	}
	public void onPaint(Graphics2D g) {
     g.setColor(Color.yellow);
 
     g.drawLine(scannedX, scannedY, (int)getX(), (int)getY());
 
     g.fillOval(scannedX - 5, scannedY - 5, 10, 10);
 
	}
}