Automated vote counting

This forum is for discussion related to the game.
User avatar
callforjudgement
callforjudgement
Microprocessor
User avatar
User avatar
callforjudgement
Microprocessor
Microprocessor
Posts: 3972
Joined: September 1, 2011

Automated vote counting

Post Post #0 (ISO) » Mon Jul 30, 2012 12:19 pm

Post by callforjudgement »

So, some people have been noticing my vote counts (in my recently concluded Mini Normal, and in mykonian's 50-player game). I had something of an ulterior motive in offering to help mykonian with the vote counts; I wanted to test a semi-automated vote counting script I've been working on. (I use it in Firefox with the Greasemonkey extension; I haven't tested it in Chrome, but theoretically it should work there too.)

Writing a vote counter for mafiascum.net is awkward in some ways. People don't use a consistent format for voting, and frequently abbreviate or misspell player names. As such, this script just looks for comments that look like they contain a vote (the word "vote", possibly as part of another vote, bolded), and draws the mod's attention to them; it's up to the mod to decide which player it's a vote for, or whether it's a false alarm, or an unvote or vote for No Lynch. (There's also an option to reset all the vote counts at a post, which is typically useful on the last vote before a lynch because lynches reset votes in most games, or on the vote count after a lynch if it's incorrectly detected as a vote.)

After installing it, every thread in the Mafia forums will have a new option, "Vote counter settings", to the right of the search box. You can enable the vote counter for a thread by putting the player list into the text box that appears when you click on it; note that the spelling and capitalisation of players' names has to be exactly right for it to work (this was responsible for most of my early mistakes in mykonian's game). When a player is replaced or died, you can use the settings box to inform the vote counter of the fact (it's explained above the settings box), but must not reorder the list. (If a player is replaced, any votes by or for them get shifted onto the replacing player; if a player dies, their votes no longer count and votes for them count as not voting.) If you empty the settings box entirely, the vote counter will completely forget everything it ever knew about the game and free up the disk space and memory it was using to store the information.

Once the vote counter's been enabled, every post that it thinks contains a vote will gain a dropdown box so that you can explain who the post is voting for (and a cyan background around the vote to make it easier to spot). Additionally, every post will gain a "(count votes to here)" link next to the post number; if you've missed any posts (either because you've never opened them in your browser – which is easier to do than it sounds – or because you didn't tell the vote counter who the post was voting for), it'll tell you, and otherwise it'll give you the BBcode for a votecount (in a popup you can copy-and-paste it from), complete with links to the posts that contained each vote. (I may be able to extend it with a "vote count history" or something like that if people are interested.) The vote count will only contain the actual vote-related information; I edited deadline information into the posts in my game by hand, but that's typically just a matter of copy-and-paste except for the first votecount of a day.

Anyway, now that I've tested it, I'm opening it up for everyone to use. Feedback/comments/suggestions would be welcome, as usual. Let me know what you think!
scum
· scam · seam · team · term · tern · torn ·
town
User avatar
DCLXVI
DCLXVI
Mafia Scum
User avatar
User avatar
DCLXVI
Mafia Scum
Mafia Scum
Posts: 3461
Joined: March 8, 2012
Location: Somewhere in the central timezone

Post Post #1 (ISO) » Mon Jul 30, 2012 2:40 pm

Post by DCLXVI »

This looks awesome. It only took a few minutes to get it installed.

Unfortunately the game I'm modding is at nighttime... :(

edit: and its night four so its going to take a while to go through all those votes...
Sarcasm is
not
a scumtell.
User avatar
maxwell
maxwell
Mafia Scum
User avatar
User avatar
maxwell
Mafia Scum
Mafia Scum
Posts: 1009
Joined: August 22, 2011

Post Post #2 (ISO) » Mon Jul 30, 2012 3:59 pm

Post by maxwell »

trying to test this out in chrome, doesn't seem to work though. have firefox on my laptop because i was planning to try to do something like this, will try it out there later
User avatar
Timeater
Timeater
Mafia Scum
User avatar
User avatar
Timeater
Mafia Scum
Mafia Scum
Posts: 4334
Joined: July 10, 2008
Location: Tucson
Contact:

Post Post #3 (ISO) » Mon Jul 30, 2012 6:05 pm

Post by Timeater »

u rock cfj will def try this
watch for the eggshells
User avatar
mykonian
mykonian
Frisian Shoulder-Demon
User avatar
User avatar
mykonian
Frisian Shoulder-Demon
Frisian Shoulder-Demon
Posts: 11963
Joined: August 27, 2008

Post Post #4 (ISO) » Mon Jul 30, 2012 9:44 pm

Post by mykonian »

and there I was wondering why those votecounts were so accurate and frequent. A great find cfj!
Surrender, imagine and of course wear something nice.
User avatar
Hoopla
Hoopla
User avatar
User avatar
Hoopla
Posts: 10788
Joined: October 12, 2008

Post Post #5 (ISO) » Tue Jul 31, 2012 12:58 am

Post by Hoopla »

In post 0, callforjudgement wrote:As such, this script just looks for comments that look like they contain a vote (the word "vote", possibly as part of another vote, bolded), and draws the mod's attention to them; it's up to the mod to decide which player it's a vote for, or whether it's a false alarm, or an unvote or vote for No Lynch.


How is that saving time on looking through your game thread to find anything bolded and determine it's a vote? You still need to scan every post manually anyway (for players requesting prods/replacement or asking a question), so presumably if you're reading your game, you shouldn't miss a vote.

How does it handle double voters?
User avatar
Psyche
Psyche
he/they
Survivor
User avatar
User avatar
Psyche
he/they
Survivor
Survivor
Posts: 10721
Joined: April 28, 2011
Pronoun: he/they

Post Post #6 (ISO) » Tue Jul 31, 2012 6:10 am

Post by Psyche »

How did you do it?
User avatar
Captain Haddock
Captain Haddock
Goon
User avatar
User avatar
Captain Haddock
Goon
Goon
Posts: 107
Joined: January 31, 2012

Post Post #7 (ISO) » Tue Jul 31, 2012 7:51 am

Post by Captain Haddock »

This sounds great.
Once the vote counter's been enabled, every post that it thinks contains a vote will gain a dropdown box so that
you
can explain who the post is voting for (and a cyan background around the vote to make it easier to spot).

By 'you' do you mean the person making the post? :eek: If so that's awesome, but would being able to tell the vote counter you've voted the wrong person be a problem?

I'm interested in what fake voting will be possible with this. I don't like the idea of tricking someone with formatting but I think fakehammering someone you've already voted is legit and that won't work anymore if people use the vote counter to see if someone's been hammered. I suppose that will be a neccessary sacrifice.

I think a thread demonstrating how this works is a good idea.
"If you don't want a doubled chance of being vanillarised lynch me or Deasvail"- Me. Who knew powering up scum was a valid tactic?
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

Post Post #8 (ISO) » Tue Jul 31, 2012 7:56 am

Post by chamber »

In post 7, Captain Haddock wrote:This sounds great.
Once the vote counter's been enabled, every post that it thinks contains a vote will gain a dropdown box so that
you
can explain who the post is voting for (and a cyan background around the vote to make it easier to spot).

By 'you' do you mean the person making the post? :eek: If so that's awesome, but would being able to tell the vote counter you've voted the wrong person be a problem?

I'm interested in what fake voting will be possible with this. I don't like the idea of tricking someone with formatting but I think fakehammering someone you've already voted is legit and that won't work anymore if people use the vote counter to see if someone's been hammered. I suppose that will be a neccessary sacrifice.

I think a thread demonstrating how this works is a good idea.


He means the person running the script.
Taking a break from the site.
User avatar
callforjudgement
callforjudgement
Microprocessor
User avatar
User avatar
callforjudgement
Microprocessor
Microprocessor
Posts: 3972
Joined: September 1, 2011

Post Post #9 (ISO) » Tue Jul 31, 2012 8:20 am

Post by callforjudgement »

In post 5, Hoopla wrote:How is that saving time on looking through your game thread to find anything bolded and determine it's a vote? You still need to scan every post manually anyway (for players requesting prods/replacement or asking a question), so presumably if you're reading your game, you shouldn't miss a vote.

At least in mykonian's game, it was surprisingly common for me to miss a post with a vote in. (Questions are easier to notice.) Perhaps I'm just a particularly inattentive mod, but if so, this will still be useful for people like me. (Also, in my game, someone tried to vote in a spoiler tag; I didn't notice, the script did. Then I marked it as "not a vote" and publicly mocked them for doing that.)

It also avoids all the common problems along the lines of adding a vote but failing to remove the old vote, or putting two entries for the same person on the vote count.

How does it handle double voters?

At the moment, it doesn't, but nothing prevents you editing the votecount by hand to change the counts. I could implement a double-vote thing if there's enough demand.
scum
· scam · seam · team · term · tern · torn ·
town
User avatar
gorckat
gorckat
Mafia Scum
User avatar
User avatar
gorckat
Mafia Scum
Mafia Scum
Posts: 2830
Joined: January 17, 2007
Location: Bawlmer, Hon!

Post Post #10 (ISO) » Tue Jul 31, 2012 8:32 am

Post by gorckat »

Would the 'quality check' be negated/reduced by bringing up the dread "#vote" format?
User avatar
callforjudgement
callforjudgement
Microprocessor
User avatar
User avatar
callforjudgement
Microprocessor
Microprocessor
Posts: 3972
Joined: September 1, 2011

Post Post #11 (ISO) » Tue Jul 31, 2012 8:37 am

Post by callforjudgement »

It definitely could be modified into a fully automated counter, but it would seem very unfair on the players to say "your vote wasn't counted because you didn't spell the name of the person you were voting for quite right", or whatever. And it'd bring the whole trick-votes debate all over again. I tend to be quite flexible as a mod in terms of what I accept, and so the vote counter reflects that.

(And the "#vote" format should be obsolete nowadays, now that we have VOTE: tags, which would be a much more sensible thing to require the use of if you're going to require anything.)
scum
· scam · seam · team · term · tern · torn ·
town
User avatar
Magister Ludi
Magister Ludi
Mafia Scum
User avatar
User avatar
Magister Ludi
Mafia Scum
Mafia Scum
Posts: 3258
Joined: April 7, 2011
Location: San Francisco

Post Post #12 (ISO) » Wed Aug 01, 2012 11:26 am

Post by Magister Ludi »

You could just run it for vote tags, and imply in the rules that only vote tags count, or some derivative, like @vote or whatever
User avatar
saulres
saulres
Mafia Scum
User avatar
User avatar
saulres
Mafia Scum
Mafia Scum
Posts: 4173
Joined: July 25, 2011

Post Post #13 (ISO) » Wed Aug 01, 2012 11:36 am

Post by saulres »

Request: Could you modify the code so it doesn't flag every one of the mod's posts that has "Vote Count" in it?

And holy crap that is cool!
"SAULRES you are THE man! Fav mod eva, no contest!" - Bert; "Saulres is a fantastic mod, if he is running a game everyone needs to join it." - FuDuzn
Nominated for Paperback Writer Scummie 2013 and 2014!
On permanent
V/LA
Friday afternoons through Saturday nights.
User avatar
callforjudgement
callforjudgement
Microprocessor
User avatar
User avatar
callforjudgement
Microprocessor
Microprocessor
Posts: 3972
Joined: September 1, 2011

Post Post #14 (ISO) » Wed Aug 01, 2012 11:58 am

Post by callforjudgement »

In post 13, saulres wrote:Request: Could you modify the code so it doesn't flag every one of the mod's posts that has "Vote Count" in it?

And holy crap that is cool!


It'll only trigger on "vote count" if it's bolded; there's no trivial fix to avoid mod posts, although I guess I could avoid triggering on bolded text that only contained "vote" immediately before "count".
scum
· scam · seam · team · term · tern · torn ·
town
User avatar
Mr. Flay
Mr. Flay
Metatron
User avatar
User avatar
Mr. Flay
Metatron
Metatron
Posts: 24969
Joined: March 12, 2004
Location: Gormenghast
Contact:

Post Post #15 (ISO) » Wed Aug 01, 2012 2:26 pm

Post by Mr. Flay »

Might run into a problem with a user named Count Duckula...
Retired as of October 2014.
User avatar
saulres
saulres
Mafia Scum
User avatar
User avatar
saulres
Mafia Scum
Mafia Scum
Posts: 4173
Joined: July 25, 2011

Post Post #16 (ISO) » Wed Aug 01, 2012 4:31 pm

Post by saulres »

In post 14, callforjudgement wrote:there's no trivial fix to avoid mod posts


It should be, though, shouldn't it? If I had more time I'd do it for you. Maybe tomorrow. But the gist would be:

Add a <MOD option similar to the <DEAD one to the "player" list

Then wrap an
if uNames[ui] == "MOD"
around the "// Look for votes in the post." logic.
"SAULRES you are THE man! Fav mod eva, no contest!" - Bert; "Saulres is a fantastic mod, if he is running a game everyone needs to join it." - FuDuzn
Nominated for Paperback Writer Scummie 2013 and 2014!
On permanent
V/LA
Friday afternoons through Saturday nights.
User avatar
Junpei
Junpei
Jack of All Trades
User avatar
User avatar
Junpei
Jack of All Trades
Jack of All Trades
Posts: 5226
Joined: June 24, 2011

Post Post #17 (ISO) » Wed Aug 01, 2012 5:36 pm

Post by Junpei »

I'd be willing to use this in my up comign mininormal as well if you put in a doublevoter and voteblocking mechanics to offer completeness.

Super cool though man nice work.
The melody of logic always plays the notes of truth.

https://www.youtube.com/watch?v=iA41ggsdeXE
User avatar
GreyICE
GreyICE
Fifty Shades
User avatar
User avatar
GreyICE
Fifty Shades
Fifty Shades
Posts: 15455
Joined: December 15, 2010

Post Post #18 (ISO) » Thu Aug 02, 2012 12:55 am

Post by GreyICE »

Well it's impossible to use in existing games, and it should give you an option with a checkbox to ignore unprocessed votes (with a warning that this might make vote counts inaccurate).
Show
That which is done out of love always takes place beyond good and evil


Official Visigoth

Read Mother Jones
User avatar
saulres
saulres
Mafia Scum
User avatar
User avatar
saulres
Mafia Scum
Mafia Scum
Posts: 4173
Joined: July 25, 2011

Post Post #19 (ISO) » Thu Aug 02, 2012 5:26 am

Post by saulres »

In post 16, saulres wrote:Then wrap an if uNames[ui] == "MOD" around the "// Look for votes in the post." logic.


Oh I see now why that won't work.

Working on it.
"SAULRES you are THE man! Fav mod eva, no contest!" - Bert; "Saulres is a fantastic mod, if he is running a game everyone needs to join it." - FuDuzn
Nominated for Paperback Writer Scummie 2013 and 2014!
On permanent
V/LA
Friday afternoons through Saturday nights.
User avatar
saulres
saulres
Mafia Scum
User avatar
User avatar
saulres
Mafia Scum
Mafia Scum
Posts: 4173
Joined: July 25, 2011

Post Post #20 (ISO) » Thu Aug 02, 2012 6:01 am

Post by saulres »

Okay, got it working. Except one line isn't making sense to me. I'll PM you the code and the line question.
"SAULRES you are THE man! Fav mod eva, no contest!" - Bert; "Saulres is a fantastic mod, if he is running a game everyone needs to join it." - FuDuzn
Nominated for Paperback Writer Scummie 2013 and 2014!
On permanent
V/LA
Friday afternoons through Saturday nights.
User avatar
saulres
saulres
Mafia Scum
User avatar
User avatar
saulres
Mafia Scum
Mafia Scum
Posts: 4173
Joined: July 25, 2011

Post Post #21 (ISO) » Thu Aug 02, 2012 6:05 am

Post by saulres »

:oops: Oh whoops. Didn't fully test.

I got as far as restricting the dropdowns from appearing on the mod's posts, but that seems to have broken the count. I don't have more time for this now.

But I've sent you the code so you can see what I did, and hopefully your familiarity with the original source will help you troubleshoot that.
"SAULRES you are THE man! Fav mod eva, no contest!" - Bert; "Saulres is a fantastic mod, if he is running a game everyone needs to join it." - FuDuzn
Nominated for Paperback Writer Scummie 2013 and 2014!
On permanent
V/LA
Friday afternoons through Saturday nights.
User avatar
saulres
saulres
Mafia Scum
User avatar
User avatar
saulres
Mafia Scum
Mafia Scum
Posts: 4173
Joined: July 25, 2011

Post Post #22 (ISO) » Thu Aug 02, 2012 8:46 am

Post by saulres »

I don't know why I keep updating this thread when all that's necessary is to make sure the PM to CFJ is right.

I think I've got it fully functional, will hold further conversation to PMs.
"SAULRES you are THE man! Fav mod eva, no contest!" - Bert; "Saulres is a fantastic mod, if he is running a game everyone needs to join it." - FuDuzn
Nominated for Paperback Writer Scummie 2013 and 2014!
On permanent
V/LA
Friday afternoons through Saturday nights.
User avatar
callforjudgement
callforjudgement
Microprocessor
User avatar
User avatar
callforjudgement
Microprocessor
Microprocessor
Posts: 3972
Joined: September 1, 2011

Post Post #23 (ISO) » Fri Aug 03, 2012 4:35 am

Post by callforjudgement »

OK, I've updated the script (same URL).

New features include:
  • You can add the moderator to the list of players, marked as a mod ("<MOD"); this causes any of their posts to be assumed to not contain votes by default, although you can override this (say, to "reset vote count") if you want to (this is based on saulres' code, but with several bugs fixed, including one very serious one);
  • You can mark players as doublevoters or nonvoters using "<2" or "<0" respectively; this will make no visible change except to the total number of votes at the start of each line;
  • If the script is very sure that a particular comment is for a particular vote or unvote, it will automatically default to that (the player name needs to be spelled exactly right, although case doesn't matter, and be in a standard format like
    vote: callforjudgement
    ,
    unvote, vote callforjudgement
    or VOTE: callforjudgement), so that in the obvious cases, the mod won't have to do the quality check (the quality check is still required in the case that the player misspells or abbreviates the name, though, or uses an unusual format).
scum
· scam · seam · team · term · tern · torn ·
town
User avatar
saulres
saulres
Mafia Scum
User avatar
User avatar
saulres
Mafia Scum
Mafia Scum
Posts: 4173
Joined: July 25, 2011

Post Post #24 (ISO) » Fri Aug 03, 2012 4:37 am

Post by saulres »

In post 23, callforjudgement wrote:one very serious one


Ouch :(

PM me with what it was?

(Told'ja I didn't fully test it.)
"SAULRES you are THE man! Fav mod eva, no contest!" - Bert; "Saulres is a fantastic mod, if he is running a game everyone needs to join it." - FuDuzn
Nominated for Paperback Writer Scummie 2013 and 2014!
On permanent
V/LA
Friday afternoons through Saturday nights.
Post Reply

Return to “Mafia Discussion”