The calculator has been updated once more. Most of it is so that I can edit more easily, and this more frequently.
The calculator can still be found at
http://jason.streamdown.net/up.php
If you have any suggestions, post them here. This can include idea for new calculations and you may even request for a shorter easier-to-remember URL (but it will basically just redirect to the current one, so anyone that has the page saved in their favourites doesn't have to worry

).
BUT, I did "add" fleet hangar cost calculations. The cost for fleet hangars is the same as mothership weapons, though, so it wasn't much of an addition.
The code, however, has changed quite a bit. I was able to reduce it to about 60% of what it used to be

.
Here is the source:
Code: Select all
<?php
$a = $HTTP_GET_VARS['a'];
$b = $HTTP_GET_VARS['b'];
$c = $HTTP_GET_VARS['c'];
$p = $HTTP_GET_VARS['p'];
if ($a == '') { $a = '0'; }
if ($b == '') { $b = '0'; }
if ($c == '') { $c = '0'; }
if ($p == '') { $p = '0'; }
$title = "Pookie's TGW Calculator";
$fname = "up.php";
$version = "2.0.2";
$release = "3rd of June 2006";
$disclaimer = "Property of Jason Lambert (Agapooka)<br />Pookie TGW Calculator version ".$version.", released on the ".$release.".";
for ($i=0; $i<=7; $i++) {
if ($i == $p)
{
$sel[$i] = " selected";
}
else
{
$sel[$i] = "";
}
}
$head = "<html><title>".$title."</title><head><center><h1>".$title."</h1></center></head>";
$body = "<body><center><table width=500 cellspacing=3 cellpadding=3 border=1>";
$tbl0 = "<tr><td width=100%><center><form action='".$fname."' method=get>";
$frma = "<input size=8 maxlength=22 value=".$a." name=a />";
$frmb = "<input size=8 maxlength=22 value=".$b." name=b />";
$frmc = "<input size=8 maxlength=12 value=".$c." name=c />";
$frmp = "<select name='p'>
<option value=0".$sel[0].">Calculate:</option>
<option value=1".$sel[1].">Unit Production Cost</option>
<option value=2".$sel[2].">Ascended Fleet Cost</option>
<option value=3".$sel[3].">MS Weapon Capacity and Fleet Hangar Cost</option>
<option value=4".$sel[4].">MS Shield Capacity Cost</option>
<option value=5".$sel[5].">Spy Levels</option>
<option value=6".$sel[6].">Sabotage</option>
<option value=7".$sel[7].">Planets (coming soon!)</option></select>";
$frm0 = "<input type=submit value='GO!' />";
$foot = "</form></center></td></tr></table><small>".$disclaimer."</small></center></body></html>";
if ($p == '0')
{
echo $head,$body,$tbl0,$frmp,$frm0,$foot;
}
if ($p == '1')
{
$currency = "Naquadah";
$ans = (-1*($a-$b)/3)*((15000*(($b-1)/3)+15000*(($a+2)/3))/2);
$answ = "<br />Cost: ".number_format($ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frma,$frmb,$frmp,$frm0,$answ,$foot;
}
if ($p == '2')
{
$currency = "Dark Matter Units";
$ans = (-1*($a-$b))*(((5000*($b-1)+5000*($a+4))/2));
$answ = "<br />Cost: ".number_format($ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frma,$frmb,$frmp,$frm0,$answ,$foot;
}
if ($p == '3')
{
$currency = "Naquadah";
$ans = (-1*($a-$b))*(((10000*($b-1)+10000*($a+2))/2));
$answ = "<br />Cost: ".number_format($ans, 0, '.', ',')." ".$currency."<br /><small>*Fleet hangars come at the same cost as weapon capacity.</small>";
echo $head,$body,$tbl0,$frma,$frmb,$frmp,$frm0,$answ,$foot;
}
if ($p == '4')
{
$currency = "Naquadah";
$ans = (-1*($a-$b))*(((12000*($b-1)+12000*($a+(10/12)))/2));
$answ = "<br />Cost: ".number_format($ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frma,$frmb,$frmp,$frm0,$answ,$foot;
}
if ($p == '5')
{
$currency = "Naquadah";
$ans = (6000*pow(2,($c-1)));
$answ = "<br />Cost: ".number_format($ans, 0, '.', ',')." ".$currency."<br />Cost for Replicators:
".number_format(0.9*$ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frmc,$frmp,$frm0,$answ,$foot;
}
if ($p == '6')
{
$currency = "spies must be sent";
$ans = 1.01*($a/(($b+1)/($c+1)))+1;
$answ = "<br />".number_format($ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0."Enemy covert action:".$frma."<br />Your covert action:".$frmb."<br />How many spies you
have:".$frmc."<br />".$frmp,$frm0,$answ,$foot;
}
if ($p == '7')
{
echo $head,$body,$tbl0,$frmp,$frm0."<br /><br />Coming when they are updated and actually useful! <img src='http://www.jason.streamdown.net/icon_razz.gif' alt=':-P' />".$foot;
}
?>