Difference between revisions of "User talk:AW/virtualWaves"

From Robowiki
Jump to navigation Jump to search
(Talk page autocreated when first thread was posted.)
 
(calculating virtuality)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 +
So, I was trying to debug my virtuality attribute and I am stuck on something.  I test gunTurnRemaining < threshold before firing, and I don't see how I can know that on the previous turn.  However, I think I need to fire my firing wave the turn before it really is fired because the data gathered for that turn is the data I use for aiming.  Is there any way to get the virtuality attribute perfect?  Here is the code I currently have:
 +
<code><syntaxhighlight>
 +
double virtuality;
 +
virtuality = (ticksSinceFire + 1) * ourRobot.getGunCoolingRate() / 3.0;
 +
double gunHeat = Math.max(0.0,
 +
ourRobot.getGunHeat() - ourRobot.getGunCoolingRate());
 +
if (gunHeat < (ticksSinceFire + 1) * ourRobot.getGunCoolingRate()) {
 +
if (ourRobot.getEnergy() > 0.11 || _isTC) {
 +
System.out.print("Using GunHeat  " + ourRobot.getGunHeat() + "  " + (ticksSinceFire + 1) + "  ");
 +
virtuality = gunHeat / 3.0;
 +
lastBulletPower = nextBulletPower;
 +
}
 +
}
 +
double bulletPower = lastBulletPower;
 +
</syntaxhighlight></code>
 +
I don't fire if I have less than 0.11 energy left, I think I want ticks since fire and gun heat to be for the next turn since that is when the bullet would be fired.  This is also important for my latest perfectionistic change of using the bullet power (or estimated bullet power) for the closest real wave for my virtual waves.
  
 +
: I just update last tick's wave (data from last tick, fire time this tick) with the current gun heat and last bullet fired time every tick. Keep in mind that whenever you're aiming, you should use virtuality = 0, not the current virtuality, since it will be 0 when you actually fire. So it doesn't really matter if you adjust it later. Also, if you want virtuality to be a value between 0 and 1, I'd divide by 0.8 (halfway to gun heat for a max power bullet) instead of by 3.0, and then cap it at 1. --[[User:Voidious|Voidious]] 02:34, 6 September 2012 (UTC)

Latest revision as of 04:34, 6 September 2012

So, I was trying to debug my virtuality attribute and I am stuck on something. I test gunTurnRemaining < threshold before firing, and I don't see how I can know that on the previous turn. However, I think I need to fire my firing wave the turn before it really is fired because the data gathered for that turn is the data I use for aiming. Is there any way to get the virtuality attribute perfect? Here is the code I currently have:

		double virtuality;
		virtuality = (ticksSinceFire + 1) * ourRobot.getGunCoolingRate() / 3.0;
		double gunHeat = Math.max(0.0,
				ourRobot.getGunHeat() - ourRobot.getGunCoolingRate());
		if (gunHeat < (ticksSinceFire + 1) * ourRobot.getGunCoolingRate()) {
			if (ourRobot.getEnergy() > 0.11 || _isTC) {
				System.out.print("Using GunHeat   " + ourRobot.getGunHeat() + "   " + (ticksSinceFire + 1) + "   ");
				virtuality = gunHeat / 3.0;
				lastBulletPower = nextBulletPower;
			}
		}
		double bulletPower = lastBulletPower;

I don't fire if I have less than 0.11 energy left, I think I want ticks since fire and gun heat to be for the next turn since that is when the bullet would be fired. This is also important for my latest perfectionistic change of using the bullet power (or estimated bullet power) for the closest real wave for my virtual waves.

I just update last tick's wave (data from last tick, fire time this tick) with the current gun heat and last bullet fired time every tick. Keep in mind that whenever you're aiming, you should use virtuality = 0, not the current virtuality, since it will be 0 when you actually fire. So it doesn't really matter if you adjust it later. Also, if you want virtuality to be a value between 0 and 1, I'd divide by 0.8 (halfway to gun heat for a max power bullet) instead of by 3.0, and then cap it at 1. --Voidious 02:34, 6 September 2012 (UTC)