[Home]AceSurf

Robo Home | Changes | Preferences | AllPages

Showing revision 8
This is my second nanobot, in an attempt to create a Nano Surfer , or NS as referred from here onwards.

Bot Name

AceSurf

Author

Aryary

Great, I want to try it. Where can I download it?

http://www.robocoderepository.com/BotDetail.jsp?id=3636

How competitive is it?

Not sure for now.

How does it move?

A combination of StopAndGo with additional stuff.

How does it fire?

Semi - Linear Targeting

How does it dodge bullets?

The choice is Yours, StopAndGo or WaveSurfing

How does the melee strategy differ from one-on-one strategy?

No Difference

How does it select a target to attack/avoid in melee?

It does?

What does it save between rounds and matches?

GFs being hit by enemy (between rounds).

Where did you get the name?

It is supposed to Surf, so I want it to surf as a Nano Well, Thus AceSurf.

Can I use your code?

Please Follow the RWCPL


package ary.nano;

import robocode.AdvancedRobot;
import robocode.HitByBulletEvent;
import robocode.HitWallEvent;
import robocode.ScannedRobotEvent;
import robocode.util.Utils;

public class AceSurf extends AdvancedRobot {

  private static double move = 100, enemyEnergy;
  private static int[] hit = new int[41]; //hit array to track where I am hit
  private static int gf = 0;

  public void run() {
    // helps targeting accuracy
	//setAdjustRadarForGunTurn(true);
    setAdjustGunForRobotTurn(true);
		
    turnRadarRightRadians(Double.POSITIVE_INFINITY); //turn Radar
  }
  
  public void onScannedRobot(ScannedRobotEvent e) {
	double reuse = 10000; //Ultimate variable
	setTurnRadarLeftRadians(getRadarTurnRemaining()); //Radar Lock
    //if enemy fired a bullet
	if (enemyEnergy > (enemyEnergy = e.getEnergy())) {
		gf = (int)((3*move*Math.random()))/20; //get GF
		for(int x = 40; x >= 0; x--) //loop through the array
			if(hit[x] < reuse) reuse = hit[x]; // get least dangerous one
		if(hit[gf+20] > reuse) move = -move; //if it is more dangerous than it, reverse
			
		//out.println(gf);
		setMaxVelocity(8); ///keep it 8 for consistency
		setAhead(3*move*Math.random()); //Move with whatever distance you deifned
    }
    // turn perpendicular with range control (approx not so close and not so far, I hope)
    setTurnRightRadians(Math.cos((reuse = e.getBearingRadians()) - 2000/10000));
	//semi - linear targeting (from the wiki)
	setTurnGunRightRadians(Utils.normalRelativeAngle((reuse += getHeadingRadians()) - getGunHeadingRadians() + 
	(e.getVelocity() * Math.sin(e.getHeadingRadians() - reuse) / 16.0)));
	setFire(2.5); //best firepower
  }
  public void onHitByBullet(HitByBulletEvent e){
	hit[gf+20]++; //log your gf hits
  }

  public void onHitWall(HitWallEvent e) {
    setAhead(move = -move); //kinda bad, but best so far.
  }
}

What's next for your robot?

better movement

Does it have any WhiteWhales?

The Neophyte series and Splinter perhaps. I don't have much space for my gun.

What other robot(s) is it based on?

The nano linear targeting, modified by me after using it.


Comments, questions, feedback:

Comments Please :D

Robo Home | Changes | Preferences | AllPages
Edit revision 8 of this page | View other revisions | View current revision
Edited March 26, 2008 10:35 EST by Jab (diff)
Search: