[Home]VelocityTrick

Robo Home | Changes | Preferences | AllPages

An experiment by Xero to see if velocity changes messed up guns. The code from part of Python's run() method is here. This code is changed from the original Python run method to be more pluggable.
 do {
            doScanner();
			velocityChange++;
			if(velocityChange >= 100) {
				velocityChange = 0;
				double maxVel=Math.random()*9+3;
				if(maxVel > 8) {
					maxVel = 7.49;
				}
				out.println("Max velocity:" + maxVel);
				setMaxVelocity?(maxVel);
			}
                        //etc.
                     while(true);

Well, you'll never end up reaching that maxVel < .4 part because the < .5 condition covers that. I've found it a lot better to just do maxVel=Math.random()*12+3; (12 because I've found it better to have the bot spend more time at full speed and 3 because you never set the speed below that in your code.) -- Alcatraz


Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited May 3, 2006 21:23 EST by Xero (diff)
Search: