Skip to content

💵 Play Mafia/Werewolf On Your Local Network

License

Notifications You must be signed in to change notification settings

sadrasabouri/mafia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mafia

💵 Web Server Application For Mafia Game Playing On Local Network

Playing mafia game made easy simply by having:

  • a system to run mafia on it (We call it FekroBot)
  • a hotspot that can provide a local host for us (your WIFI modem or your mobile hotspot)

There you go, lets play some mafia 😎.

Usage

After cloning into mafia using command bellow:

$ git clone https://github.com/sadrasabouri/mafia

You should do these tiny steps:

  1. [Install pip3]

First check if you have pip3 installed in your system:

$ pip3 --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

if you already have installed pip3 you should see something like above, otherwise run the command bellow to install it:

$ sudo apt install python3-pip
  1. Instaling requiremets:

Then install mafia requirements by

$ pip3 install -r requirements.txt
  1. Run the server application

Now everything is ready, lets play: run the command $python3 mafia.py number_of_players[int], for example imagine you want to play mafia with 5 players.

$ python3 mafia.py 5
  1. Getting roles

There you go, now each player can open a browser and type serverhost:port_name.

In defualt mode your address should be server_ip:5000.

What player should see in the browser
  1. Tracing roles from commandline

After each role assignment a message will be prompt to GOD's commandline which inform players ip, id and his/her role, players should inform the GOD with thier unique id so that GOD can find who is who.

What GOD should see in the CLI

Game Rules

Mafia is a social deduction game, created by Dimitry Davidoff in 1986. The game models a conflict between two groups: an informed minority (the mafia team), and an uninformed majority (the Residents). At the start of the game, each player is secretly assigned a role affiliated with one of these teams. The game has two alternating phases:

  • Night Phase

a night role during which those with night killing powers may covertly kill other players

All players close their eyes. The GOD then instructs all Mafias to open their eyes and acknowledge their accomplices. The mafias suggest a "victim" by silently gesturing to indicate their target and to show unanimity then Don (Mafia's head) should decide whom to be killed then close their eyes again. A similar process occurs for other roles with nightly actions. In the case of the Detector, the GOD may indicate the target's innocence or guilt by using gestures such as nodding or head shaking.

  • Day Phase

a day role, in which surviving players debate the identities of players and vote to eliminate a suspect.

The GOD instructs players to open their eyes. Discussion ensues among the living players. At any point, a player may accuse someone of being a mafia and prompt others to vote to eliminate them. If over half of the players do so, the accused person should go to the court.Players which goes to the court may have a speech defending theirselves from not being mafia, then GOD should take votes again and this time the player with maximum vote will dead and night begins. Otherwise, the phase continues until an elimination occurs. Dead players are not permitted to attempt to influence the remainder of the game.Because players have more freedom to deliberate, days tend to be longer than nights.

The game continues until a faction achieves its win condition; for the Residents, this usually means eliminating the whole mafia team, while for the minority this usually means reaching numerical parity with the Residents.

Roles

Mafia Team

Role image(s) Descriptions
Don Don is the boss of the mafia group. At night mode Don decides whom to be killed from the mafia team.Don can't be detected by detective.
Hit Man Hit Man is a rather powerful member of mafia team. His/Her shots won't fail even if the doctor save or the victim is Bulletproof. Hit Man can use his shot only one time during the game his shot will be replaced by one of mafia's night shot.
Made Man Made Man is the one of the most powerful participant of the mafia team. Made Man gets up at night and turn one of the members of city team to Mafia.
Kind Wife Kind Wife is mafia team's sweetheart. After the day she died the mafia team get up and kill two suspects instead of one to take her revenge.
Mafia Mafia is the simple participant of the mafia team. Mafia gets up at night and try to decide which one of the players they want to kill, detective can detect this kind of mafia in night mode.

City Team

Role image(s) Descriptions
Rebel Rebel is from city team which gets up at night mode and kills a person.if the victim was chosen from residents, Rebel (him/her)self may die.
Doctor Doctor is a helpful participant of city team which gets up after mafia team and tries to rescue a person (or two in the first night) from mafia's shot.
Detective Detective is from city team gets up at night mode and tries to ask GOD if someone is good (Resident, Doctor, Rebel, Bulletproof) or bad(Mafia), but his/her first attempt to ask from. Don may be answered incorrect by GOD.
Bulletproof Bulletproof is the most powerful resident which doesn't hurt from night shots. he/she won't die through night mode.
Bride Bride is a member of city team. Bride has been engaged to Groom recently at nigh both of them will get up and see each other after death of each one of them, other one can kill anyone as a revenge of his/her sweetheart at night phase.
Groom Groom is a member of city team. Groom has been engaged to Bride recently at nigh both of them will get up and see each other after death of each one of them, other one can kill anyone as a revenge of his/her sweetheart at night phase.
Chef Chef is critical member of city team. After his/her death city team should win at last after 3 days.
Miller Miller is a member of city team. When Detective ask GOD about Millers role the result will be bad(Mafia) so Detective will be confused about Millers role and asume he/she as a mafia team member.
Undercover Cop Undercover Cop is a member of city team but he/she will act just like mafia (wakes up at night) and decide whome to be killed).
Reporter Reporter is a city team member. GOD will inform Reporter who was chosen by Made Man to become Mafia.
Grandma Grandma with gun is a frightening member of city team. She will kill anyone who tries to kill her at night. Mafia and other roles with kiling power should be aware of her.
Student Student is a innocent city team member. After His/Her death, players will kill two players at day court.
Postman Postman is a member of city team. After Postman's death he/she can select a player to die with him/her. With this power Postman can help city team by killing a mafia member.
Clown Clown is a member of city team. Clown forces someone to reveal his/her role for another players. Clown can do this just for one time and this should take place at night, GOD should be informed whos role to be reavealed.
Resident Resident is the typical player of the game. he/she has no power but to blame mafia in order to remove them from the game in day mode.

References

Icons made by Vectors Market and Pixel perfect from www.flaticon.com.

Sounds from Soundjay.