Computational Mafia

This forum is for discussion related to the game.
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #39 (isolation #0) » Sat Jun 08, 2019 8:37 am

Post by Plotinus »

I use Thesp's votecounter http://www.robandkriskris.com/votecounter/

it's reasonably fast, giving an accurate answer in a few seconds, and it's online so i don't have to run anything.


I have almost entirely automated the task of setting up a newbie game -- posting in all the private topics and randomising the roles and sending out all the role PMs and bookmarking the threads and adding my girlfriend to the dead thread as a spectator and all those little fiddly details, but it still requires human intervention a little bit -- some intentional (it asks you if everything is okay before submitting the role PMs, for example, and you have to type in your password to the browser your own self, it won't do that for you, but there's also a small race condition i'm still figuring out that sometimes requires that i manually hit the back button in the browser to get it back on track.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #40 (isolation #1) » Sat Jun 08, 2019 8:39 am

Post by Plotinus »

As of now, though, it can get a game entirely set up in 10 minutes, including time spent waiting for me to google some cool things to use as flavour.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #42 (isolation #2) » Sat Jun 08, 2019 6:16 pm

Post by Plotinus »

After the next newbie game starts (I'm next in line), I'll know if I've fixed my race condition, if I have then I'll push my change.

setup a game (requires: selenium) : MafiaMod
also requires these files: files

It's all set up for my own defaults so you would need to:
  • Edit the files in files/public/ to format the OP how you'd like
  • Search for the word "hubris" and remove it if you dont want to add my girlfriend to your deadthread. (This step will be easier in the next version, you'll be able to do --spectators = "person1 person2 person3")
  • If you're not modding a newbie game, put your role PMs in the files/roles directory and add the roles names to the setups dictionary.
  • Also change this to be whatever subforum you'll be putting the game in

    Code: Select all

        if whichThread == 'public':
            url = 'https://forum.mafiascum.net/posting.php?mode=post&f=11'
If you want to increase the size of the deadline smoothly throughout the dayphase, calculate the times that you should do it at: mafiaDeadlines

When should I prod somebody next, given that time passes slower on the weekends and they might be v/la: MafiaProd

Give me a list of countdown timers to post in the mod PT of when everybody should be prodded next, if the nightphase doesn't reset countdown timers, time passes more slowly on weekends, and some people are V/LA: NightProd (has a bug that i haven't figured out yet), requires BeautifulSoup
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #43 (isolation #3) » Thu Jun 13, 2019 8:04 am

Post by Plotinus »

Okay, the bug is fixed! I used it to set up a game just now and there were finally no showstoppers. My script is ready for public consumption.

So here is how I would set up Game 1933, Stuff I Found Online XII, the last game of mine that finished. The setup was C2 and there were 5 specators, which for the sake of demonstration I will pretend were added at the very start of the game:

Code: Select all

python3 mafiaMod.py -u Plotinus C2 1927 "Stuff I Found Online XII" --spectators="hubris PvtUrist Muffins ZestOfLife chennisden"


It will ask me to paste in the playerlist. Now it will randomise the roles and open a new Firefox window, where it will fill in my username for me, but ask me to type my password into the form myself and hit enter in the terminal once I've succeeded.

Then it prompts me through getting the flavour ready, asking for a picture for the OP, a link, a little bit of text to go with it. You can just hit enter to skip anything you don't want to put in. I like to put youtube videos for my death scenes so it'll ask for a youtube video for the day 1 lynch and save a template for the first flip in the mod PT, but again you could just hit enter to skip it.

It pauses for about 5 seconds between posts it makes, to avoid DDOSing the site and also to avoid the "you can't make posts that quickly" error message that mafiascum's flood protection puts out.

Once it's got all the PTs set up, it'll start sending out role PMs. It won't hit the send button for you on the role PMs, instead it'll ask you "Everything okay?" and you can hit enter in the terminal if the role PM is good and then it'll send it.

Once it's sent all the role PMs, it'll post your rules into the public thread and the generic newbie setup information posts, and the mod IC post, and finally the "All role PMs are out, we'll start in 2 days" message -- it rounds the deadline up to the next half hour or so.

your mod PT will look like this
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #44 (isolation #4) » Thu Jun 13, 2019 8:08 am

Post by Plotinus »

it also adds the listmod as a moderator to all your PTs, and bookmarks all the threads for you. The default listmod is PenguinPower. You can change it like

Code: Select all

-l Untrod Tripod
, or if you have a backup moderator you could put their name instead.

Also the default spectator is my girlfriend so do this if you don't want that:

Code: Select all

-s ""
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #46 (isolation #5) » Thu Jun 13, 2019 8:34 am

Post by Plotinus »

I'm not sure what you're asking? My program just automates the process of getting the game set up, so it reads from files and makes the posts. The listmod tells you which setup to use, and then you tell the program which setup it is. It picks who will have which role at random and then sets everything up.

The role PMs are in files like this one. It automatically replaces PUBLICTHREAD with the link to the actual thread.

It only does pregame right now, so it doesn't count votes or make sure everybody is behaving or prod people.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #48 (isolation #6) » Thu Jun 13, 2019 8:53 am

Post by Plotinus »

oh. well if you just want the literal content of the posts, maybe one column for each player, that should be pretty easy to do. if you want to do something interest with the data then it will get harder depending what you want to do.

I'd recommend the free online book automate the boring stuff with Python. Chapters 11 and 12 will walk you through making something that downloads posts and puts them into a spreadsheet. Depending on your level of background knowledge, you might need to start at chapter 1, which explains the basics in an accessible way.

I have a program that does some calculations about prod timers, and it downloads information from the game overview page. The downloading part is literally just

Code: Select all


def parse_page(url):
    res = requests.get(url)
    res.raise_for_status()
    return BeautifulSoup(res.text, "html.parser")


Figuring out programmatically which time stamp goes with which player and whether or not they are V/LA is a little extra work, but not all that much


I think the easiest version of what you want to do is a really good first programming project. It's achievable in a reasonable amount of time and you'll learn a lot from trying.

I suspect the "sort the content in a way that is more MJL compatible" part might be harder, but it's still worth trying, and something you can refine over time.
Last edited by Plotinus on Thu Jun 13, 2019 9:01 am, edited 1 time in total.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #50 (isolation #7) » Thu Jun 13, 2019 9:06 am

Post by Plotinus »

I'd be curious to see it once you get it up and running
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #61 (isolation #8) » Sun Sep 29, 2019 4:17 am

Post by Plotinus »

I updated mafiaMod to account for the new newbie setup a while ago and have laid some groundwork for supporting other setups
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #64 (isolation #9) » Sun Dec 08, 2019 7:25 am

Post by Plotinus »

In post 61, Plotinus wrote:I updated mafiaMod to account for the new newbie setup a while ago and have laid some groundwork for supporting other setups
I fixed some bugs in mafiaMod and now it is currently bug free and can set up a game entirely in 7 minutes: all opening posts in the public thread, mafia PT, dead PT, and mod PT, all role PMs sent.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4

Return to “Mafia Discussion”