Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #23 from mikojimnz/V2
Browse files Browse the repository at this point in the history
V2
  • Loading branch information
mikojimnz authored Jul 16, 2020
2 parents 8cb7e44 + a1c2f70 commit 6d6f1e5
Show file tree
Hide file tree
Showing 13 changed files with 1,145 additions and 974 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,4 @@ dmypy.json
# Mac
.ds_store
test.py
*.pickle
1,071 changes: 521 additions & 550 deletions Mafia.py

Large diffs are not rendered by default.

69 changes: 39 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Mafia: MI6 VS The Twelve V1
# Mafia: MI6 VS The Twelve V2

**Who will survive? MI6 or The Twelve ?!**

Expand All @@ -10,45 +10,54 @@ Play against other members to find out who amongst each other you can trust and

*It is not recommended to play on mobile web. Please use Reddit Desktop, official Reddit App, or third party client that supports live chat.*

1. Each user is given a secret role. You cannot see each other’s roles. You may choose to bluff or try to be truthful. Introduce yourself at the beginning of the game to set the scene.
2. You must investigate each other to determine who is on what side.
3. During the Day, MI6 agents can investigate and kill users who they suspect are in The Twelve. During the Night, The Twelve can investigate and kill users who they suspect are in MI6. **Each Cycle lasts 6 hours. 2 Day/Night Rounds, 4 Cycles per day.**
4. **A user must receive at least 2 votes to be executed**. Teams members are not immune to each other. You may end up killing your own team members out of suspicion. Users who do not actively participate in the investigation may not use the !vote or !digup commands.
5. At the end of each cycle, an announcement will be made how many people are alive how many were killed.
6. You must choose your allies carefully to seek out the enemy.
1. Each user is assigned to either MI6 or the Twelve.
2. You must investigate each other to determine who is on what side and eliminate the opponent.
3. Decipher and decrypt the clues provided in order to advance your rank and unlock more powerful investigation tools.
4. Vote out players who you suspect are the enemy. A player must receive a certain number of hits in order to be killed. After a certain amount of time, the number of votes required will be lowered to 1. Votes, aka hits, only last per round.
4. At the end of each round, an announcement will be made how many people are alive how many were killed.
5. You must choose your allies carefully to seek out the enemy.

**Tips:**

* You do not need to make a new PM for each command. Simply reply to any existing PM from the bot.
* Investigators can use the !digup command multiple times times on the same user to get a better picture of their role.
- This is a passive game, you are not required to be on actively. However, users who are inactive for more than 48 hours will be kicked.
- It is recommended that you use Reddit Desktop Redesign, official Reddit apps, or third party app client that supports Reddit's Live Chat feature.
- You do not need to make a new PM for each command. Simply reply to any existing PM from the bot.
- Working in pairs is the ultimate way to win! But who can you trust?
- Use the !digup command multiple times on the same user to get a better picture of their role.
- If you are not able to use a command because you are getting a comment participation message, use a different command, such as !stats, to refresh the database so that it pulls the latest information. Note: It may take Reddit up to 30 seconds to update its comments.

**Roles**

|Role|Description|
|:-|:-|
|Handler|The Twelve. Can investigate users more reliably.|
|Assassin|The Twelve. Chance of escaping a kill order on them.|
|Analyst|MI6. Can investigate users more reliably.|
|Operative|MI6. Chance of escaping a kill order on them.|
|Team|Role|Tier|Description|
|:-|:-|:-|:-|
|The Twelve|Trainee|1|Access to digup (low accuracy), vote, and max 3 requests.|
|The Twelve|Assassin|2|Digup accuracy increased.|
|The Twelve|Handler|3|Digup accuracy increased. Unlocked locate and burn command (Tier 3 or lower). 3 Additional requests. Can escape hits.|
|The Twelve|Keeper|4|Revive unlocked. Burn does not announce who you are.|
|MI6|Recruit|1|Access to digup (low accuracy), vote, and max 3 requests.|
|MI6|Analyst|2|Digup accuracy increased.|
|MI6|Operative|3|Digup accuracy increased. Unlocked locate and burn command (Tier 3 or lower). 3 Additional requests. Can escape hits.|
|MI6|Supervisor|4|Revive unlocked. Burn does not announce who you are.|

**Commands**

All commands must be sent privately to u/DozenIncBOT
All commands must be sent privately to u/DozenIncBOT. To use investigative commands, use must comment at least once per round to avoid being kicked for inactivity.

