Since I got kinda bored and am actually okay at coding (miraculously!), I decided to write a random role assigner for the Russian card game Mafia, which was rather popular at the National Computer Science School I went to recently. An awesome game, but I'll carry on. If you want to read more about it, you can find rules here.
As I'm still not really proficient in Python, I required a bit of help, but it was fun all the same, and I felt like sharing it with you all as its the first bit of code that I wrote and have on my blog. :)
It has the following features:
- Define your own number of players and amount of Mafia members
- Completely random assignment of roles to players
- Looking up a player's name to see what role they are, in case of memory loss or other problems.
There are several disadvantages, however that I haven't yet been able to fix:
- No extra roles like Doctor, Investigator, or the Bomb, because I haven't yet cracked how to implement other roles in a way that is relatively simple and easy to edit in case of different rules or names
- This doesn't actually record the game in any way, just gives you a way to assign the players roles in case you don't have a deck of cards, etc.
Anyway, I've posted it on Pastie, for anyone to see and use if you feel inclined to do so: