Author Topic: MafiaBot - A IRC bot to play mafia  (Read 18764 times)

0 Members and 1 Guest are viewing this topic.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
MafiaBot - A IRC bot to play mafia
« on: August 05, 2012, 03:11:29 pm »
MafiaBot
Online on #omnimaga-games
So, what is it about? It's all about playing mafia! If you don't know the game then check out http://en.wikipedia.org/wiki/Mafia_(game)
Now, this bot plays the game manager/narrator.
So now, how do I use this bot?
Spoiler For Commands:
CommandDescription
new userCreates a new user: /msg MafiaBot new user <username> <password>
loginLogs into a account: /msg MafiaBot login <username> <password>
logoutLogs out: /msg MafiaBot logout
set passwordChanges password: /msg MafiaBot set password <oldpasswd> <newpasswd>
set usernameChanges username: /msg MafiaBot set username <newUsername>
set emailSets a email to a account: /msg MafiaBot set email <email>
recoverpasswdRecovers a password of a account via email: /msg MafiaBot recoverpasswd <username>
whoisReturns which username has the irc user: (/msg MafiaBot whois|>whois) <nickOnIRC>
whoisircReturns irc user has the username: (/msg MafiaBot whois|>whois) <nickForBot>
whoamiReturns your user role: /msg MafiaBot whoami
usersReturns the users which have currently joined the game: (/msg MafiaBot users|>users)
voteVote for a person to be killed (pm mafia only at night): (/msg MafiaBot vote|>vote) <username>
votesReturns the current votes for someone (pm mafia only at night): (/msg MafiaBot votes|>votes) <username>
votedReturns the users which already have voted: >voted
notvotedReturns the uers which haven't voted yet: >notvoted
bombBombs a person, terrorist only. You will die too: >bomb <username>
saveSave a person at night (doctor only): /msg MafiaBot save <username>
joinJoins the game, only possible if not in-game:  >join
leaveLeaves the game, only possible if not in-game: >leave
startStarts a game with <args> special users, seperated with comma (,): >start <args>
specialCharactersIf in-game it displays the special characters used, else the ones available. >specialCharacters
timeOutputs the current time (day/night): >time
So, now that we have all commands it would be awesome to know each character:
Spoiler For Characters:
CharacterDescription
CitizenYou are citizen, you can just vote at day who to kill, your goal is to kill all mafia.
DetectiveYou are detective, part of the citizen community. During night you can find out who is mafia and who not.
DoctorYou are doctor, part of the citizen community. During night you can save a person from death, but you don't know who will die.
JustinYou are justin. If you manage to be killed in the first round you win the game, otherwise you are a normal citizen.
HunterYou are hunter, part of the citizen community. If you are killed you can kill immidatley one other person.
GardenerYou are gardener, part of the citizen community. If the detective spys on you he thinks you are for the mafia.
FoolYou are fool, your own party. If you are killed in the night you don't die, you are 'sharpened'. If you are voted to death during day and are 'sharpened' you win. If you die in other ways you lose.
FreemasonYou are a freemason, part of the citizen community. You know all other freemasons and know for sure that they are not mafia.
MatchmakerYou are matchmaker, part of the citizen community. During nighttimes must choose two people and it returns if they are in the same group or not.
MafiaYou are mafia. Your gole is it to kill all citizens. You can kill a citizen at nighttime!
TerroristYou are terrorist, part of the mafia community. You can't vote during night-time as the other mafia, you don't even know who the other mafia is. The other mafia also don't know who you are. During daytime you can bomb a person, that person will die immediately, so will you.
GodfatherYou are godfather, part of the mafia community. If the detective spys on you he thinks you are for the citizens.
About starting the game - I tried to make it as user-friendly as possible so when starting the game you can choose which special characters to use. You have to have at least 4 users joined the game to be able to start it. Then, you can type ">start" to start without any special characters, or, if you prefer with special characters you can do stuff like this (now for doctor and detective as special characters) ">start doctor,detective". If you enter some stuff invalid like to many special characters etc. it will only display that it is invalid, not why, as that would have been a LOT more complex. If your type-lazy you can also only type the first three letters of a character, so for doctor and detective it would be ">start doc,det".

