User:Starrynte/Melee Evaluator

From Robowiki
< User:Starrynte
Revision as of 03:08, 14 September 2009 by Starrynte (talk | contribs) (Created page with 'A utility that provides stats on your bot's performance in melee battles (currently only supports AdvancedRobot and battles with an even number of bots, and even then the standar…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A utility that provides stats on your bot's performance in melee battles (currently only supports AdvancedRobot and battles with an even number of bots, and even then the standard 10 bots a battle is recommended).

How to Use

1. Copy the code here and paste it into a new class called MeleeEvaluate 2. Change the package to your's and compile the code

3. Add this to your bot's code, where the variables are:

static MeleeEvaluate me;

4. Then, inside run(), but outside the infinite loop (right after public void run() ), copy and paste this code:

		if(me==null){
			me=new MeleeEvaluate(this);
		}
		Condition go=new Condition("go"){
				public boolean test(){
					return true;
				}
			};
		go.setPriority(100);
		addCustomEvent(go);

If your bot uses blocking calls, make sure this code goes before the blocking calls in run()

5. Finally, copy and paste this code right outside run() (like onScannedRobot):

	public void onCustomEvent(CustomEvent e){
		me.execute();
	}

6. Compile your bot, run it in battles, and watch the console!