I don't see how y increases by 1 every 10th x starting at x = 5.
x = 5 gives round(1 * 0.1) = 0?
x = 15 gives round(3 * 0.1) = 0?
x = 25 gives round(5 * 0.1) = 1?
How does your round operation work?
Hello,
I'm working on a formula used currently in a game and I'm having issues. There are two such formulas in this game that I'm working on, and I've already figured out one - I'll post it as an example that may/may not help in figuring out the formula I'm working on now. Available operations are: addition, subtraction, multiplication, division, flooring, rounding.
I think the best way to explain the pattern is to show what I have, and explain what needs to change. Feel free to ask questions if clarification is needed. Latex doesn't seem to like flooring/rounding from what I can tell, so I do apologize for not using it.
y = round(floor(x / 5) * .1)
In the above formula, x can be an integer 1-155. The formula works for it's intended purpose; y increases by 1 every 10th x starting at x=5. What I need is an extremely similar formula where everything is the same except y will not increase at: x=25, x=65, x=105, x=25+(40*n). As far as I know, there is no limitation on the number of decimal places pre-rounding/flooring, but after only integers should exist.
I did come up with the original formula posted above, but finding one to match the modification has been elusive for me. Any assistance with this would be greatly appreciated!
Ah, you are correct. I thought by stripping what I felt was unnecessary to get the exact number I wanted it would make things easier. I apologize for my lack of thought early this morning. The full formula for the first is this:
round((floor(x/5)*.1)*y)
where x is still an integer 1-155 and y is an integer 1-5, for my purposes you can assume y=5
It's still stripped, but this time I'm sure the extra info you wont be needing
Ok. So now:
x = 5 => z = round(0.1*5) = 1
x = 15 => z = round(0.3*5) = 2
...
This does what you claimed (assuming y = 5, lower y will give different results).
To get it not to increase at x = 25 + n*40, you could just write another of these that increases by one each 40th x starting at 25.
floor(x/40 + 15/40) does just that.
So round((floor(x/5)*.1)*5) - floor(x/40 + 15/40) should give you the desired results.