Difference between revisions of "User:Starrynte/Melee Evaluator"

From Robowiki
Jump to navigation Jump to search
(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…')
 
m (→‎How to Use: Grammar fix)
Line 3: Line 3:
 
==How to Use==
 
==How to Use==
 
1. Copy [[Starrynte/Melee Evaluator Source|the code here]] and paste it into a new class called MeleeEvaluate
 
1. Copy [[Starrynte/Melee Evaluator Source|the code here]] and paste it into a new class called MeleeEvaluate
2. Change the package to your's and compile the code
+
2. Change the package to yours and compile the code
 
3. Add this to your bot's code, where the variables are: <pre>static MeleeEvaluate me;</pre>
 
3. Add this to your bot's code, where the variables are: <pre>static MeleeEvaluate me;</pre>
 
4. Then, inside run(), but outside the infinite loop (right after public void run() ), copy and paste this code: <pre>
 
4. Then, inside run(), but outside the infinite loop (right after public void run() ), copy and paste this code: <pre>

Revision as of 06:45, 14 September 2009

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 yours 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!