Re: WHO ARE THE REAL MONSTERS?!?!?!??!? MAFIA D2: ONE DEATH??? IMPOSSIBLE
02-02-2013, 04:42 PM
Originally posted on MSPA by MalkyTop.
I am punishing you all bu syubjecting all of you to bot things.
I DON'T UNDERSTAND BOTS.
I am punishing you all bu syubjecting all of you to bot things.
Quote:(This has some technical details. Tl;dr at bottom.)NOW YOU KNOW THINGS YOU NEVER REALLY WANTED TO KNOW. hahahahahahaaa. PSA: VOTE RIGHT.
Para's vote is almost correct. Here's the process I'm using to find votes:
1. Use the regular expression "<b>(.*?)</b>" to extract bold text.
2. For each bold text, use the regular expression "[Vv][Oo][Tt][Ee].*?(\w[ \w]+)" to extract possible votes.
What this means is, any time you make some bold text, the bot will grab it and look at it later. That's step 1. Then, it will look through the list of all the bolded text it found. It will look for text that matches the following structure:
1. "Vote", "vote", "vOtE", etc. somewhere in the text.
2. Any quantity of stuff after that, possibly nothing. In most cases this will be ": ", ":", " ", etc.
3. A series of letters, numbers, or spaces, starting with a letter or number (so not <, [, etc.). This should be a username, and is what will be extracted as the vote.
In step 2, the bot is non-greedy or minimal; it tries to fulfill this requirement with as few characters as possible. In step 3, the bot is greedy, and tries to grab as many characters as possible. The net result is:
1. Look for "vote".
2. Skip all weird characters (including spaces, colons, and so on).
3. Grab all letters/numbers until you see a weird character.
So in the case of, for example, the vote terminate Terminate(vOtE) : A Killer Cup of Tea will find "vOtE", then skip ") : " while trying to find a letter/number. Once it finds "A", it will keep going until it stops at the </B> tag because < isn't an alphabet/number/space character, and the vote will be recorded for A Killer Cup of Tea. On the other hand, VOTE(terminate) : A Killer Cup of Tea will not work, because it will think you are voting for "terminate".
So this should capture Para's voting style. The one catch, though, is that he didn't bold his vote. So he just needs to do that.
tl;dr Para just needs to maintain his current voting style, bold his votes and everything will be fine
I DON'T UNDERSTAND BOTS.