User talk:AW/virtualWaves

From Robowiki
< User talk:AW
Revision as of 03:34, 6 September 2012 by Voidious (talk | contribs) (calculating virtuality)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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)