Post new topic    
Liquid Metal Slime
Send private message
Do while loops break the instant it's condition is not true? 
 PostSat Nov 15, 2014 1:53 am
Send private message Reply with quote
I would like to know if While loops break the moment their condition is not being met? Or is it necessary to add in some sort of break? I specifically am referring to while loops which contain embedded for loops. If the while loops condition becomes false, will the for loop break even if it is only partially complete, or will the for loop finish before breaking the while loop?
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
Metal King Slime
Send private message
 
 PostSat Nov 15, 2014 2:41 am
Send private message Reply with quote
No, loop conditions are only checked at the end/beginning of the loop. To break out at any other time you need to use break, continue, or exit script.

Note that if you want to break out of nexted loops you can pass an argument to continue and break giving the number of loops to break out of. Eg:
Code:
while(true) do (
  for (i, 1, 10) do (
    if (something) then (break(2))  # exit the while loop
    ...
  )
)


The magical construct you described, "break out of any point of this script/loop as soon as this condition is met" isn't very easy to emulate. Basically you need to copy/paste lots of if...break checks.
Liquid Metal Slime
Send private message
 
 PostSat Nov 15, 2014 2:50 am
Send private message Reply with quote
Awesome. I'm glad you mentioned I can break many nested loops with break(x), I can see myself using that lots. This should be mentioned in the plotscripting dictionary, at least I don't think I saw anything like this there.

I suppose I don't have to break out of my while loop immediately since there will be relatively no delay between the start an end of the script I'm doing so I guess the break check can just go near the end of the nested loop and it should work as I need it.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
Metal King Slime
Send private message
 
 PostSat Nov 15, 2014 4:18 am
Send private message Reply with quote
Opps, I didn't realise it wasn't in the dictionary.
Liquid Metal King Slime
Send private message
 
 PostFri Dec 12, 2014 1:54 am
Send private message Reply with quote
As far as while loops go, what are you using it for out of curiosity?
Meat, Cheese, and Silicon
Send private message
 
 PostFri Dec 12, 2014 2:40 am
Send private message Reply with quote
Spoonweaver wrote:
what an interesting spambot

Indeed. Also, why have we been getting so many spambots recently? I counted 3 just this week.
Sent from my iPhone
Metal King Slime
Send private message
 
 PostFri Dec 12, 2014 4:20 am
Send private message Reply with quote
Maybe because idiots respond to them and let them know that there's hot spam reading people over here?
Metal King Slime
Send private message
 
 PostFri Dec 12, 2014 8:34 am
Send private message Reply with quote
I suggest changing the captcha. Once someone stores an answer to a static captcha in a database somewhere, it's broken. CastleParadox used to get a lot of spam bots, and they would just reappear soon after changing the captcha question, but hasn't had a single one since I changed the captcha to one that even a human can't guess out of context.
Super Slime
Send private message
 
 PostFri Dec 12, 2014 6:29 pm
Send private message Reply with quote
TMC wrote:
I suggest changing the captcha. Once someone stores an answer to a static captcha in a database somewhere, it's broken. CastleParadox used to get a lot of spam bots, and they would just reappear soon after changing the captcha question, but hasn't had a single one since I changed the captcha to one that even a human can't guess out of context.


Yeah, I end up having to change it every few months. The current one ("What is the text on the top right of the home page?" or something similarly-worded) is so specific that I have to assume that there is an actual human that goes around gathering spambot answers for various websites.
Mega Tact v1.1
Super Penguin Chef
Wizard Blocks
Liquid Metal King Slime
Send private message
 
 PostFri Dec 12, 2014 7:09 pm
Send private message Reply with quote
I learned something interesting while messing with the captcha question on the wiki.

Apparently there are two methods that smart spambots use to defeat this kind of question.

1) The spam robot does a google search for the text of the question, and then uses the biggest boldest text as the answer. This defeats Captcha questions like Who was the 12th president of the united states

2) A human worker builds a database of url/answer pairs. This defeats the static questions where the site asks a simple question about itself. The spam robots use that database later as they work. The human worker probably uses failures of methods like #1 to narrow down the list of potential targets that they have to crack.

When I learned about #1 I spent a lot of time trying to come up with questions that could not be cracked that way because googling the question won't just give it to you, but it at least sends you in the right direction. Stuff like What year did Yoko Ono celebrate her 20th birthday?. In spite of that, ever few months, a human will crack one of my questions and add it to their database, and I get a new flood of account registrations. I modified my wiki captcha plugin to log the questions that succeed, so I know which ones have to be retired.

I think the way to go in the future is probably where you have to play something that is almost a full-blown game to prove your humanity, like the kittencaptcha thing.

Heh, maybe new users should have to win one round of Brood on easy difficulty to activate their accounts ;)
Metal King Slime
Send private message
 
 PostSat Dec 13, 2014 1:16 am
Send private message Reply with quote
It looks like I spoke too soon. In the last month a few spambot accounts have been registered on CP, though none have posted yet. It took a year for them to defeat the captcha, because if you take a cursory glance around the site it's actually not immediately obvious what the answer is (everyone uses the abbreviation 'OHR').
Display posts from previous: