Jump to content

Recommended Posts

Can anybody help me with this PHP problem? I have a sort of online game where there are calculations that have circular references(?) eg:

 

A = (B*45%) + (C*45%) + (A*10%)

 

Sort of like Google's PageRank system where all the page ranks are dependant on each other and itself. And I'm thinking I might need a recursive function or something like that. Help?

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/208261-help-with-linked-calculations-recursion/
Share on other sites

You have to provide a little more logic. Where does A come from? What determines when to run a recursive function? If you are going to do recursion, at what point will the recursion stop? The calculation you have provided doesn't show a need for a recursive function, and based on your description, it's hard to know what you are after.

Okay, sorry for being unclear. Here's how it has to work:

 

literacy = (morale*15%)

morale = (crime rate*10%)

crime rate = (literacy*10%)

 

To summarise: literacy is affected by morale, which is affected by crime rate, which is affected by literacy. All are percentages.

 

Or is this an impossible task? Am I missing something?

 

 

This doesn't make any sense. look

 

literacy = morale*15%  = (crime rate*10%)*15% = crime rate * 1.5%

 

but

 

crime rate = literacy*10%

 

so literacy is lower than crime rate but it's higher than crime rate. ???

 

 

crime rate = crime rate * 0.15%

 

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.