Premature trigger stop

Luth

Lex Luthor!
Reaction score
41
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.
 
Heh, was just coming back to say I figured out that Sleeping would keep it going. ;) Thx corvus.
 
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.

Very evil :p
 
I'm not a fan of brute force either, but there are sometimes no other ways. :-/
 
[Off topic]

Did you know?

17 * 42
= (1 * 10 + 7) * (4 * 10 + 2)
= 1 * 4 * 10 * 10 + 1 * 2 * 10 + 4 * 7 * 10 + 2 * 7
= 4 * 100 + (2 + 28) * 10 + 14
= 4 * 100 + 30 * 10 + 14
= 4 * 100 + 3 * 100 + 1 * 10 + 4
= 7 * 100 + 1 * 10 + 4
= 714?
 
Yah I totally knew that.

By the way, you made my World Editor crash:
Code:
17 * 42 = (1 * 10 + 7) * (4 * 10 + 2) = 1 * 4 * 10 * 10 + 1 * 2 * 10 + 4 * 7 * 10 + 2 * 7 = 4 * 100 + (2 + 28) * 10 + 14 = 4 * 100 + 30 * 10 + 14 [SIZE=4][B])[/B][/SIZE] = 4 * 100 + 3 * 100 + 1 * 10 + 4 = 7 * 100 + 1 * 10 + 4 = 714?
 
> Curious....what are you doing that requires that much looping :confused:
i'm guessing its for vexorian's contest :p
 
Contest, what contest?
Oh, and I really wanna know what this trigger is supposed to do!
 
> I'm guessing it's for Vexorian's contest

All the more reason to stop looping...

If you're hitting time problems at 15000, how long you think it will run with 1000000? What about 1000000000?
 
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. :cool:

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.]
 
a few ppl got it already, Pip, Blue, 1 other i think, but i dont know it yet, I thought I had it, but it ended up not working for me :(

I really am not sure what to do heh
 
Haven't really been reading post #9, have you?

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:

= 12 * 56 * 100 * 100 + 12 * 78 * 100 + 34 * 56 * 100 + 34 * 78
= 12 * 56 * 100 * 100 + (12 * 78 + 34 * 56) * 100 + 34 * 78
= 672 * 100 * 100 + (936 + 1904) * 100 + 2652
= 672 * 100 * 100 + 2840 * 100 + 2652

some of the factors in here are too large, and need readjusting:

= 672 * 100 * 100 + (28 * 100 + 40) * 100 + (26 * 100 + 52)
= 672 * 100 * 100 + 28 * 100 * 100 + 40 * 100 + 26 * 100 + 52
= (672 + 28) * 100 * 100 + (40 + 26) * 100 + 52

leading to the final result:

= 700 * 100 * 100 + 66 * 100 + 52
= 7006652

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.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    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.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    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
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    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"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    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...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top