Difference between revisions of "Fusion"

From Robowiki
Jump to navigation Jump to search
m
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{Infobox Robot
 
{{Infobox Robot
 
| 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]]    = 480 bytes, microbot
+
| [[CodeSize]]    = 680 bytes, microbot
 
| license        = None, I don't care
 
| license        = None, I don't care
 
| isOneOnOne      = true
 
| isOneOnOne      = true
Line 21: 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 ==
Line 30: Line 31:
 
; 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 [[Multi-Mode]].
 
: 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 46: 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 56: 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]].
: Better onPaint() painting stuff. As of now, all it has is a line to the enemy.
+
: 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==
 
==Source Code==
 +
 +
This is the code for version 0.2.
  
 
<syntaxhighlight>
 
<syntaxhighlight>

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);
 
	}
}