ScumBait

This forum is for discussion related to the game.
User avatar
weilawei
weilawei
Townie
User avatar
User avatar
weilawei
Townie
Townie
Posts: 95
Joined: April 27, 2008
Location: Taxachusetts

ScumBait

Post Post #0 (isolation #0) » Thu May 08, 2008 9:05 am

Post by weilawei »

I noticed on the wiki that there were a couple tools to aid mafia players. Well, I hacked together the very first version of a new tool aimed at providing vote counts, logs, and stats for Mafia players and mods alike. This is the 0.2.1 omg-kills-still-dont-work-but-post-ids-do release.

Features
  • Vote, unvote, and FoS tallies
  • Action and ignored action logs
  • Player activity percentages
  • Per player vote, unvote, FoS logs
  • Output in BBCode, JSON, and plain text
  • Save game support
Coming soon!
  • Kill support
  • Player replacements
  • Player activity rankings
  • Web/GUI interface?
  • All around more stats
Requested Features
  • Citations/quote records
  • Charts and graphs
  • Overall player history
Bugs

If it breaks trying to refresh a saved game, delete the save file and retry. This will be fixed for 0.3.
  • Settings are re-imported as dicts, not Settings objects
  • Abbreviations are seen as new players
  • Junk votes are counted
Usage Notes

This is a command line tool. I may make a GUI or web wrapper if I have time. You can specify the moderator, the game, and the start/end points where ScumBait will scan a thread.

