Creating a bias towards character generation.
While working on my Fiction Generator and creating Characters I noticed that I was indeed getting a randomized type of character. This ended up not being realistic and so I started working on finding a way to make the randomized character be biased towards generic. Thanks to Brad and John for last nights conversation.
In the characters class I have a variable that has nine levels. I am using the Enneagram model however in the first instance the first nine levels are from Good to Evil and not personality types. I wanted to create a bias towards the median when generating a random characters. This means that I will generate more moderate characters and fewer extreme characters. I will later add a second Enneagram attribute for their personality type.
The levels and percentages are categorized as follows.
Heroic to Altruistic – levels 1 through 3
Average – levels 4 through 6
Thief to Villain – levels 7 through 9
1 – 2% Hero
2 – 3% Benevolent
3 – 10% Meritorious
4 – 20% Intellectual
5 – 30% Average Joe
6 – 20% Meat Head
7 – 10% Criminal
8 – 3% Tyrant
9 – 2% Villain
I ended up going with the following model because it allows me to easily adjust the percentages for each level individually. I generate a random int between 0 and 100 and compare it to the following stack:
Here is output from generating some random characters. Yes, there is also a bias set for gender generation that can be easily changed.
You will also notice that they each have random names. I used the existing names package and added a middle name function to it and I will also be adding other functions for webscraping names and adding them to the list. To-easy. Inside my class you can create characters with the same First, Middle, Last, or any combination of names. Here is an example.
That’s all for now folks. Keep on writing code.