[Home]EnergyDropSurfing

Robo Home | Changes | Preferences | AllPages

Showing revision 7
Change movement(direction, speed, etc.) when EnergyDrop detected. Effective and efficient in NanoBots.

Related topic


Sample code:
//lateralAngle is class's member variable. ( static double lateralAngle; )

		if (enemyEnergy > (enemyEnergy = e.getEnergy())) {
			lateralAngle *= -1.0;
			setMaxVelocity(4.0 + Math.random() * 8.0);
		}
		setAhead(lateralAngle * 100.0);

stelo.MirrorNano 1.2 uses this method.

-- Stelokim


You should take a look at FunkyChicken - I think it manages to do something like this in even less code =) -- Voidious

Thanks for good information. You mean the commented old code?

//The old "Perceptual bullet-dodger" code:
//setAhead(Math.tan(e.getEnergy()*5)*500);
-- Stelokim

Yes, that's probably it. I actually hadn't checked the code recently, just read about it a lot on the wiki, and knew it was something like that. -- Voidious


Robo Home | Changes | Preferences | AllPages
Edit revision 7 of this page | View other revisions | View current revision
Edited October 18, 2006 17:33 EST by Stelokim (diff)
Search: