import static util.Printing.*;
import static util.Calculating.*;
import static java.lang.Math.*;



public class LevelUp {

	public static void main(String[] args) {
		Player mike = new Player("Mike",35,4,49,27);
		Player tony = new Player("Tony",14,9,37,40);
		
		p(compare(mike,tony).name+" estimated to win.");
		
		p(battle(mike,tony).name+" Wins!");

	}
	
	public static Player battle(Player a,Player b){
		Player a2 = new Player(a.name,a.atk,a.def,a.spd,a.hp);
		Player b2 = new Player(b.name,b.atk,b.def,b.spd,b.hp);
		
		Player winner = null;
		int time = 1;
		
		while(a2.hp > 0 && b2.hp > 0){
			pnb(time+":");
			
			if(time % (99-a2.spd) == 0){
				b2.uHP(b2.hp - (max(r(a2.atk) - r(b2.def),0)));
				pnb(" "+a2.name+" Attacks! "+b2.name+"'s health is now "+b2.hp);
			}
			if(time % (99-b2.spd) == 0){
				a2.uHP(a2.hp - (max(r(b2.atk) - r(a2.def),0)));
				pnb(" "+b2.name+" Attacks! "+a2.name+"'s health is now "+a2.hp);
			}
			
			time++;
			p();
		}
		
		if(a2.hp > b2.hp){
			winner = a2;
		}else{
			winner = b2;
		}
		
		return winner;
	}

	public static Player compare(Player a,Player b){
		Player winner = null;
		double scale;	
		
		scale = (((a.atk - b.def) / (double)b.hp) * a.spd) / (((b.atk - a.def) / (double)a.hp) * b.spd);
		
		p(scale);
		
		if(scale < 0){
			winner = a;
		}else if(scale > 0){
			winner = b;
		}else{
			
		}
		
		return winner;
	}

}

@@ -206,18 +206,19 @@
 ke%22,
-35,4,49,27
+14,10,23,14
 );%0D%0A
@@ -256,14 +256,15 @@
 y%22,1
-4,9,37
+7,11,20
 ,40)
@@ -548,33 +548,8 @@
 %09%09%0D%0A
-%09%09Player winner = null;%0D%0A
 %09%09in
@@ -984,18 +984,23 @@
 %0D%0A%09%09%0D%0A%09%09
-if
+return 
 (a2.hp %3E
@@ -1009,80 +1009,58 @@
 2.hp
-)%7B%0D%0A%09%09%09winner = a2;%0D%0A%09%09%7Delse%7B%0D%0A%09%09%09winner = b2;%0D%0A%09%09%7D%0D%0A%09%09%0D%0A%09%09return winner
+ %7C%7C (a2.hp == b2.hp && a2.spd %3E b2.spd)) ? a2 : b2
 ;%0D%0A%09
@@ -1119,33 +1119,8 @@
 )%7B%0D%0A
-%09%09Player winner = null;%0D%0A
 %09%09do
@@ -1149,16 +1149,19 @@
 ale = ((
+max
 (a.atk -
@@ -1162,24 +1162,26 @@
 .atk - b.def
+,0
 ) / (double)
@@ -1199,16 +1199,19 @@
 pd) / ((
+max
 (b.atk -
@@ -1216,16 +1216,18 @@
  - a.def
+,0
 ) / (dou
@@ -1274,119 +1274,67 @@
 %0D%0A%09%09
-if(scale %3C 0)%7B%0D%0A%09%09%09winner = a;%0D%0A%09%09%7Delse if(scale %3E 0)%7B%0D%0A%09%09%09winner = b;%0D%0A%09%09%7Delse%7B%0D%0A%09%09%09%0D%0A%09%09%7D%0D%0A%09%09%0D%0A%09%09return winner
+return (scale %3E 1 %7C%7C (scale == 1 && a.spd %3E b.spd)) ? a : b
 ;%0D%0A%09

Add tie-game and estimate functionality