Now open-source TGW calculator

Forum for all general ingame discussion.
Post Reply
agapooka
Semper Ubi Sub Ubi
Posts: 2607
Joined: Thu Mar 31, 2005 4:34 am
ID: 0

Honours and Awards

I've been getting questions about my calc's source, so I thought I'd refresh a bit. :)

And a late thank-you to Paul-ish for seeing a detail I didn't see :P

Calc URL: http://www.calc.streamdown.net

Source:

<?php
$a = $HTTP_GET_VARS['a'];
$b = $HTTP_GET_VARS['b'];
$c = $HTTP_GET_VARS['c'];
$d = $HTTP_GET_VARS['d'];
$e = $HTTP_GET_VARS['e'];
$f = $HTTP_GET_VARS['f'];
$p = $HTTP_GET_VARS['p'];

if ($a == '') { $a = '0'; }
if ($b == '') { $b = '0'; }
if ($c == '') { $c = '0'; }
if ($d == '') { $d = '0'; }
if ($e == '') { $e = '0'; }
if ($f == '') { $f = '0'; }
if ($p == '') { $p = '0'; }

$title = "Pookie's TGW Calculator";
$nav = "<a href='?p=0'>Calculator Home</a> | <a href='?p=donate'>Donate</a> | <a href='?p=about'>About</a> | <small>(<a href='admin' target='_blank'>Admin Panel</a>)</small>";
$fname = "index.php";
$version = "2.0.3";
$release = "21st of June 2006";
$disclaimer = "Property of Jason Lambert (Agapooka)<br />Pookie TGW Calculator version ".$version.", released on the ".$release."."; [/color]
$filename = //well, you don't need to know this part
$announce = //well, you don't need to know this part

{
$lines = file($filename);
$disabled = $lines[0];
}

if ($disabled == 1)
{
$status = " disabled='disabled'";
$why = "<b>".$lines[1]."</b><br /><br />";
$n = '0';
}
else
{
$status = "";
$why = "";
$n = '1';
}

{
$lines = file($announce);
$message = $lines[1];
}

for ($ia=0; $ia<=8; $ia++) {
if ($ia == $p)
{
$sel[$ia] = " selected";
}
else
{
$sel[$ia] = "";
}
}

$head = "<html>
<title>".$title."</title>
<head><center>
<h1>".$title."</h1><br />
".$nav."
</center></head>
<style type='text/css'>
a:link { color: darkblue; text-decoration: none }
a:active { color: darkblue; text-decoration: none }
a:visited { color: darkblue; text-decoration: none }
a:hover { color: darkred; text-decoration: underline }
</style>";
$body = "<body><center>
<table width=500 cellspacing=3 cellpadding=3 border=1>";
$tbl0 = "<tr><td width=100%><center>
<form action='".$fname."' method=get>
";
$frma = "Current: <input size=8 maxlength=22".$status." value=".$a." name=a />
<br />";
$frmb = "Desired: <input size=8 maxlength=22".$status." value=".$b." name=b />
<br />";
$frmc = "<input size=8 maxlength=22".$status." value=".$c." name=c />
<br />";
$frmd = "<select name='d'".$status.">
<option value='0'>DefCon Level:</option>
<option value='1'>None</option>
<option value='1.45'>Unsure</option>
<option value='2'>Critical</option></select>
<br />";
$frme = "<input size=8 maxlength=22".$status." value=".$e." name=e />
<br />";
$frmf = "<input size=8 maxlength=22".$status." value=".$f." name=f />
<br />";
$frmp = "
<h3><b>".$message."</b></h3>
".$why."
<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 Weapon Cost</option>
<option value=4".$sel[4].">MS Shield Capacity and Shield Cost</option>
<option value=8".$sel[8].">Fleet (and soon fleet) Hangar 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!' />
<br />";
$foot = "</form>
</center></td>
</tr></table>
<small>
".$disclaimer."
</small><br /><br />
<img src='/cgi-sys/Count.cgi?df=jason.dat|display=Counter|ft=2|md=6|frgb=100;139;216|dd=E' /><small>&nbsp page views since 00:00 GMT on July 14th 2006</small>
<table width=402 border=0 cellspacing=1 cellpadding=1><tr><td>
<br /><small>Sponsored by:<small><br /></td></tr></table>
<table width=402 border=1 bordercolor=#000000 cellspacing=1 cellpadding=1><tr><td>
<center><a href='http://dreadlords.jconserv.net' target='_blank'><img src='ads/dreadlords.gif' alt='Check out the Dread Lords alliance!' /></a><br />+<br />
<a href='http://s11.invisionfree.com/law7441/index.php' target='_blank'><img src='ads/ufor.jpg' alt='Check out the United Federation of Races!' /></a>
</center>
</td></tr><table>
</center></body>
</html>";

