[Home]DustBunny

Robo Home | Changes | Preferences | AllPages

My NanoBots Anti-gravity bot. The new version saved enough space in the anti-gravity code to add a simple reduced linear aim over distance gun, simple lock onto closest target code, and some fire/energy control. This bots does very well against more advanced robots, but gets beat by the best of the Melee NanoBots. Still, this bot is very strong for what it is.

Just finishing version 2.1. Improved wall avoidance, better movement, and better energy control. I'll upload tomorrow. Kinda fun to watch it wander around :) - Mike

---

Behold, DustBunny 3.0 in all its Anti-grav glory.

public class DustBunny extends AdvancedRobot {

	static final double GUN_FACTOR = 50;

	static double xForce;
	static double yForce;
	static String	lastTarget;
	static double	lastDistance;

	public void run() 
	{
		// do this to hit stationary targets
		setAdjustGunForRobotTurn(true);

		// Reset range finder
		lastDistance = Double.POSITIVE_INFINITY;

		// Do infinite radar.  Saves much space (thanks Dr. Loco!)
		turnRadarRightRadians?(Double.POSITIVE_INFINITY);
	}

	public void onScannedRobot(ScannedRobotEvent e) 
	{
		// Get Abs bearing for aiming routines (and A-Grav)
		// and distance for just about everything else :)
		double	absoluteBearing = e.getBearingRadians?() + getHeadingRadians();
		double  distance = e.getDistance();

		// Use a very simple running average system.  /2 is as cheap as I can get this
		xForce = xForce *.9 - Math.sin(absoluteBearing) / distance;
		yForce = yForce *.9 - Math.cos(absoluteBearing) / distance;

		// Get our turn angle - factor in distance from each wall every time so we get
		// pushed towards the center when close to the walls.  This took a long time to come up with.
		setTurnRightRadians?(Utils.normalRelativeAngle(
			Math.atan2(xForce + 1/getX() - 1/(getBattleFieldWidth?() - getX()), 
					   yForce + 1/getY() - 1/(getBattleFieldHeight?() - getY()))
						- getHeadingRadians()) );

		// Move ahead!  
		setAhead(Double.POSITIVE_INFINITY);

		// If we need to turn hard, slow down
		setMaxVelocity?( 420 / getTurnRemaining?() );

		// If we're at 0 and pointed at a target, fire.
		if(getGunHeat() == 0)
		{
			//  Use some energy smarts and reset distance targeting
			setFireBullet(getEnergy() * GUN_FACTOR / distance);
			lastDistance = Double.POSITIVE_INFINITY;
		}

		// Lock onto closest bots																
		if(lastDistance > distance)
		{
			lastDistance = distance;
			lastTarget = e.getName();
		}

		// and only the closest bot
		if(lastTarget == e.getName())
		{
			// Radar lock as we approach shooting time
			if(getGunHeat() < 1)
			{
				// Let this var be equal the the absolute bearing now...
				// and set the radar.
				setTurnRadarLeft(getRadarTurnRemaining?());
			}

			// Aim directly at target.
			setTurnGunRightRadians?(Utils.normalRelativeAngle(absoluteBearing - getGunHeadingRadians?()));
		}
	}
}

The update makes this bot a melee and 1v1 contender again. It can actually beat Dr.Bob 1v1 (and Moebius for that matter). --Miked0801

Although the jar is versioned as 3.0, in the properties it says 2.0. Therefor RR@Home says 'Downloaded file is wrong or corrupted'. Welcome back btw, Moebius was for quite a while in my testbed. -- GrubbmGait

Strange. I'll check it out. BTW, 3.1 is uploaded now. I'll see if it has the same issues. --Miked0801

Same story with 3.1. Did you package it with 1.0.6? That is what the properties file says. In Robocode itself it is listed as mld.DustBunny 2.0, but the filename is mld.[DustBunny 3]?.1.jar. Maybe you should remove/rename the properties file and re-package it completely. -- GrubbmGait

(Edit Conflict) Same issue with 3.1 - the DustBunny.properties file says 2.0. Are you using Robocode to package it? I took a sec to rezip it into a 3.1b if you want to update its RR entries: [mld.DustBunny_3.1b.jar] -- Voidious

Yes, I'm using Robocode to package it up. It was modified from 2.0, but I changed it to 3.1 in the packaging dialog. If you could upload it for me correctly, I would greatly appreciate it. If you could tell me why it isn't working, that would be better yet :) --Miked0801

Wait! That version you have named 3.1b is based from Dustbunny 3.0! If you could modify it from my version 3.1, that would be even better. 3.1 is MUCH better than 3.0. --Miked0801

Actually, upon further investigation, it is based on DustBunny 2.0! :) The RobocodeRepository page still sends 2.0 when you hit "Download": https://www.robocoderepository.com/BotDetail.jsp?id=833 ... RoboRumble must be renaming this to _3.1 because that's the bot's name in the listing. Did you upload the new one to the repository? Anyway, if you need me to host it, you can e-mail it to me (ContactInfo) and I can post it to the rumble once I upload it. -- Voidious

Bot ID Now correctly listed in the participants pages :) --Miked0801 PS, I just found another 7 bytes to play with. I'll stew on that for a few days :)


Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited September 28, 2007 2:48 EST by Miked0801 (diff)
Search: