Difference between revisions of "Thread:Talk:Barracuda Challenge/Is your robot suppose to fire?"

From Robowiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 18: Line 18:
 
double angleToEnemy = e.getBearingRadians() + status.getHeadingRadians();
 
double angleToEnemy = e.getBearingRadians() + status.getHeadingRadians();
 
double toTurn = Utils.normalRelativeAngle(angleToEnemy - status.getGunHeadingRadians());
 
double toTurn = Utils.normalRelativeAngle(angleToEnemy - status.getGunHeadingRadians());
if(toTurn <= 0.001) {
+
if(peer.getGunHeat() == 0 && Math.abs(toTurn) <= 0.1 && !firedOnce) {
if(!firedOnce) {
+
setFire(0.1);
setFire(0.1);
+
firedOnce = true;
firedOnce = true;
 
}
 
 
}
 
}
 
setTurnGun(toTurn);
 
setTurnGun(toTurn);
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 01:35, 25 November 2012

That is the question, since when my robot doesn't fire... Barracuda doesn't ever move, and it gets a 100% over 1000 rounds without fail (that is 60k to 0 score wise).

If I fire head on at power 3 (with very low toTurn fire bias). I get only around 98.6%. Using a specially designed two shot gun, its score hits 91.4% (once to get it moving, second time to put it out of its misery, both power 0.1). This is because the robot sticks around longer and has more energy to lose.

Since this is move of a movement "challenge" then a "how much your gun makes up for your movement" challenge. I am inclined to go with the latter score myself.

//My Two-shot Gun (No License, use as you like)
public boolean firedOnce = false;
public boolean mercyShot = false;

public void onScannedRobot(ScannedRobotEvent e) {
	if(e.getEnergy() <= 0.0001 && !mercyShot) {
		firedOnce = false;
		mercyShot = true;
	}

	double angleToEnemy = e.getBearingRadians() + status.getHeadingRadians();
	double toTurn = Utils.normalRelativeAngle(angleToEnemy - status.getGunHeadingRadians());
	if(peer.getGunHeat() == 0 && Math.abs(toTurn) <= 0.1 && !firedOnce) {
		setFire(0.1);
		firedOnce = true;
	}
	setTurnGun(toTurn);
}