~ Introduction ~
Mafia Simulator is a program based on Dark.Revenant's SC2 Map "-Mafia-" and Forum Mafia on councilofmages.com.
It features almost all roles present in those environments and their options, as well as some new stuff added by the programmers.
With this program, you can simulate almost every setup you could see in SC2Mafia, or even add players for simulating more populated environments. The AI is pretty simple, as it cannot properly emulate human brain and players interaction, however it takes into account all actions that in-game roles could do, memorize them, and use them when time is due. For example, if a sheriff finds mafia, that player will be lynched next day.
Organized teams will also try their best to accomplish their victory condition: mafia and cult will never vote against their own members, culted doctors will heal the cult leader, consigliere will find town power roles and send mafia to kill them the following night, and so on.
Set roles options as you see fit to recreate some of the most entertaining conditions for a mafia game. Then enjoy reading the log and see what happened.
Alternatively you can run a high number of simulations - multithread helps - and then check the graphs to see if it is nearly balanced or if it needs more tweaks.
~ Screenshots ~
Here you can see a screenshot of the program, one of the game log and one of the graph results that are generated after every simulation.

~ Download Links ~
You can download the last version here:
Windows (v1.3.1): https://goo.gl/9138S (You need to have .NET Framework 4.0 installed)
Mac (v1.3.1): https://goo.gl/JVfxI (You need to have Mono 2.10.5 installed)
Source code (v1.3.1): https://github.com/Illidanz/MafiaSimulator (Licensed under the MIT license)
~ Instructions ~
It's pretty straightforward: you make a setup like in mafia, set the options for every role or leave them at default, set the number of iterations you want, hit Simulate and when the green bar reaches the end you can see the results under it or by clicking the Last Graph button.
If you want log games to see what happens, check the option and click the Last Games button after the simulation to open the game log in your default browser.
When you need to do a lot of simulations (1.000+) you should check the Multithreaded option so everything is faster if you are on a dual or quad core machine.
If you make a cool setup, you can share it by using the "Export Config" button and paste here the config. Then people can copy it and use the "Import Config" button to try your setup and options!
Here's an example of an exported configuration, just click "Select" then copy and paste it in the program.
Code:
101|a|x,|N,|O,|j,|h,|o,|o,|d,|U,|S,|S,|S,|G,|P,|P;|_10,1,1,0;|b1,1;|c:1;|d|Y|e|X|h|5|i:0;|j|#,1,1;|m|V|l|£|o|^|q|@,0,1,0;|r|[,0,0;|s|W|t|0|u|W|w|W|x|(|z:;|A|#,1,1;|B|\|C|@,0,1,1,0;|F|4|G|5|H|9|I|X|J|7|K|7|L|7|M|7|N|Z|O|7|P|&|Q|7|R|7|S|7|T|7|U|*
~ Other Notes ~
It's not supposed to simulate real mafia games, as obviously the AI is very limited, but it can do awesome things. Just look at how witches and bus drivers mess up the whole game, or the clashes between masons and cultists!
The only role missing for the moment is the SC2-Cultist. Detective and Lookout are only partially implemented.
The Cult Leader and recruiting-masons from Forum Mafia are implemented, as I find them way more fun than the sc2 counterparts.
If this little thing amuses you too and you wish to take part in its develompent, please report me any bug you find, and feel free to send me any suggestion and/or request that comes to mind.
Many thanks to Raiden for his awesome testing and ideas!
~ Changelog ~
Code:
1.3.1:
- If masons have the majority and the town has no clue they will random lynch a non-mason.
- Mason Leader is now immune to mismason.
- Fixed detection immunity.
1.3.0:
- Implemented Disguiser.
- Implemented Executioner.
- Partially implemented Detective and Lookout. They are currently excluded from randoms until they aren't implemented better, but they won't mess inv results now.
- Several improvements and fixes to investigator's role guessing.
- Arsonists always knows if they are doused, even if the options is disabled.
- Options are saved also when you click Simulate instead of only when you exit the program, so you don't lose them in case of a crash.
- Fixed a bug with the cult suicide not happening under certain conditions.
- Several other minor fixes.
1.2.0:
- Completely changed the way town manages clues and decides who to lynch.
- Implemented last wills.
- Implemented Investigator.
- Implemented Janitor.
- Implemented Coroner.
- Implemented Mason Leader. If he's in a game with recruiting masons, he will be the one sent to recruit unless he's jailed. There's also an option to have him kill the Cult Leader on recruit, to differentiate him a little bit from recruiting masons (enabled by default).
- Implemented Mason's "Replaces Mason Leader" option.
- Implemented Doctor's "Knows if targets is converted" option. If "Prevents Cultist conversion" is disabled, he will try to lynch the new cultist if no other leads are available
- Implemented Consigliere's "Detects exact role" option. He won't kill
- Implemented "Random Names" option in the Global tab, enabled by default. Uses the same names as sc2mafia.
- Changed the random generator from Mersenne Twister to the C# cryptographically secure PRNG for the maximum possible randomness and avoiding patterns under rare conditions.
- Now the cult half-suicide is rounded up instead of down.
- Fixed a crash with empty setups.
- Fixed Random Town options not being focused when selecting the role.
- Fixed framer not affecting Consigliere checks.
- Fixed sheriffs sometimes not choosing a target.
- Fixed sheriffs sometimes checking themselves.
- Fixed amnesiac new role report.
- Fixed some reports line not being colored.
- Added the simulation progress to the Windows 7 taskbar.
1.1.1:
- Slightly changed the import/export functions to be more intuitive and make them work under Mac.
- Added the icon to the Mac app.
- Fixed a rare crash when a BD can't pick up 2 targets.
- Fixed randoms sometimes spawning without a role.
1.1.0:
- Implemented the proper mechanic for Witch/BD/Roleblockers. See https://peeeq.de/gui.php?id=2621
- Implemented Arsonist's "Victim knows he is doused" option. Arsonists will now undouse if they gets doused. They can also undouse other targets if they get bus driven.
- Culted Arsonists will no longer try to douse targets they already doused when unculted.
- If town tries to lynch an unrevealed mayor, he will reveal and town will lynch another target. Previously the day was just ending.
- If the witch manipulate a mafia killing role that has not been sent to kill, the mafia won't do 2 kills anymore.
- Same as above for mason recruits.
- Dying cultists from the suicide after the death of the CL are randomized better.
- If a jester remains alive alone the game result will be nobody wins, not jester wins.
- Fixed healed mismasons appearing as attempted bludgeons.
- Fixed a rare crash when there are left just 3+ mafia players and the killing role is culted.
- Fixed a rare crash when there is a culted Amnesiac and no dead players.
- Added "Cannot be role-blocked" option to Amnesiac, enabled by default.
- Several performance improvements.
- Source code released on github: https://github.com/Illidanz/MafiaSimulator
1.0.0:
- First public release.