if ($p == '0')
{
echo $head,$body,$tbl0."<input type='hidden' value=".$c." name=c />".$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($n*$ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frma,$frmb."<input type='hidden' value=".$c." name=c />".$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($n*$ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frma,$frmb."<input type='hidden' value=".$c." name=c />".$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($n*$ans, 0, '.', ',')." ".$currency."<br />Cost with weapons included: ".number_format($n*$ans+(($b-$a)*2100800), 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frma,$frmb."<input type='hidden' value=".$c." name=c />".$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($n*$ans, 0, '.', ',')." ".$currency."<br />Cost with shields included: ".number_format($n*$ans+(($b-$a)*2250000), 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frma,$frmb."<input type='hidden' value=".$c." name=c />".$frmp,$frm0,$answ,$foot;
}
if ($p == '8')
{
$currency = "Naquadah";
$ans = (-1*($a-$b))*(((10000*($b-1)+10000*($a+2))/2));
$answ = "<br />Cost: ".number_format($n*$ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frma,$frmb."<input type='hidden' value=".$c." name=c />".$frmp,$frm0,$answ,$foot;
}
if ($p == '5')
{
$currency = "Naquadah";
$ans = (6000*pow(2,($c-1)));
$answ = "<br />Cost: ".number_format($n*$ans, 0, '.', ',')." ".$currency."<br />Cost for Replicators: ".number_format($n*0.9*$ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frmc,$frmp,$frm0,$answ,$foot;
}
if ($p == '6')
{
$currency = "spies must be sent";
$ans = str_replace(",", "", $d)*(1.01*(str_replace(",", "", $e)/((str_replace(",", "", $f)+1)/(str_replace(",", "", $c)+1)))+1);
$answ = "<br />".number_format($n*$ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0."Enemy covert action: ".$frme."(<b>NOT</b> SPY LEVEL)<br />Your covert action: ".$frmf."(<b>NOT</b> SPY LEVEL)<br />How many spies you have:".$frmc."Enemy's DefCon level:".$frmd.$frmp,$frm0,$answ."<br /><br /><small>*Please remember to exclude any commas from any fields. They are parsed as decimals. I might change this in the future, but this seems to be the default option for now.</small>".$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;
}
if ($p == 'donate')
{
echo $head,$body,$tbl0."<b><u>Feel free to donate ingame resources to Agapooka (10649)</u></b>
<br />If you are signed into <b><i>www</i></b>.stargatewar<b><i>s</i></b>.com (note the 'www' and the 's'), and have Supporter Status, you can do this from here! Note, however, that giving is not obligatory.
<br /><br />
//well, you don't need to know this part
<br /><br />
Your gifts are appreciated!
".$foot;
}
if ($p == 'about')
{
echo $head,$body,$tbl0."<p align='justify'>Pookie's TGW Calculator is made in Agapooka's spare time. It was made for fun, and I hope that you enjoy using it as much as I enjoyed making it! :)</p>".$foot;
}
?>


-Pooka
Agapooka wrote:The argument that because a premise cannot be proven false, it must be true, is known as a Negative Proof Fallacy in logic.
Mister Sandman wrote:Nothing at all near the negative proof fallacy in logic. If it cannot be proven false, it has to be true.
Pooka's UU Market Loyalty Card:

Rudy Pena: 1 stamp!

A Spider: 1 stamp!
Kasack
Forum Newbie
Posts: 13
Joined: Mon Jan 01, 2007 5:59 pm
ID: 0
Location: Athenry, Ireland

I there any way i could get this calc in an exe form so i can tack it with me ?
User avatar
Grand Admiral Martin
Forum Expert
Posts: 1428
Joined: Sun Jan 01, 2006 2:46 pm
Alliance: I serve only myself.
Race: Ascended Irish
ID: 33984
Location: Unknown

any idea when planet part will be working?
Image
agapooka
Semper Ubi Sub Ubi
Posts: 2607
Joined: Thu Mar 31, 2005 4:34 am
ID: 0

Honours and Awards

Whenever I can find out what the formulas are - and to be honest, I haven't really tried.

You know why? I don't believe it to be worth my time. The game got boring. Will it get fun again? Hopefully :twisted:

Oh and... yes, my noobie PHP is messy. Don't mention it. Not that you have, but someone is bound to notice :P


Kasack wrote:I there any way i could get this calc in an exe form so i can tack it with me ?


Feel free to try. I could probably do it, but I don't really want to... but if enough people want me to, I will.

-Pooka
Agapooka wrote:The argument that because a premise cannot be proven false, it must be true, is known as a Negative Proof Fallacy in logic.
Mister Sandman wrote:Nothing at all near the negative proof fallacy in logic. If it cannot be proven false, it has to be true.
Pooka's UU Market Loyalty Card:

Rudy Pena: 1 stamp!

A Spider: 1 stamp!
*~Starry~*
Forum Addict
Posts: 2581
Joined: Tue Mar 14, 2006 6:02 pm
ID: 0

me wants!!!


~starry :P
[SGC_ReplicÅtors]
Forum Addict
Posts: 3949
Joined: Sun Mar 13, 2005 4:57 pm
ID: 0

planets.....coming soon......been waiting for well a longs time now no rush no rush
agapooka
Semper Ubi Sub Ubi
Posts: 2607
Joined: Thu Mar 31, 2005 4:34 am
ID: 0

Honours and Awards

Back when I wrote "coming soon", I had no idea that the formulas were so impossible and I actually planned to work on them. What the hell, screw planets. :D I also noticed something weird with my UP planets... when I upgrade 1 upgrade at a time, the UP bonus goes up by 2, but otherwise, it goes up by one per upgrade??? What's up with that? Oh well...

-Pooka
Agapooka wrote:The argument that because a premise cannot be proven false, it must be true, is known as a Negative Proof Fallacy in logic.
Mister Sandman wrote:Nothing at all near the negative proof fallacy in logic. If it cannot be proven false, it has to be true.
Pooka's UU Market Loyalty Card:

Rudy Pena: 1 stamp!

A Spider: 1 stamp!
User avatar
Grand Admiral Martin
Forum Expert
Posts: 1428
Joined: Sun Jan 01, 2006 2:46 pm
Alliance: I serve only myself.
Race: Ascended Irish
ID: 33984
Location: Unknown

Agapooka wrote:I also noticed something weird with my UP planets... when I upgrade 1 upgrade at a time, the UP bonus goes up by 2, but otherwise, it goes up by one per upgrade??? What's up with that? Oh well...

-Pooka


I've been looking into that for some time now.
Clicking one at a time gives 2Up.
So you click 30 times you'll get a 60UP bonus but when the turn comes you lose 20% therefore only getting 48up.

But if you upgrade 30 times at once UP only goes up by 51, but after turn nothing happens.

Therefore it is better to upgrade in large amounts rather than clicking individually.

If anyone else has had a different outcome let me know. I've done that over and over about 8 times now.
Image
Varros
Forum Newbie
Posts: 20
Joined: Thu Nov 23, 2006 6:13 am
Alliance: The Order
Race: Furyan
ID: 0

Nice handy little tool :) thanks! :)
Image
Legoless
Fledgling Forumer
Posts: 181
Joined: Sat Jan 07, 2006 3:51 am
Alliance: ArvYStaTe.net
Race: Developer

I was doing a research on planets, and I always thought, UP upgraded by multiply of 1.5. :?
Brdavs
Forum Elder
Posts: 2114
Joined: Sat Jun 03, 2006 1:15 pm
Alliance: The Legion
ID: 69113
Location: Trading jibes with tot gotts.

That "1.5" is dependant on planet size, I believe...

the size of the planet is also now a multiplier of the base value, as well as allowing for more defences to be built on the planet. The smallest (tiny) is x1 while the top size so far is x9. This applies to everything except UP where the increase is time 1. (ie 1.1, 1.2, 1.3....1.9)


So a normal one gives number of cliks X 1.5 but a small one only gives x 1.4... How this is regulated as to add/substract a number after a turn/several turns is a mystery to me...(I even had it vary like 4 turns after building up... from 999 to 1k back to 999 etc.)
Image
Image
ImageImage For Rome!
Calibretto wrote: WIR SOLLEN *insert* AUSRADIEREN

Inserted part could be you!
Zeratul
Elder Administrator
Posts: 23203
Joined: Sat May 06, 2006 8:44 am
Alliance: Lucian Alliance
Race: Templar
ID: 7
Alternate name(s): Hrefna
Reitha
Location: Nivlheim

Honours and Awards

would be really useful if someone could make a planet calculator... might be easier if several people found the calculations for each type and size and then posted that in a topic, and someone else could then code it...

anyways, we can tell you that income planet production grows by the following:
large grows by 230 400 per single upgrade
above average grows by 192 000 per single upgrade

and when upgraded 7 at once, goes up at same rate...
Image
Image
"Great holy armies shall be gathered and trained to fight all who embrace evil. In the name of the gods, Browsers shall be changed to carry the internet out amongst the peoples and we will spread Firefox to all the unbelievers. The power of the Firefox will be felt far and wide and the wicked users of IE shall be converted to use the true browsers."

Curious about our color? Feel free to ask...
agapooka
Semper Ubi Sub Ubi
Posts: 2607
Joined: Thu Mar 31, 2005 4:34 am
ID: 0

Honours and Awards

Thanks to Acolyte of Eternity, the planet calculator is now available on my page.

http://www.calc.streamdown.net

Thanks. :-D

J
Agapooka wrote:The argument that because a premise cannot be proven false, it must be true, is known as a Negative Proof Fallacy in logic.
Mister Sandman wrote:Nothing at all near the negative proof fallacy in logic. If it cannot be proven false, it has to be true.
Pooka's UU Market Loyalty Card:

Rudy Pena: 1 stamp!

A Spider: 1 stamp!
The O-Neill
Fledgling Forumer
Posts: 128
Joined: Mon Apr 11, 2005 11:40 am
Alliance: Tauri Alliance
Race: Ancient-Tauri
ID: 11531

Sweet, thanks
All that is necessary for the triumph of evil,
is good men do nothing.
Mystake
Forum Addict
Posts: 3497
Joined: Sun Aug 06, 2006 3:40 pm
Alliance: Dominium of Chaos
Race: System Lord
ID: 50147
Location: Ontario, Canada
Contact:

I can make an EXE based version in Visual VB.NET

I just need some equations. Shouldn't be terribly long to do. May do it this weekend!
TRADE FEEDBACK - I am an A+ trader! Safest $ trades in all of SGW. I do escrow services too!
http://stargatewars.herebegames.com/vie ... 48&t=83709

Former member of what became the Alliance of the Year of 2009, Nemesis Sect.

Image

Mathlord wrote:The Reclaimer has been descended as a result of the battle!!!

Good times ;)
#-o
Post Reply

Return to “StarGateWars General”