ScumBait will always load a saved game (threadnumber.game) if there is one. To create a saved game, run with the --json option and no other reports. Save the output in threadid.game. If you don't wish to use saved data, specify --refresh to start anew or specify --start to continue from a given post. Note that you need to specify these
after
the game option. (I know this all sucks, but I'm working on it.)

Kills are currently not accounted for. This makes it harder to use for entire games, thus I'd love suggestions on what a reasonable format to expect for a kill is. I've just joined the fora, after all.

Installation

ScumBait is written in Python and you'll need to have BeautifulSoup and SimpleJSON. I've included them for convenience. It should run on any OS supporting Python.



Thanks to Kison for contributing code for post IDs. Also, thanks to Surye for offering hosting. The next release minor release (0.3) will be hosted at scumbait.datamachine.net.

From The Help


Code: Select all

ScumBait 0.2

Copyright 2008 Rob Crowther <weilawei@gmail.com>
This software is Open Source Software.
Please see the LICENSE for more details.

Available options are:
--help or -h: Display this help message
--version or -v: Display version notice
--refresh or -r: Use new data instead of saved game cache
--game or -g: Specify the thread id of the game
--bbcode or -b: Display output in bbcode
--tally or -t: Tally votes
--fos or -f: Tally FoS's
--log or -l: Log of player actions
--ignored or -i: Log of ignored/unrecognized actions
--json or -j: Dump JSON data.
--mod or -m: Specify the game moderator
--start or -s: The post to begin on (defaults to 0)
--end or -e: The post to end on (defaults to end of thread)
--player or -p: Print a report on a player

Sample usage: ./scumbait.py -b -g 10000 -m weilawei -t
This will display a bbcode tally of votes from thread 10000, run by weilawei.

If there is a file named with the game id and extension '.game',
it will be used to load settings and vote data.


Examples


To grab vote tally, FoS tally, action log, and stats for all players in game 1000, with moderator Mod:

Code: Select all

python scumbait.py -g 1000 -m Mod -tflp all


To save game 1000 data for quick report generation:

Code: Select all

python scumbait.py -g 1000 -m Mod -rj > 1000.game


To continue game 1000 from post 136:

Code: Select all

python scumbait.py -g 1000 -m Mod -s 136 -tflp all


To grab fresh data for game 1000:

Code: Select all

python scumbait.py -g 1000 -m Mod -rtflp all


To grab game 2000 being moderated by Mr. Mod:

Code: Select all

python scumbait.py -g 2000 -m "Mr. Mod" -tflp all
Last edited by weilawei on Sun May 11, 2008 12:58 pm, edited 14 times in total.
[size=67]you will birth a god and build an eternal paradise[/size]
User avatar
weilawei
weilawei
Townie
User avatar
User avatar
weilawei
Townie
Townie
Posts: 95
Joined: April 27, 2008
Location: Taxachusetts

Post Post #6 (isolation #1) » Fri May 09, 2008 1:06 pm

Post by weilawei »

The 0.2 release is upon us! Go check out the first post in this thread for details.


New features include a per player activity stat and logs and working savegames.
Surye wrote:If you want some hosting for this, shoot me a PM. I've been working on a similar tool in Python and PyQt. What's the license on your code? We might be able to help each other out.
I'd definitely be interested in better hosting than using free upload services. It's licensed under the MIT license, which I feel is less restrictive than the GPL.

Also, the a GUI sounds really great. I'm sure that with the JSON output, you'd be able to incorporate data from ScumBait in no time.

Before I go back to refactoring and writing code, I've got two issues currently. Votes, unvotes, and FoS are always put in bold and are roughly written the same. That's great. What's the definitive way to say how many players must be lynched and the way to say a player has been killed?
[size=67]you will birth a god and build an eternal paradise[/size]
User avatar
weilawei
weilawei
Townie
User avatar
User avatar
weilawei
Townie
Townie
Posts: 95
Joined: April 27, 2008
Location: Taxachusetts

Post Post #11 (isolation #2) » Fri May 09, 2008 3:51 pm

Post by weilawei »

Adel wrote:I have python 2.5 installed under XP (C:\Python25).

Which folders do I place the ScumBait, BeautifulSoup and SimpleJSONin files in? What do I type into the command line for these files to load?
Assuming you saved it to C:\Code\scumbait\ like I have it, you'd do something like:

Code: Select all

c:\python25\python.exe c:\code\scumbait\scumbait.py -g 8000 -m ModName -tfl -p all


Note that this window is going to close as soon as it finishes, so you might want to open a command line (cmd) and pipe it to a file like so:

Code: Select all

c:\python25\python.exe c:\code\scumbait\scumbait.py -g 8000 -m ModName -tfl -p all > c:\my_log.txt


Now, if you have c:\Python25 in your PATH environment variable, you won't need to type out the full path to python. Also, you -can- put BeautifulSoup and SimpleJSON in your c:\Python25\Lib\site-packages\ folder--but they should work where they are in the scumbait\ folder.

If you're on OS X or *nix, you just need to make sure it's executable (chmod +x scumbait.py) and do a command like:

Code: Select all

./scumbait.py -g 8000 -m ModName -tfl -p all
[size=67]you will birth a god and build an eternal paradise[/size]
User avatar
weilawei
weilawei
Townie
User avatar
User avatar
weilawei
Townie
Townie
Posts: 95
Joined: April 27, 2008
Location: Taxachusetts

Post Post #13 (isolation #3) » Fri May 09, 2008 4:09 pm

Post by weilawei »

Python has a vast range of available libraries, most of which I don't feel like re-implementing. I'm a professional+paid programmer, so I do these things in my spare time after work and don't have time to reinvent wheels.

NetworkX looks like a great graph library for Python, simple to get started with. I might consider support for graphs before the GUI, because the GUI is really just going to be a wrapper in many ways. Image output is a more core functionality.

Either way, I have a huge TODO list of things to do. (Oh yeah, and vim is the world's best editor. Sorry emacs guys.)
[size=67]you will birth a god and build an eternal paradise[/size]
User avatar
weilawei
weilawei
Townie
User avatar
User avatar
weilawei
Townie
Townie
Posts: 95
Joined: April 27, 2008
Location: Taxachusetts

Post Post #17 (isolation #4) » Fri May 09, 2008 4:32 pm

Post by weilawei »

I really appreciate someone besides me testing this out. =D

I'd suggest re-downloading it and trying again. I downloaded a fresh copy and it worked. I copy and pasted the command line you used.

If it still doesn't work, I'll test it out on another computer in the morning. The 0.1 release didn't have support for the -p switch.
[size=67]you will birth a god and build an eternal paradise[/size]
User avatar
weilawei
weilawei
Townie
User avatar
User avatar
weilawei
Townie
Townie
Posts: 95
Joined: April 27, 2008
Location: Taxachusetts

Post Post #21 (isolation #5) » Fri May 09, 2008 4:59 pm

Post by weilawei »

I do have a problem with names. It's hard to figure out when a sentence is ending and when it's just part of someone's name. So far, it defaults to the shortest possible form of someone's name.

I think I may try to grab the player list at the beginning and use an algorithm for close forms (similar to predictive texting). Anything else will get tossed into the ignored actions list. (Which. incidentally, is what I use to see when I'm missing votes and other odd things happen.)

TODO >_<

EDIT: I've added the post number into the log format, but it's still just going to say 0 until tomorrow when I get around to putting more than "return 0" in the id_of_post() function. Also, I've fixed names somewhat; they now recognize periods and spaces in the name. As long as the -entire- vote is in bold. Moderator names haven't been fixed yet as that's in a different part of the code. Short forms still don't add up to a vote for the full name.
Last edited by weilawei on Fri May 09, 2008 5:55 pm, edited 3 times in total.
[size=67]you will birth a god and build an eternal paradise[/size]
User avatar
weilawei
weilawei
Townie
User avatar
User avatar
weilawei
Townie
Townie
Posts: 95
Joined: April 27, 2008
Location: Taxachusetts

Post Post #24 (isolation #6) » Fri May 09, 2008 5:35 pm

Post by weilawei »

shaft.ed wrote:I now have to vote entirely in code so that the robots cannot take my brain away.
You do that and I'll sic Bruce Schneier on you.
[size=67]you will birth a god and build an eternal paradise[/size]
User avatar
weilawei
weilawei
Townie
User avatar
User avatar
weilawei
Townie
Townie
Posts: 95
Joined: April 27, 2008
Location: Taxachusetts

Post Post #25 (isolation #7) » Fri May 09, 2008 6:04 pm

Post by weilawei »

To pass a parameter with spaces or other odd things in it, you need to put it in quotes.

Code: Select all

c:\python25\python.exe c:\code\scumbait\scumbait.py -g 7703 -m "Mr. Flay" -tflp all > c:\testaab.txt


You should get a good dump this way. Post numbers and proper names for you tomorrow. (Already in my code, but I'm headed to bed now.)
[size=67]you will birth a god and build an eternal paradise[/size]
User avatar
weilawei
weilawei
Townie
User avatar
User avatar
weilawei
Townie
Townie
Posts: 95
Joined: April 27, 2008
Location: Taxachusetts

Post Post #27 (isolation #8) » Sun May 11, 2008 12:40 pm

Post by weilawei »

Thanks for the code! I'll add it into my source and I might as well do a quick upload since I've fixed some things and made changes.

EDIT: I've uploaded the new version (0.2.1 -- 0.3 will have things working a tad better)

Thanks to Surye for hosting and Kison for getting post IDs working. The next release will be hosted from scumbait.datamachine.net.
[size=67]you will birth a god and build an eternal paradise[/size]
User avatar
weilawei
weilawei
Townie
User avatar
User avatar
weilawei
Townie
Townie
Posts: 95
Joined: April 27, 2008
Location: Taxachusetts

Post Post #33 (isolation #9) » Fri Oct 03, 2008 12:30 am

Post by weilawei »

I guess I'll start working on this again. I've just been really busy with life, new job, etc. The new version will probably be something close to a rewrite. Don't look for it this weekend though, because I won't be home or have time. I'll try to get something done on Monday.
[size=67]you will birth a god and build an eternal paradise[/size]
User avatar
weilawei
weilawei
Townie
User avatar
User avatar
weilawei
Townie
Townie
Posts: 95
Joined: April 27, 2008
Location: Taxachusetts

Post Post #34 (isolation #10) » Mon Oct 06, 2008 7:00 am

Post by weilawei »

So, here's a bit of my planning doc, excluding a bit of the more technical details. Feel free to suggest changes or features that would be extensively useful to you. Remember--a lot of advanced things can be built from a combination of querying and formatting output, so anything suggested should go a -long- way.

Code: Select all

ScumBait 1.0 (rewrite)
----------------------

    - read game via backend (forum, irc)
        - backend establishes game as a series of important "bites,"
          which are potentially valuable excerpts for intelligence gathering

    - collect actions
        - mark as "direct"
            a. vote
            b. unvote
            c. nolynch
            c. nightkill
            d. lynch
            e. daykill

        - mark as "claimed"
            a. protected
            b. investigated

        - actions are tagged with
            a. timestamp
            b. direct/claimed
            c. author
            d. target
            e. game id (by database)
            f. move id (by database)

    - save actions to database
        - add in all ID #s and counts (e.g., game, move, post #)

    - accept queries
        - action type (direct, speculative, both)
        - date/time range
            - both real-world time
            - and game time

    - output via frontend templates (html, text, etc.)
[size=67]you will birth a god and build an eternal paradise[/size]
Post Reply

Return to “Mafia Discussion”