Jump to content

This is a impossible return


Shadowing

Recommended Posts

Hey guys im having a problem. This is crazy makes no sense at all.

I am so stuck and out of answers on why this is happening

 

 

I wrote this code out so anyone can just copy and paste it to see results

 

 


           $resource1_level_costs = 0; 
           $resource1_highest_level = 2 + 1;
           $resource1_subtract = 50; 
           $before_bonus_reduction = '';


while($resource1_level_costs < $resource1_subtract)   { 

             $before_bonus_reduction = pow($resource1_highest_level,3); 
             $resource1_level_costs += ceil($before_bonus_reduction - ($before_bonus_reduction * .22)); 								
             $resource1_subtract -= $resource1_level_costs; 

++$resource1_highest_level;

  
echo $before_bonus_reduction." before deduction<br />";				
echo $resource1_level_costs." after deduction<br />";


}

 

 

 

 

The return is this

 

27 before deduction

22 after deduction

64 before deduction

72 after deduction

 

 

takes 27 subtracts 22 percent giving 22

 

takes 64 subtracts 22 percent giving 72????? what the heck

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.