Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

A basic barrack calc - For those of you who don't use the firefox and the SK addon.

edited October 2012 in General
I have created a basic barrack calculator for this round.

This is for those who don't use firefox and the addon.

https://mi-linux.wlv.ac.uk/~1106191/barracks.html

Just type in the values, and press Submit to see the following

- How many barracks your current military requires
- The Barrack capacity
- How many barracks the military in training will require
- How many barracks the current and military in training will require
- What The barrack capacity will be once completed.

Please let me know if there are any mistakes.

p.s. I know about the numbers showing 8 decimal places. and I know you can round is off using float, but I can't seem to get it to work so I figured leaving it as is will be better than not having this at all..

TFs are not included, as TFs do not require barracks.

Comments

  • Cheers Hazza.
  • Total number of units (owned+training)/75 = # of barracks required.
  • I'm using
    Total number of units (owned+training) / #barracks (owned + training) *75.

  • edited October 2012
    You can't house units, training or otherwise, in Barracks that haven't been built yet.
  • it's the projected % once complete. it's what the % will be at once completed.
  • It can be misleading if interpreted incorrectly.
  • Actually.. just looking at my code, and I AM doing
    "Total number of units (owned+training)/75 = # of barracks required."

    the projected is to say if you need to build any more barracks or not.

    this is my crapy code

    <?php
    $Barracks = $HTTP_POST_VARS['Barracks'];
    $Soldiers = $HTTP_POST_VARS['Soldiers'];
    $Troopers = $HTTP_POST_VARS['Troopers'];
    $Dragoons = $HTTP_POST_VARS['Dragoons'];
    $Fighters = $HTTP_POST_VARS['Fighters'];
    $LaserTroopers = $HTTP_POST_VARS['LaserTroopers'];
    $LaserDragoons = $HTTP_POST_VARS['LaserDragoons'];
    $Tanks = $HTTP_POST_VARS['Tanks'];
    $Scientists = $HTTP_POST_VARS['Scientists'];
    $Barracks1 = $HTTP_POST_VARS['Barracks1'];
    $Soldiers1 = $HTTP_POST_VARS['Soldiers1'];
    $Troopers1 = $HTTP_POST_VARS['Troopers1'];
    $Dragoons1 = $HTTP_POST_VARS['Dragoons1'];
    $Fighters1 = $HTTP_POST_VARS['Fighters1'];
    $LaserTroopers1 = $HTTP_POST_VARS['LaserTroopers1'];
    $LaserDragoons1 = $HTTP_POST_VARS['LaserDragoons1'];
    $Tanks1 = $HTTP_POST_VARS['Tanks1'];
    $Scientists1 = $HTTP_POST_VARS['Scientists1'];

    echo "Your current military requires ";
    echo (($Soldiers+$Troopers+$Dragoons+$Fighters+$LaserTroopers+$LaserDragoons+$Tanks+$Scientists)/75);
    echo " Barracks<br>";
    echo "Your barrack capacity is ";
    echo (((($Soldiers+$Troopers+$Dragoons+$Fighters+$LaserTroopers+$LaserDragoons+$Tanks+$Scientists))/($Barracks*75))*100);
    echo "%

    ";

    echo "Your military in training will require an additional ";
    echo (($Soldiers1+$Troopers1+$Dragoons1+$Fighters1+$LaserTroopers1+$LaserDragoons1+$Tanks1+$Scientists1)/75);
    echo " Barracks

    ";

    echo "Your military including those in training will require ";
    echo (($Soldiers+$Troopers+$Dragoons+$Fighters+$LaserTroopers+$LaserDragoons+$Tanks+$Scientists+$Soldiers1+$Troopers1+$Dragoons1+$Fighters1+$LaserTroopers1+$LaserDragoons1+$Tanks1+$Scientists1)/75);
    echo " Barracks
    ";

    echo "Your projected barrack capacity will be ";
    echo (($Soldiers+$Troopers+$Dragoons+$Fighters+$LaserTroopers+$LaserDragoons+$Tanks+$Scientists+$Soldiers1+$Troopers1+$Dragoons1+$Fighters1+$LaserTroopers1+$LaserDragoons1+$Tanks1+$Scientists1)/(($Barracks+$Barracks1)*75)*100);
    echo "%";
    ?>
  • OK, code edited, to round the numbers to 2 decimal places.
  • you forgot a ;
  • did I? it works..?
  • just checked.. every line has one at the end?
  • just checked.. every line has one at the end?
    you sure?
  • It wouldn't work if there wasn't lol
  • Orange, Your a bully.
  • it's ok John. I use Netbeans & PSPad, and it checks for things like that ;)
  • You sure Hazza? Cuz ill kick his ass.
  • I have moved this calculator guys
    new url you need is https://mi-linux.wlv.ac.uk/~1106191/other/barracks.html
  • also I have tweaked the code so its at the top of the page instead of halfway down lol..
Sign In or Register to comment.