I have a simple trigger that runs a simple loop circa 15,000 times. However, it just dies out and quits after around 5k-6k into the loop. Any way around that?
Run a quick sleep action. Either add an "if" to your loop, seeing if your forloopindex is 5,000;10,000;15,000 whatever, or just use three loops, seperated by a wait.
Quite frankly, I don't think I want to know what kinda loop requires 15000 iterations...
And, if you hit the trigger execution time limit... there's a reason.
Not to mention that you probably want to go even higher.
This is actually more of a mathematical problem, than proggraming one.
Either way, when I go home, if it continues to be more about logic and less proggraming, I might learn JASS well enough to take part in it.
And there is definately a better algorithm, just requires a little bit more thinking.
Edit:
Oh, yeah I finally got it, took some time to remember, but no matter...
Your's is too brute force, you're not trying to crack a password, are you?
Its simple anyway, you just have to think a bit!
S=n/2*(2+(n-1)) - this would be your case. And this thing is called arithmetic proggresion. If its that simple then this is no contest at all...
first off its only lvl 1 of the contest, and second off, once you get integers above that level, like 2500000000, they bug out, so you gotta find some way to work around that, which I have yet to be able to do
Thats the equation, but you still run into problems, as emj said, with n >=~ MAXINT^.5. I suppose one solution would be to break down n into its factors, but if you're given a prime number >=~ MAXINT^.5 then you're screwed six ways from sunday.
But, its entirely possible to do; if I can do it, you can. The hardest part is, as stated, working around JASS's limitations.
PS: If you do get a work-around working with the formula that works for ALL number, I'd be very happy to see it. [I've since submitted my solution, and have stated for public record as much, so dont worry about me trying to cheat and steal your genius. I'm merely insanely curious as how someone managed to work-around with the equation.]
It started with multiplying two 2 digit numbers.
And yet, the biggest multiply inside that calculation was 4 times 7, which is half the size.
Some bigger example maybe:
Let's say you want to multiply 1234 by 5678.
Unfortunately, your calculator is from before WWI and refuses to multiply anything, unless it's in the range 0 - 99.
What to do?
Well, you might notice that 1234 is 12 * 100 + 34, and 5678 is 56 * 100 + 78.
Those 4 factors, 12, 34, 56 and 78, are each within 0 - 99.
1234 * 5678
= (12 * 100 + 34) * (56 * 100 + 78)
multiplying it all out, with a bit of grouping back:
where the actual result is really just writing out the factors one after the other, ignoring the "100"s.
Somewhat longish maybe, but, your 0-99 calc was enough to get the job done!
You may notice that I didn't really do anything with all those "* 100", that's because they are only needed so I remember the correct positions.
I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...