Advertiser Content
Rate this Entry

Mafia Player-Role List Generator - a command-line program - 22nd May

Posted May 21st, 2015 at 8:06 PM by GreenFlame
Updated May 22nd, 2015 at 9:20 AM by GreenFlame

I had this blog post pretty much ready to post, but my browser crashed when I opened a link in another tab and now it's all gone :( Anyway here's a shorter version since I don't feel like typing it all again


To practice C++, I wanted to actually make a program. I decided to make a simple little command-line program for Mafia GMs that takes in names of players, names of roles, and then randomly assigns the roles to players, and generates a list to be used by the GM.

But don't worry, you don't have to type in all the names and roles into the program - it reads all that data from .txt files!

You can download the .rar - which includes the executable, as well as the necessary .txt files (which you must edit) - here.


You use the program by:

-In "names.txt", inputting the name of each player, seperated by line.
-In "innocentSpecial.txt", inputting the name of each Innocent Special role, seperated by line.
-In "mafiaSpecial.txt", inputting the name of each Mafia Special role, seperated by line.
-Running the program.
-Specifying the total amount of Mafia players (including Special roles).
-Specifying whether or not there is an unaffiliated player (program currently only supports one unaffiliated faction that can contain only one player).
-The program will then generate the list, and save it to the file "listOutput.txt".

More detailed information on how to use the program is available in the readme included in the package, and I recommend you read it before you use the program :).


The program does work, however I would still consider it a prototype due to the fact that the random generation is done with a PRNG using the current Unix time as a seed, where it would be optimal for the program to source its random numbers from random.org. As such, it is unfit for proper use by a GM, unless that GM is okay with pseudo-random results for their role assignment.



-Cosmic
Posted inUncategorized
Views 7914 Comments 8
« Prev     Main     Next »
Total Comments 8

Comments

  1. Old Comment
    Klippy's Avatar
    :O Neat
    Posted May 21st, 2015 at 8:24 PM by Klippy Klippy is offline
  2. Old Comment
    GreenFlame's Avatar
    Quote:
    Originally Posted by Klippy View Comment
    :O Neat
    *would Like comment, but no Likes for blog comments*

    So thanks :D It really helped me learn by making it, stuff like reading data from files and dynamically allocating variables.
    Posted May 21st, 2015 at 8:28 PM by GreenFlame GreenFlame is offline
  3. Old Comment
    gimmepie's Avatar
    Oh wow this is awesome! I can't wait to see the finished version. :D
    Posted May 21st, 2015 at 11:05 PM by gimmepie gimmepie is offline
  4. Old Comment
    A finished version maybe should properly implement the random.org API, so you get true randomness!
    Posted May 22nd, 2015 at 1:56 AM by Melody Melody is offline
  5. Old Comment
    Salzorrah's Avatar
    totally gonna use the final version on the next few games i host :3
    Posted May 22nd, 2015 at 3:04 AM by Salzorrah Salzorrah is offline
  6. Old Comment
    GreenFlame's Avatar
    Quote:
    Originally Posted by gimmepie View Comment
    Oh wow this is awesome! I can't wait to see the finished version. :D
    Quote:
    Originally Posted by Melody View Comment
    A finished version maybe should properly implement the random.org API, so you get true randomness!
    Thank you! Finishing it would involve adding the random.org API, and I'm not fully sure how to do that currently, but it would be helpful if the library is portable. I am going to try :)

    Quote:
    Originally Posted by arachnidsGrip View Comment
    totally gonna use the final version on the next few games i host :3
    :D
    Posted May 22nd, 2015 at 8:59 AM by GreenFlame GreenFlame is offline
  7. Old Comment
    Lycanthropy's Avatar
    Awesome! I programmed something like this on my calculator a few years ago, but inputting names and roles works a lot better on a computer, certainly when it can read text files. Good job!
    Posted May 22nd, 2015 at 11:29 AM by Lycanthropy Lycanthropy is offline
  8. Old Comment
    GreenFlame's Avatar
    Quote:
    Originally Posted by Lycanthropy View Comment
    Awesome! I programmed something like this on my calculator a few years ago, but inputting names and roles works a lot better on a computer, certainly when it can read text files. Good job!
    Thank you! On a calculator :O?
    Posted May 22nd, 2015 at 1:13 PM by GreenFlame GreenFlame is offline