If you have a function that returns 4 distinct values but there are some code paths that return the same value this is a very good indicator that the function can be refactored into a simpler solution.
When doing calculations in vector space I'd always recommended to scribble up a diagram except for the simplest of cases.
Yep, this does indeed work, thanks a lot, thats a whole lot easier. Except that I somehow got up and down mixed up, at least its easier to fix in your version So the general advice for such monstrous if-statements would be "look for an easier algorithmn", or is there some recommandation in case there is no easier algorithmn scheme?
I started by drawing a crude diagram and looking for a mathematical solution. Sometimes it's easier to visualize that way.
Fir, if you only want to talk you should post to the lounge.
I don't know if it is the language barrier playng into this, but your attitude just comes over as rude and condescending. You can't expect other users of this forum spoon feeding you the solutions to problems you encounter while you are programming, when you could have found the answers yourself with half an hour of research.
Instead you are expecting dozens of people to invest their own free time to do the work for you while you sit around and wait for the responses to fly in.
Take your original post for example: If I hadn't known what this code does I would have immediately seen the string "GoogleAnalyticsObject". Put the exact string into google search and the second result is a detailed explanation of what this code does.
so you have a list of trucks that arrive after a specified amount of minutes plus or minus a random amount of minutes. And you want to take the next truck out of this list when the amount of minutes has passed.