|Command|Description|
|:-|:-|
|!join|Join the game. Note: You cannot rejoin once the game has started.|
|!leave|Leave the game.|
|!list|Shows dead and alive players.|
|!request USERNAME|Ask for intel anonymously on a player.|
|!burn|Exposes one of your team members for guaranteed intelligence about the other team. Can only be used once. Can be used by all. Unlocked after round 8.|
|!revive USERNAME|Brings back a player from the dead. Can only be used once|
|!vote USERNAME|Vote on who to eliminate. Can be changed until the Cycle ends.|
|!digup USERNAME|Investigate the roles of other users. Has varying degree of reliability.|
|!locate USERNAME|Shows the user's location. May give a clue as to what side they are on. Can be used by all. Limited number of uses.|
|!stats|Gets the current stats for the game.|
|!help|Shows all commands available.|
|!rules|Shows the rules.|
|Command|Description|Unlock Tier|
|:-|:-|:-|
|!join|Join the game. Note: You cannot rejoin once the game has started.|1|
|!leave|Leave the game.|1|
|!list|Shows dead and alive players.|1|
|!request USERNAME|Ask for intel anonymously on a player. Limited number of uses.|1|
|!burn|Exposes one of your team members for guaranteed intelligence about the other team. Can only be used once.|3|
|!revive USERNAME|Brings back a player from the dead. Can only be used once|4|
|!vote USERNAME|Vote on who to eliminate. Can not be changed once voted per round.|2|
|!digup USERNAME|Investigate the roles of other users. Has varying degree of reliability based on your tier|1|
|!locate USERNAME|Shows the user's location. May give a clue as to what side they are on.|3|
|!stats|Gets the current stats for the game.|1|
|!help|Shows all commands available.|1|
|!rules|Shows the rules.|1|
|!unlock CODE|Enter a secret code in order to level up to the next tier.|1|

**Flairs**

Expand Down
1 change: 1 addition & 0 deletions data/save.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"state": 0, "curCycle": 0}
114 changes: 0 additions & 114 deletions database.sql

This file was deleted.

146 changes: 146 additions & 0 deletions init/database.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
-- MySQL Script generated by MySQL Workbench
-- Wed Jul 8 00:41:18 2020
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema Reddit
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `Reddit` ;

-- -----------------------------------------------------
-- Schema Reddit
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `Reddit` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin ;
-- -----------------------------------------------------
-- Schema reddit
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `reddit` ;

-- -----------------------------------------------------
-- Schema reddit
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `reddit` ;
USE `Reddit` ;

-- -----------------------------------------------------
-- Table `Reddit`.`Log`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `Reddit`.`Log` ;

CREATE TABLE IF NOT EXISTS `Reddit`.`Log` (
`utc` INT NOT NULL,
`username` VARCHAR(20) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL,
`action` VARCHAR(255) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL,
PRIMARY KEY (`utc`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_bin;


-- -----------------------------------------------------
-- Table `Reddit`.`Mafia`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `Reddit`.`Mafia` ;

CREATE TABLE `Mafia` (
`utc` int NOT NULL,
`username` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`team` int NOT NULL DEFAULT '-1',
`tier` int NOT NULL DEFAULT '0',
`loc` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`alive` int NOT NULL DEFAULT '1',
`diedOnCycle` int DEFAULT NULL,
`burn` int NOT NULL DEFAULT '1',
`revive` int NOT NULL DEFAULT '1',
`request` int NOT NULL DEFAULT '3',
`comment` int NOT NULL DEFAULT '0',
`inactive` int NOT NULL DEFAULT '0',
PRIMARY KEY (`utc`),
UNIQUE KEY `Mafiacol_UNIQUE` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin

CREATE UNIQUE INDEX `Mafiacol_UNIQUE` ON `Reddit`.`Mafia` (`username` ASC) VISIBLE;


-- -----------------------------------------------------
-- Table `Reddit`.`VoteCall`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `Reddit`.`VoteCall` ;

CREATE TABLE IF NOT EXISTS `Reddit`.`VoteCall` (
`username` VARCHAR(20) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL,
`vote` VARCHAR(20) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL,
PRIMARY KEY (`username`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_bin;

CREATE UNIQUE INDEX `username_UNIQUE` ON `Reddit`.`VoteCall` (`username` ASC) VISIBLE;

USE `reddit` ;
USE `Reddit` ;

-- -----------------------------------------------------
-- procedure role_cnt
-- -----------------------------------------------------

USE `Reddit`;
DROP procedure IF EXISTS `Reddit`.`role_cnt`;

DELIMITER $$
USE `Reddit`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `role_cnt`()
BEGIN
SELECT team,COUNT(*) as cnt
FROM Mafia
GROUP BY team
ORDER BY team DESC;
END$$

DELIMITER ;

-- -----------------------------------------------------
-- procedure role_cnt_alive
-- -----------------------------------------------------

USE `Reddit`;
DROP procedure IF EXISTS `Reddit`.`role_cnt_alive`;

DELIMITER $$
USE `Reddit`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `role_cnt_alive`()
BEGIN
SELECT team,COUNT(*) as cnt
FROM Mafia
WHERE alive=1
GROUP BY team
ORDER BY team DESC;
END$$

DELIMITER ;
USE `reddit` ;

-- -----------------------------------------------------
-- Placeholder table for view `reddit`.`rolecnt`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `reddit`.`rolecnt` (`team` INT, `count` INT);

-- -----------------------------------------------------
-- View `reddit`.`rolecnt`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `reddit`.`rolecnt`;
DROP VIEW IF EXISTS `reddit`.`rolecnt` ;
USE `reddit`;
CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `Reddit`.`rolecnt` AS select `Reddit`.`Mafia`.`team` AS `team`,count(`Reddit`.`Mafia`.`team`) AS `count` from `Reddit`.`Mafia` where (`Reddit`.`Mafia`.`alive` = '1') group by `Reddit`.`Mafia`.`team` order by `Reddit`.`Mafia`.`team` desc;

SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
Loading

0 comments on commit 6d6f1e5

Please sign in to comment.