<? include $DOCUMENT_ROOT."/zzzfilelist.inc"; ?>
<? if (!$dont_inc_general) { include Inc("functions_general.inc.php"); } ?>
<? include Inc("metoo.inc.php"); ?>
<? include Inc("metoo_loc.inc.php"); ?>
<html>
<head><title>MeToo : Middle-Earth Tool for Overcoming Opposition</title></head>
<body>
<center>
<font size=+2><b>Middle-Earth Tool for Overcoming Opposition</b></font><br>
</center>
<hr>
<?
	if (!$goingtologin) { include Inc("testlogin.php");	}
?>
<? $where="showarmy_tables"; include Inc("checkgameaccess.inc.php"); ?>
<?
#	echo $data."<hr>";
	echo "<center><a href='javascript:history.go(-1)'>".$loc[$loctag[8]+8][$lang]."</a><br><br>";
	$datap=explode("-", $data);
	$nbarmies++;
	$army[$nbarmies] = new Army;
	$army[$nbarmies]->people=$datap[0];
	for ($n=1; $n<=7; $n++) {
		$army[$nbarmies]->unitsnb[$n]=$datap[$n];
	}
	$army[$nbarmies]->leadercommand=$datap[8];
	$army[$nbarmies]->climate=$datap[9];
	$army[$nbarmies]->terrain=$datap[10];
	$army[$nbarmies]->morale=$datap[11];
	for ($n=1; $n<=6; $n++) {
		$army[$nbarmies]->units_training[$n]=$datap[$n+11];
		$army[$nbarmies]->units_weapons[$n]=$datap[$n+17];
		$army[$nbarmies]->units_armors[$n]=$datap[$n+23];
	}
	
	
	
	$besttactic=0;
	$worsttactic=999999;
	for ($i=1; $i<=6; $i++) {
		$army[$nbarmies]->tactic=$i;
		for ($j=1; $j<=6; $j++) {
			$army[$nbarmies]->vstactic=$j;
			CalculateArmyStr($nbarmies);
			if ($army[$nbarmies]->str_final>$besttactic) { $besttactic=$army[$nbarmies]->str_final; }
			if ($army[$nbarmies]->str_final<$worsttactic) { $worsttactic=$army[$nbarmies]->str_final; }
		}
	}
	$variance=10;
	$bestclose=$besttactic*$variance/100;
	$worstclose=$worsttactic*$variance/100;
	
	echo "<table border=1>";
	echo "<tr align=center>";
	echo "<td></td>";
	echo "<td></td>";
	for ($j=1; $j<=6; $j++) {
		echo "<td width=80>".$loc[$loctag[8]+$j][$lang]."</td>";
	}
	echo "</tr>";
	for ($i=1; $i<=6; $i++) {
		$army[$nbarmies]->tactic=$i;
		echo "<tr align=center>";
		if ($i==1) {
			echo "<td rowspan=6>".$loc[$loctag[8]+7][$lang]."</td>";
		}
		echo "<td>".$loc[$loctag[8]+$i][$lang]."</td>";
		for ($j=1; $j<=6; $j++) {
			$army[$nbarmies]->vstactic=$j;
			CalculateArmyStr($nbarmies);
			echo "<td>";
			if (abs($army[$nbarmies]->str_final-$besttactic)<$bestclose) { echo "<b>"; }
			if (abs($army[$nbarmies]->str_final-$worsttactic)<$worstclose) { echo "<i>"; }
			echo (int)($army[$nbarmies]->str_final);
			echo "</td>";
		}
		echo "</tr>";
	}
	echo "<tr align=center>";
	echo "<td></td>";
	echo "<td><font size=-1>".$loc[$loctag[8]+9][$lang]."</td>";
	for ($i=1; $i<=6; $i++) {
		$sum=0;
		$army[$nbarmies]->tactic=$i;
		for ($j=1; $j<=6; $j++) {
			$army[$nbarmies]->vstactic=$j;
			CalculateArmyStr($nbarmies);
			$sum+=$army[$nbarmies]->str_final;
		}
		echo "<td><font size=-1>";
		echo (int)($sum/6);
		echo "</td>";
	}
	echo "</tr>";
	echo "</table>";
	echo "<br><br>";



	echo "<table border=1>";
	echo "<tr align=center>";
	echo "<td></td>";
	for ($j=1; $j<=7; $j++) {
		echo "<td width=80>".$loc[$loctag[7]+$j+42][$lang]."</td>";
	}
	echo "</tr>";
	for ($i=1; $i<=7; $i++) {
		$army[$nbarmies]->climate=$i;
		echo "<tr align=center>";
		echo "<td>".$loc[$loctag[7]+$i+35][$lang]."</td>";
		for ($j=1; $j<=7; $j++) {
			$army[$nbarmies]->terrain=$j;

			$besttactic=0;
			$worsttactic=999999;
			for ($i2=1; $i2<=6; $i2++) {
				$army[$nbarmies]->tactic=$i2;
				for ($j2=1; $j2<=6; $j2++) {
					$army[$nbarmies]->vstactic=$j2;
					CalculateArmyStr($nbarmies);
					if ($army[$nbarmies]->str_final>$besttactic) { $besttactic=$army[$nbarmies]->str_final; }
					if ($army[$nbarmies]->str_final<$worsttactic) { $worsttactic=$army[$nbarmies]->str_final; }
				}
			}
			echo "<td>";
			echo (int)($besttactic).",<br>".(int)($worsttactic);
			echo "</td>";
		}
		echo "</tr>";
	}
	echo "</table>";
?>