Admin-stuff:
MafiaBot features also a user-right system, it is only there to prevent if someone blocks a game or something like that.
Spoiler For admin-commands:
CommandDescription
set adminSets a person as admin. Admin only: /msg MafiaBot set admin (true|false) <user>
kickKicks a user if not in-game. Admin only: >kick <user>
quitgameQuits the current game. Admin only: >quitgame
So, have fun playing mafia!
And if you have any problems or found any bug feel free to email me!
Spoiler For original message:
My entry for coding battles is....a mafia bot!
Yes, the classic game mafia. It will manage everything.
Just thought I'll post this so that no one will steal my idea :P
« Last Edit: September 18, 2012, 09:41:36 pm by Sorunome »

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: [contest] MafiaBot
« Reply #1 on: August 05, 2012, 03:13:25 pm »
Dang thats close to the idea I'm still coming up with. I'll make sure its different though. Good luck
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [contest] MafiaBot
« Reply #2 on: August 06, 2012, 07:09:43 am »
What's a good number of people who are mafia compared to citizens?
I made now that max 25% of all users can be mafia
EDIT: for those who haven't noticed, atm MafiaBot is running on #omnimaga-spam for some testing :D
usage (need to program a help section, lol (if you are on OmnomIRC replace /msg MafiaBot with /msg Sorunome):
general:
creating new account: /msg MafiaBot new user <username> <password>
logging in: /msg MafiaBot login <username> <password>
logging out: /msg MafiaBot logout

joining game (not working if a game is running):
joining: >join
leaving: >leave
display users joined: >users
start the game: >start

in-game:
find out username of irc nick: /msg MafiaBot whois <nick>
>whois <nick>
find out irc nick of username: /msg MafiaBot whoisirc <nick>
>whoisirc <nick>
your role: /msg MafiaBot whoami
night (mafia only):
Display users: /msg MafiaBot users
Vote for user to be killed: /msg MafiaBot vote <user>
Display number of votes: /msg MafiaBot votes <user>
day (everyone):
Display users: >users
Vote for user to be killed: >vote <user>
Display number of votes: >votes <user>

things to add:
changing username, changing password, deleting account, cool stuff :D
« Last Edit: August 06, 2012, 03:26:22 pm by Sorunome »

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline hellninjas

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 625
  • Rating: +17/-0
    • View Profile
Re: [contest] MafiaBot
« Reply #3 on: August 06, 2012, 04:57:47 pm »
Me want play Sorunome...
Get more people :P

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: [contest] MafiaBot
« Reply #4 on: August 06, 2012, 06:23:58 pm »
Hm, after playing this game, I realize that it is actually fun to kill people. :P Anxiously awaiting further progress!
« Last Edit: August 06, 2012, 06:24:34 pm by parserp »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [contest] MafiaBot
« Reply #5 on: August 06, 2012, 06:27:27 pm »
Haha, thanks :P
Have fun learning that there will be characters with special abilities :P

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: [contest] MafiaBot
« Reply #6 on: August 06, 2012, 07:01:53 pm »
Me wants doctors and comp players so you always have 5+ people

EDIT: and I'm wondering how the passwords are stored are they encrypted?
« Last Edit: August 06, 2012, 07:14:27 pm by ruler501 »
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [contest] MafiaBot
« Reply #7 on: August 06, 2012, 07:09:14 pm »
That's really a GOOD bot, even if it's not finished yet :) carry on this way !

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [contest] MafiaBot
« Reply #8 on: August 07, 2012, 04:11:03 am »
Me wants doctors
Wanted to add anyways :P
Quote
and comp players so you always have 5+ people
bad idea, as they couldn't really discuss with the other people, mafia actually isn't about DIE DIE DIE KILL KILL KILL but about discussing
Quote
EDIT: and I'm wondering how the passwords are stored are they encrypted?
md5-hashed, the algorythim is from the internet :P
If that is outside contest rules i'll change that ^^ (but languages like php have that algorythm built in)
(I also use base64 encode and decode algorythm from internet to make it possible to have pm omnomirc support (and that is everything i didn't do on my own, but maybe be able, lol))

That's really a GOOD bot, even if it's not finished yet :) carry on this way !
thanks! :D

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: [contest] MafiaBot
« Reply #9 on: August 07, 2012, 06:21:27 am »
The md5 is fine my only concern was whether they were cleartext. For the comp players maybe make them be able to talk a little?
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [contest] MafiaBot
« Reply #10 on: August 07, 2012, 06:24:44 am »
I'm bad at making AI's D:

And the passwords are just text, md5 hashed

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: [contest] MafiaBot
« Reply #11 on: August 07, 2012, 06:27:51 am »
but the point is they are not in readable text by humans, and yeah the AI might be a little hard to code(thouhg it would be awesome)
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [contest] MafiaBot
« Reply #12 on: August 07, 2012, 06:31:43 am »
Yeah, passwords can't be read by humans if they don't look at the program output as I cout everything the bot recieves for debugging. Well, it would be possible to hardcore brake the passwd by trying through every possible solution :D

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [contest] MafiaBot
« Reply #13 on: August 12, 2012, 06:24:29 am »
So, I have made a lot of work without posting about it O.o
first of all, I programmed a help section! :D You access it either by typing '>help' or by pm'ing the bot help. To get more detailed help you do stuff like '>help vote'
Now, I made a bunch of special characters:
Detective: Can spy out a person during night and see if he is for/against mafia
Doctor: Can save one person during night, so if he is killed by the mafia he is still alive
Justin: If he manages to be killed during the first day the game is over and he wins alone
Hunter: If he dies he can kill someone immidiatley
Terrorist: He is for the mafia, but he doesn't know the other mafia, they also don't know him. He doesn't participate in voting during nights, on day he can kill someone but he dies then too (suicide bomber)

If you have any other ides for special characters then tell me :D

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: [contest] MafiaBot
« Reply #14 on: August 12, 2012, 01:20:03 pm »
Yeah, passwords can't be read by humans if they don't look at the program output as I cout everything the bot recieves for debugging. Well, it would be possible to hardcore brake the passwd by trying through every possible solution :D
Using the word "bruteforce" would be faster" ;)




The missing characters are "Armor" and "white wolf" (from werwolf - the original game)
Armor cupples two persons. If oneof them dies, they'll both die

the white wolf participates in voting at night, too!
but he also tries to kill the other wolfes!
He wins when every wolf except him is dead!
(other wolfs try to kill him, too! They don't know who he is!)
in ecery round, he ills one of the other wolfes
« Last Edit: August 12, 2012, 01:20:39 pm by p2 »
*insert supercool signature*