Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The best way to handle this is to compose each logical block as a section and make a state diagram for the entire function.</p> <p>Don't forget that falling through past the start of a state is considered a transition and should be treated as such. When you have these broken out into their state transitions, you can start to see where they can be reduced into a handful of functions, applying recursion or iteration where necessary.</p> <p>Now, I fully admit that I don't understand the function or what it's doing or supposed to do, but this was a first attempt at making the state diagram, to give you an idea of what I mean. Notice the loop on <code>80</code>, probably going to need a loop. Notice that 10 and 100 are your only return states. Notice how once you go from 30 to 50 there is no going back. That indicates to me that 50+ might be it's own isolated function, while 10-40 is it's own function with a loop that when it hits 30 says <code>return functionRepresenting50Pluss(...)</code></p> <p><a href="http://i51.tinypic.com/otkbqr.png">http://i51.tinypic.com/otkbqr.png</a></p> <p>Just a note, the filled in squares on some state transitions indicate this transition is guaranteed to be chosen if no other transition is made away from the state. Notice it doesn't exist on 80 because I couldn't really decide if 80 or 90 was it's guaranteed destination. It could be it's possible for something to loop around 80 forever? Without understanding the function more I can't say.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload