PDA

View Full Version : NPC Personality Generator [Linux Only]



Kuma Kode
2010-11-24, 08:19 PM
I've always been a big fan of Ash's Guide to RPG Personality and Background (http://rpg.ashami.com/), especially for randomizing my own PCs, but found the random generation of NPC personalities to be prohibitively time-consuming.

So, I wrote a simply console application in C++ to quickly generate the personality traits, and want to make it available here for anyone else who needs a generator for statistically unimportant characters who still play a major part of the story.

Since I run Linux exclusively, the console application is likely only functional in Linux. However, I will make the (rather inelegant) source code available, such that if anyone is so inclined, they could create a Windows or Mac version with just a quick compile.

If you do, be sure to post here, and I'll host it in my Dropbox alongside the Linux version.

Download Link (http://dl.dropbox.com/u/1467555/d20/ashgen)

Example Generations
++ PRIMARY MOTIVATION ++
Acquisition - To obtain possessions/wealth.


++ CORE TRAITS ++
Emotional Disposition : Contemptuous
Moodiness : Labile
Outlook : Optimistic - idealistic, confident, trusting, hopeful, upbeat
Integrity : Unscrupulous - lazy, deceitful, unreliable, manipulative, slipshod, impractical
Impulsiveness : Spontaneous - capricious, flighty, hyperactive, rash
Boldness : Intrepid - daring, reckless, chivalrous
Flexibility : Flexible - nonchalant, tolerant, forgiving, open-minded, adaptable
Affinity : Cold - self absorbed, needy, greedy, stingy, uncaring
Comportment : Agreeable - courteous, cultured, modest, charming, humorous
Interactivity : Engaging - talkative, listener, entertaining, touchy
Disclosure : Secretive - closed, mysterious, evasive, cryptic
Conformity : Conventional - orthodox, formal, down-to-earth, mainstream, traditional
Sense of Humor : Cynical


++ SEXUALITY ++
Sexual Orientation : Bisexual
Libido : Healthy
Sexual Expressiveness : Flirtatious
Sexual Style : Seductive
Sexual Openness : Narrow
Sexual Promiscuousness : High/Noncommittal


++ RELIGION AND SPIRITUALITY ++
Adherence : Casual
Expression of Beliefs : None
Converting Others : Aggressive
Attitude : Fearful


++ QUIRKS, HABITS, AND ODDITIES ++
Exhibitionism
Beard/hair stroking
Singing


++ HOBBIES AND ENJOYMENTS ++
Boating/Sailing
Invention
Art appreciation
++ PRIMARY MOTIVATION ++
Liberation - To free the self and/or others from perceived captivity or enslavement.


++ CORE TRAITS ++
Emotional Disposition : Melancholy
Moodiness : Even-Tempered
Outlook : Optimistic - idealistic, confident, trusting, hopeful, upbeat
Integrity : Conscientious - industrious, honest, responsible, meticulous, pragmatic
Impulsiveness : Controlled - deliberate, focused, steady, thoughtful
Boldness : Intrepid - daring, reckless, chivalrous
Flexibility : Stubborn - rigid, tense, relentless, intractable, narrow-minded
Affinity : Warm - altruistic, nurturing, empathic, supportive
Comportment : Agreeable - courteous, cultured, modest, charming, humorous
Interactivity : Reserved - shy, loner, taciturn
Disclosure : Candid - open book, unreserved, frank
Conformity : Heterodox - rebellious, arty, shocking, freethinking, exotic
Sense of Humor : Dry


++ SEXUALITY ++
Sexual Orientation : Homosexual
Libido : Healthy
Sexual Expressiveness : Flirtatious
Sexual Style : Crude
Sexual Openness : Moderate
Sexual Promiscuousness : High/Noncommittal


++ RELIGION AND SPIRITUALITY ++
Adherence : Casual
Expression of Beliefs : None
Converting Others : Aggressive
Attitude : Fearful


++ QUIRKS, HABITS, AND ODDITIES ++
Name dropping
Insomnia
Teeth sucking


++ HOBBIES AND ENJOYMENTS ++
Fishing
Jousting
Research
++ PRIMARY MOTIVATION ++
Creation - To build or make new, such as art, culture, invention, design,etc.


++ CORE TRAITS ++
Emotional Disposition : Melancholy
Moodiness : Labile
Outlook : Optimistic - idealistic, confident, trusting, hopeful, upbeat
Integrity : Unscrupulous - lazy, deceitful, unreliable, manipulative, slipshod, impractical
Impulsiveness : Controlled - deliberate, focused, steady, thoughtful
Boldness : Intrepid - daring, reckless, chivalrous
Flexibility : Stubborn - rigid, tense, relentless, intractable, narrow-minded
Affinity : Warm - altruistic, nurturing, empathic, supportive
Comportment : Agreeable - courteous, cultured, modest, charming, humorous
Interactivity : Reserved - shy, loner, taciturn
Disclosure : Candid - open book, unreserved, frank
Conformity : Conventional - orthodox, formal, down-to-earth, mainstream, traditional
Sense of Humor : Gleeful


++ SEXUALITY ++
Sexual Orientation : Heterosexual
Libido : Anemic
Sexual Expressiveness : Modest
Sexual Style : Crude
Sexual Openness : Moderate
Sexual Promiscuousness : Low/Monogamous


++ RELIGION AND SPIRITUALITY ++
Adherence : Agnostic
Expression of Beliefs : None
Converting Others : Never
Attitude : Ecstatic


++ QUIRKS, HABITS, AND ODDITIES ++
Knuckle cracking
Facial tics
Superstitious (omens, luck, etc.)


++ HOBBIES AND ENJOYMENTS ++
Music appreciation
Theatre
Embroidery
++ PRIMARY MOTIVATION ++
Education - To provide information, teach, enlighten, or train.


++ CORE TRAITS ++
Emotional Disposition : Calm
Moodiness : Even-Tempered
Outlook : Pessimistic - cynical, bleak, distrustful, foreboding, resigned
Integrity : Conscientious - industrious, honest, responsible, meticulous, pragmatic
Impulsiveness : Controlled - deliberate, focused, steady, thoughtful
Boldness : Intrepid - daring, reckless, chivalrous
Flexibility : Flexible - nonchalant, tolerant, forgiving, open-minded, adaptable
Affinity : Cold - self absorbed, needy, greedy, stingy, uncaring
Comportment : Discordant - gruff, critical, arrogant, crude, defensive, sanctimonious
Interactivity : Engaging - talkative, listener, entertaining, touchy
Disclosure : Secretive - closed, mysterious, evasive, cryptic
Conformity : Conventional - orthodox, formal, down-to-earth, mainstream, traditional
Sense of Humor : Gleeful


++ SEXUALITY ++
Sexual Orientation : Bisexual
Libido : Anemic
Sexual Expressiveness : Flirtatious
Sexual Style : Seductive
Sexual Openness : Moderate
Sexual Promiscuousness : Low/Monogamous


++ RELIGION AND SPIRITUALITY ++
Adherence : Agnostic
Expression of Beliefs : Occasional
Converting Others : Aggressive
Attitude : Judgmental


++ QUIRKS, HABITS, AND ODDITIES ++
Belching
Tree climbing
Facial tics


++ HOBBIES AND ENJOYMENTS ++
Pipe smoking
Astrology
Writing
++ PRIMARY MOTIVATION ++
Balance/Peace - To bring all things into harmony and equilibrium.


++ CORE TRAITS ++
Emotional Disposition : Calm
Moodiness : Even-Tempered
Outlook : Pessimistic - cynical, bleak, distrustful, foreboding, resigned
Integrity : Unscrupulous - lazy, deceitful, unreliable, manipulative, slipshod, impractical
Impulsiveness : Spontaneous - capricious, flighty, hyperactive, rash
Boldness : Cautious - timid, paranoid, vigilant
Flexibility : Stubborn - rigid, tense, relentless, intractable, narrow-minded
Affinity : Warm - altruistic, nurturing, empathic, supportive
Comportment : Discordant - gruff, critical, arrogant, crude, defensive, sanctimonious
Interactivity : Engaging - talkative, listener, entertaining, touchy
Disclosure : Secretive - closed, mysterious, evasive, cryptic
Conformity : Heterodox - rebellious, arty, shocking, freethinking, exotic
Sense of Humor : Mean-Spirited


++ SEXUALITY ++
Sexual Orientation : Heterosexual
Libido : Healthy
Sexual Expressiveness : Modest
Sexual Style : Romantic
Sexual Openness : Adventurous
Sexual Promiscuousness : Medium/Polyamorous


++ RELIGION AND SPIRITUALITY ++
Adherence : Orthodox Adherent
Expression of Beliefs : Occasional
Converting Others : Never
Attitude : Ecstatic


++ QUIRKS, HABITS, AND ODDITIES ++
Hair pulling
Self-inflict pain/injury
Exhibitionism


++ HOBBIES AND ENJOYMENTS ++
Fishing
Woodworking
Gambling
Source Code

#include <iostream>
#include <cstdlib>
#include <time.h>


using namespace std;



int main()

{

time_t seconds;
int number;
int motives;
int quirks;
int hobbies;
time(&seconds);
srand((unsigned int) seconds);
motives = 1;
quirks = 3;
hobbies = 3;
cout << "++ PRIMARY MOTIVATION ++\n";
while (motives > 0) {
number = rand() % 100;
switch ( number ) {
case 1:
case 2:
case 3:
case 4:
case 5:
cout << "Achievement - To overcome obstacles and succeed; to become the best.\n";
break;
case 6:
case 7:
case 8:
case 9:
case 10:
cout << "Acquisition - To obtain possessions/wealth.\n";
break;
case 11:
case 12:
case 13:
case 14:
case 15:
cout << "Balance/Peace - To bring all things into harmony and equilibrium.\n";
break;
case 16:
case 17:
case 18:
case 19:
case 20:
cout << "Beneficence - To protect the helpless, heal the sick, feed the hungry, etc.\n";
break;
case 21:
case 22:
case 23:
case 24:
case 25:
cout << "Chaos - To disrupt, to cause confusion and discord.\n";
break;
case 26:
case 27:
case 28:
case 29:
case 30:
cout << "Creation - To build or make new, such as art, culture, invention, design,etc.\n";
break;
case 31:
case 32:
case 33:
case 34:
case 35:
cout << "Destruction - To annihilate, exterminate, unmake, and bring to ruin.\n";
break;
case 36:
case 37:
case 38:
case 39:
case 40:
cout << "Discovery/Adventure - To explore, uncover mysteries, and pioneer.\n";
break;
case 41:
case 42:
case 43:
case 44:
case 45:
cout << "Education - To provide information, teach, enlighten, or train.\n";
break;
case 46:
case 47:
case 48:
case 49:
case 50:
cout << "Enslavement - To force others into servitude.\n";
break;
case 51:
case 52:
case 53:
case 54:
case 55:
cout << "Hedonism - To enjoy all things sensuous.\n";
break;
case 56:
case 57:
case 58:
case 59:
case 60:
cout << "Liberation - To free the self and/or others from perceived captivity or enslavement.\n";
break;
case 61:
case 62:
case 63:
case 64:
case 65:
cout << "Nobility/Honor - To exalt ideals such as generosity, honesty, bravery, and courtliness.\n";
break;
case 66:
case 67:
case 68:
case 69:
case 70:
cout << "Order - To arrange, organize, and reduce chaos.\n";
break;
case 71:
case 72:
case 73:
case 74:
case 75:
cout << "Play - To have fun, to enjoy life.\n";
break;
case 76:
case 77:
case 78:
case 79:
case 80:
cout << "Power - To control and lead others.\n";
break;
case 81:
case 82:
case 83:
case 84:
case 85:
cout << "Recognition - To gain approval, social status, or fame.\n";
break;
case 86:
case 87:
case 88:
case 89:
case 90:
cout << "Service - To follow a person, government, order, religion, etc.\n";
break;
case 91:
case 92:
case 93:
case 94:
case 95:
cout << "Torment - To inflict pain and suffering, on others and/or the self.\n";
break;
case 96:
case 97:
case 98:
case 99:
case 100:
cout << "Understanding - To seek knowledge or wisdom (spiritual, scientific, magical,etc).\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
motives = motives - 1;
}
number = rand() % 10;
cout << "\n\n++ CORE TRAITS ++\nEmotional Disposition : ";
switch ( number ) {
case 0:
cout << "Joyful\n";
break;
case 1:
cout << "Anxious\n";
break;
case 2:
cout << "Melancholy\n";
break;
case 3:
cout << "Curious\n";
break;
case 4:
cout << "Calm\n";
break;
case 5:
cout << "Angry\n";
break;
case 6:
cout << "Contemptuous\n";
break;
case 7:
cout << "Excited\n";
break;
case 8:
cout << "Apathetic\n";
break;
case 9:
cout << "Ashamed\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 3;
cout << "Moodiness : ";
switch ( number ) {
case 0 :
cout << "Labile\n";
break;
case 1 :
cout << "Even-Tempered\n";
break;
case 2 :
cout << "Phlegmatic\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 2;
cout << "Outlook : ";
switch ( number ) {
case 0 :
cout << "Optimistic - idealistic, confident, trusting, hopeful, upbeat\n";
break;
case 1 :
cout << "Pessimistic - cynical, bleak, distrustful, foreboding, resigned\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 2;
cout << "Integrity : ";
switch ( number ) {
case 0 :
cout << "Conscientious - industrious, honest, responsible, meticulous, pragmatic\n";
break;
case 1 :
cout << "Unscrupulous - lazy, deceitful, unreliable, manipulative, slipshod, impractical\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 2;
cout << "Impulsiveness : ";
switch ( number ) {
case 0 :
cout << "Controlled - deliberate, focused, steady, thoughtful\n";
break;
case 1 :
cout << "Spontaneous - capricious, flighty, hyperactive, rash\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 2;
cout << "Boldness : ";
switch ( number ) {
case 0 :
cout << "Intrepid - daring, reckless, chivalrous\n";
break;
case 1 :
cout << "Cautious - timid, paranoid, vigilant\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 2;
cout << "Flexibility : ";
switch ( number ) {
case 0 :
cout << "Flexible - nonchalant, tolerant, forgiving, open-minded, adaptable\n";
break;
case 1 :
cout << "Stubborn - rigid, tense, relentless, intractable, narrow-minded\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 2;
cout << "Affinity : ";
switch ( number ) {
case 0 :
cout << "Warm - altruistic, nurturing, empathic, supportive\n";
break;
case 1 :
cout << "Cold - self absorbed, needy, greedy, stingy, uncaring\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 2;
cout << "Comportment : ";
switch ( number ) {
case 0 :
cout << "Agreeable - courteous, cultured, modest, charming, humorous\n";
break;
case 1 :
cout << "Discordant - gruff, critical, arrogant, crude, defensive, sanctimonious\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 2;
cout << "Interactivity : ";
switch ( number ) {
case 0 :
cout << "Engaging - talkative, listener, entertaining, touchy\n";
break;
case 1 :
cout << "Reserved - shy, loner, taciturn\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 2;
cout << "Disclosure : ";
switch ( number ) {
case 0 :
cout << "Candid - open book, unreserved, frank\n";
break;
case 1 :
cout << "Secretive - closed, mysterious, evasive, cryptic\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 2;
cout << "Conformity : ";
switch ( number ) {
case 0 :
cout << "Conventional - orthodox, formal, down-to-earth, mainstream, traditional\n";
break;
case 1 :
cout << "Heterodox - rebellious, arty, shocking, freethinking, exotic\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 10;
cout << "Sense of Humor : ";
switch ( number ) {
case 0 :
cout << "Crude\n";
break;
case 1 :
cout << "Dry\n";
break;
case 2 :
cout << "Slapstick\n";
break;
case 3 :
cout << "Jokey\n";
break;
case 4 :
cout << "Cynical\n";
break;
case 5 :
cout << "Pranks\n";
break;
case 6 :
cout << "Mean-Spirited\n";
break;
case 7 :
cout << "Gleeful\n";
break;
case 8 :
cout << "Surreal\n";
break;
case 9 :
cout << "None\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
cout << "\n\n++ SEXUALITY ++\nSexual Orientation : ";
number = rand() % 100;
if ( number < 51 ){
cout << "Heterosexual\n";
}
else if( number < 86 ){
cout << "Bisexual\n";
}
else {
cout << "Homosexual\n";
};
number = rand() % 4;
cout << "Libido : ";
switch ( number ) {
case 0 :
cout << "Anemic\n";
break;
case 1 :
case 2 :
cout << "Healthy\n";
break;
case 3 :
cout << "Lascivious\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 3;
cout << "Sexual Expressiveness : ";
switch ( number ) {
case 0 :
cout << "Modest\n";
break;
case 1 :
cout << "Flirtatious\n";
break;
case 2 :
cout << "Brazen\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 3;
cout << "Sexual Style : ";
switch ( number ) {
case 0 :
cout << "Crude\n";
break;
case 1 :
cout << "Seductive\n";
break;
case 2 :
cout << "Romantic\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 3;
cout << "Sexual Openness : ";
switch ( number ) {
case 0 :
cout << "Narrow\n";
break;
case 1 :
cout << "Moderate\n";
break;
case 2 :
cout << "Adventurous\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 3;
cout << "Sexual Promiscuousness : ";
switch ( number ) {
case 0 :
cout << "Low/Monogamous\n";
break;
case 1 :
cout << "Medium/Polyamorous\n";
break;
case 2 :
cout << "High/Noncommittal\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 4;
cout << "\n\n++ RELIGION AND SPIRITUALITY ++\nAdherence : ";
switch ( number ) {
case 0 :
cout << "Atheist\n";
break;
case 1 :
cout << "Agnostic\n";
break;
case 2 :
cout << "Casual\n";
break;
case 3 :
cout << "Orthodox Adherent\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 3;
cout << "Expression of Beliefs : ";
switch ( number ) {
case 0 :
cout << "None\n";
break;
case 1 :
cout << "Occasional\n";
break;
case 2 :
cout << "Constant\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 3;
cout << "Converting Others : ";
switch ( number ) {
case 0 :
cout << "Never\n";
break;
case 1 :
cout << "Casual\n";
break;
case 2 :
cout << "Aggressive\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
number = rand() % 5;
cout << "Attitude : ";
switch ( number ) {
case 0 :
cout << "Irreverent\n";
break;
case 1 :
cout << "Fearful\n";
break;
case 2 :
cout << "Judgmental\n";
break;
case 3 :
cout << "Humble\n";
break;
case 4 :
cout << "Ecstatic\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
cout << "\n\n++ QUIRKS, HABITS, AND ODDITIES ++\n";
while (quirks > 0) {
number = rand() % 50;
switch ( number ) {
case 0 :
cout << "Humming\n";
break;
case 1 :
cout << "Dancing\n";
break;
case 2 :
cout << "Sleepwalking\n";
break;
case 3 :
cout << "Facial tics\n";
break;
case 4 :
cout << "Exhibitionism\n";
break;
case 5 :
cout << "Fingernail biting\n";
break;
case 6 :
cout << "Eavesdropping\n";
break;
case 7 :
cout << "Daydreaming\n";
break;
case 8 :
cout << "Talking in sleep\n";
break;
case 9 :
cout << "Stuttering\n";
break;
case 10 :
cout << "Compulsive lying\n";
break;
case 11 :
cout << "Whistling\n";
break;
case 12 :
cout << "Name dropping\n";
break;
case 13 :
cout << "Self-inflict pain/injury\n";
break;
case 14 :
cout << "Mumbling\n";
break;
case 15 :
cout << "Constant grooming\n";
break;
case 16 :
cout << "Foot tapping\n";
break;
case 17 :
cout << "Lip biting/licking\n";
break;
case 18 :
cout << "Coin flipping\n";
break;
case 19 :
cout << "Chewing (e.g. sticks, small bones)\n";
break;
case 20 :
cout << "Knuckle cracking\n";
break;
case 21 :
cout << "Collects odd things\n";
break;
case 22 :
cout << "Singing\n";
break;
case 23 :
cout << "Snacking (nuts, seeds, etc.)\n";
break;
case 24 :
cout << "Reciting poetry\n";
break;
case 25 :
cout << "Constant eating\n";
break;
case 26 :
cout << "Pacing\n";
break;
case 27 :
cout << "Blade sharpening\n";
break;
case 28 :
cout << "Counting\n";
break;
case 29 :
cout << "Hair pulling\n";
break;
case 30 :
cout << "Snoring\n";
break;
case 31 :
cout << "Walking backwards\n";
break;
case 32 :
cout << "Teeth sucking\n";
break;
case 33 :
cout << "Excessively touching others\n";
break;
case 34 :
cout << "Substance use (non-addicted)\n";
break;
case 35 :
cout << "Hair pulling\n";
break;
case 36 :
cout << "Animal hater\n";
break;
case 37 :
cout << "Insomnia\n";
break;
case 38 :
cout << "Beard/hair stroking\n";
break;
case 39 :
cout << "Nose picking\n";
break;
case 40 :
cout << "Needless apologizing\n";
break;
case 41 :
cout << "Exaggeration\n";
break;
case 42 :
cout << "Superstitious (omens, luck, etc.)\n";
break;
case 43 :
cout << "Belching\n";
break;
case 44 :
cout << "Sleeping in odd places\n";
break;
case 45 :
cout << "Repeating others\n";
break;
case 46 :
cout << "Smelling things\n";
break;
case 47 :
cout << "Teeth picking\n";
break;
case 48 :
cout << "Stealing\n";
break;
case 49 :
cout << "Tree climbing\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
quirks = quirks - 1;
}
cout << "\n\n++ HOBBIES AND ENJOYMENTS ++\n";
while (hobbies > 0) {
number = rand() % 48;
switch ( number ) {
case 0 :
cout << "Acrobatics\n";
break;
case 1 :
cout << "Acting\n";
break;
case 2 :
cout << "Astrology\n";
break;
case 3 :
cout << "Music appreciation\n";
break;
case 4 :
cout << "Theatre\n";
break;
case 5 :
cout << "Gaming (e.g. chess)\n";
break;
case 6 :
cout << "Boating/Sailing\n";
break;
case 7 :
cout << "Brewing\n";
break;
case 8 :
cout << "Calligraphy\n";
break;
case 9 :
cout << "Cards\n";
break;
case 10 :
cout << "Combat competition\n";
break;
case 11 :
cout << "Cooking\n";
break;
case 12 :
cout << "Dancing\n";
break;
case 13 :
cout << "Dicing\n";
break;
case 14 :
cout << "Animal fighting\n";
break;
case 15 :
cout << "Eating\n";
break;
case 16 :
cout << "Drinking\n";
break;
case 17 :
cout << "Embroidery\n";
break;
case 18 :
cout << "Falconry\n";
break;
case 19 :
cout << "Fishing\n";
break;
case 20 :
cout << "Fortune-telling\n";
break;
case 21 :
cout << "Singing\n";
break;
case 22 :
cout << "Gambling\n";
break;
case 23 :
cout << "Gardening\n";
break;
case 24 :
cout << "Glassmaking\n";
break;
case 25 :
cout << "Animal racing\n";
break;
case 26 :
cout << "Hunting\n";
break;
case 27 :
cout << "Invention\n";
break;
case 28 :
cout << "Jewelry making\n";
break;
case 29 :
cout << "Jousting\n";
break;
case 30 :
cout << "Juggling\n";
break;
case 31 :
cout << "Metalwork\n";
break;
case 32 :
cout << "Painting\n";
break;
case 33 :
cout << "Philosophizing\n";
break;
case 34 :
cout << "Reading\n";
break;
case 35 :
cout << "Research\n";
break;
case 36 :
cout << "Riddles\n";
break;
case 37 :
cout << "Sewing\n";
break;
case 38 :
cout << "Sports (Wrestling, racing, etc)\n";
break;
case 39 :
cout << "Storytelling\n";
break;
case 40 :
cout << "Swimming\n";
break;
case 41 :
cout << "Art appreciation\n";
break;
case 42 :
cout << "Weaving\n";
break;
case 43 :
cout << "Woodworking\n";
break;
case 44 :
cout << "Writing\n";
break;
case 45 :
cout << "Playing an instrument\n";
break;
case 46 :
cout << "Pipe smoking\n";
break;
case 47 :
cout << "Bird watching\n";
break;
default :
cout << "Something went wrong. Try again.\n";
}
hobbies = hobbies - 1;
}
}

PairO'Dice Lost
2010-11-24, 08:34 PM
Interesting, and good work. You do love your switch statements, don't you? :smallwink:

Would you mind if I tweaked the code a bit, to make it more easily extensible with more options for each trait, and posted that?

Kuma Kode
2010-11-24, 08:49 PM
Yeah, I couldn't think of much else to use other than switch that would be simple enough to write. That was a one-sitting deal and I'm not at all a professional programmer.

I should probably have put some kind of licensing thing on it, but let's just say it's open-source. Do what you want with it, and maybe this can turn into an awesomesauce community-built generator. :smallwink:

PairO'Dice Lost
2010-11-24, 10:34 PM
Here it is; it's more customizable, platform-independent, and one-quarter the size, and it can no longer output duplicate motivations, quirks, or hobbies.


#include <iostream>
#include <cstdlib>
#include <time.h>
#include <string>
#include <vector>
using namespace std;

template<typename T, int size>
int lengthOf(T(&)[size]){return size;}

static const string motivations[] = { "Achievement - To overcome obstacles and succeed; to become the best.",
"Acquisition - To obtain possessions/wealth.",
"Balance/Peace - To bring all things into harmony and equilibrium.",
"Beneficence - To protect the helpless, heal the sick, feed the hungry, etc.",
"Chaos - To disrupt, to cause confusion and discord.",
"Creation - To build or make new, such as art, culture, invention, design,etc.",
"Destruction - To annihilate, exterminate, unmake, and bring to ruin.",
"Discovery/Adventure - To explore, uncover mysteries, and pioneer.",
"Education - To provide information, teach, enlighten, or train.",
"Enslavement - To force others into servitude.",
"Hedonism - To enjoy all things sensuous.",
"Liberation - To free the self and/or others from perceived captivity or enslavement.",
"Nobility/Honor - To exalt ideals such as generosity, honesty, bravery, and courtliness.",
"Order - To arrange, organize, and reduce chaos.",
"Play - To have fun, to enjoy life.",
"Power - To control and lead others.",
"Recognition - To gain approval, social status, or fame.",
"Service - To follow a person, government, order, religion, etc.",
"Torment - To inflict pain and suffering, on others and/or the self.",
"Understanding - To seek knowledge or wisdom (spiritual, scientific, magical,etc)."
};

static const string eccentricities[] = {"Humming", "Dancing", "Sleepwalking", "Facial tics", "Exhibitionism", "Fingernail biting", "Eavesdropping",
"Daydreaming", "Talking in sleep", "Stuttering", "Compulsive lying", "Whistling", "Name dropping",
"Self-inflict pain/injury", "Mumbling", "Constant grooming", "Foot tapping", "Lip biting/licking",
"Coin flipping", "Chewing (e.g. sticks, small bones)", "Knuckle cracking", "Collects odd things", "Singing",
"Snacking (nuts, seeds, etc.)", "Reciting poetry", "Constant eating", "Pacing", "Blade sharpening", "Counting",
"Hair pulling", "Snoring", "Walking backwards", "Teeth sucking", "Excessively touching others",
"Substance use (non-addicted)", "Hair pulling", "Animal hater", "Insomnia", "Beard/hair stroking",
"Nose picking", "Needless apologizing", "Exaggeration", "Superstitious (omens, luck, etc.)", "Belching",
"Sleeping in odd places", "Repeating others", "Smelling things", "Teeth picking", "Stealing", "Tree climbing"
};

static const string hobby[] = { "Acrobatics", "Acting", "Astrology", "Music appreciation", "Theatre", "Gaming (e.g. chess)", "Boating/Sailing", "Brewing",
"Calligraphy", "Cards", "Combat competition", "Cooking", "Dancing", "Dicing", "Animal fighting", "Eating", "Drinking",
"Embroidery", "Falconry", "Fishing", "Fortune-telling", "Singing", "Gambling", "Gardening", "Glassmaking", "Animal racing",
"Hunting", "Invention", "Jewelry making", "Jousting", "Juggling", "Metalwork", "Painting", "Philosophizing", "Reading",
"Research", "Riddles", "Sewing", "Sports (Wrestling, racing, etc)", "Storytelling", "Swimming", "Art appreciation",
"Weaving", "Woodworking", "Writing", "Playing an instrument", "Pipe smoking", "Bird watching"
};

static const string emotions[] = {"Joyful", "Anxious", "Melancholy", "Curious", "Calm", "Angry", "Contemptuous", "Excited", "Apathetic", "Ashamed"};
static const string moods[] = {"Labile", "Even-Tempered", "Phlegmatic"};
static const string humors[] = {"Crude", "Dry", "Slapstick", "Jokey", "Cynical", "Pranks", "Mean-Spirited", "Gleeful", "Surreal", "None"};
static const string libidos[] = {"Anemic", "Healthy", "Healthy", "Lascivious"};
static const string expressiveness[] = {"Modest", "Flirtatious", "Brazen"};
static const string styles[] = {"Crude", "Seductive", "Romantic"};
static const string openness[] = {"Narrow", "Moderate", "Adventurous"};
static const string promiscuity[] = {"Low/Monogamous", "Medium/Polyamorous", "High/Noncommittal"};
static const string faith[] = {"Atheist", "Agnostic", "Casual", "Orthodox"};
static const string preaching[] = {"None", "Occasional", "Constant"};
static const string proselytizing[] = {"Never", "Casual", "Aggressive"};
static const string attitudes[] = {"Irreverent", "Fearful", "Judgmental", "Humble", "Ecstatic"};

void print_two(string first, string second)
{
cout << ((rand() % 2 == 0) ? first: second) << endl;
}

int main()
{
time_t seconds;
int num, motives = 1, quirks = 3, hobbies = 3;
time(&seconds);
srand((unsigned int) seconds);

cout << "++ PRIMARY MOTIVATION ++" << endl;
int seen[motives+1];
int count = motives;
bool found;
while(motives > 0)
{
found = false;
num = rand() % lengthOf(motivations);
for(int x=count;x<motives+1;x++)
if(num == seen[x])
found = true;
seen[count] = num;
if(!found)
{
cout << motivations[num] << endl;
motives--;
}
}

num = rand() % lengthOf(emotions);
cout << endl << endl << "++ CORE TRAITS ++" << endl << "Emotional Disposition: ";
cout << emotions[num] << endl;

num = rand() % lengthOf(moods);
cout << "Moodiness: ";
cout << moods[num] << endl;

cout << "Outlook: ";
print_two("Optimistic - idealistic, confident, trusting, hopeful, upbeat", "Pessimistic - cynical, bleak, distrustful, foreboding, resigned");

cout << "Integrity: ";
print_two("Conscientious - industrious, honest, responsible, meticulous, pragmatic", "Unscrupulous - lazy, deceitful, unreliable, manipulative, slipshod, impractical");

cout << "Impulsiveness: ";
print_two("Controlled - deliberate, focused, steady, thoughtful", "Spontaneous - capricious, flighty, hyperactive, rash");

cout << "Boldness: ";
print_two("Intrepid - daring, reckless, chivalrous", "Cautious - timid, paranoid, vigilant");

cout << "Flexibility: ";
print_two("Flexible - nonchalant, tolerant, forgiving, open-minded, adaptable", "Stubborn - rigid, tense, relentless, intractable, narrow-minded");

cout << "Affinity: ";
print_two("Warm - altruistic, nurturing, empathic, supportive", "Cold - self absorbed, needy, greedy, stingy, uncaring");

cout << "Comportment: ";
print_two("Agreeable - courteous, cultured, modest, charming, humorous", "Discordant - gruff, critical, arrogant, crude, defensive, sanctimonious");

cout << "Interactivity: ";
print_two("Engaging - talkative, listener, entertaining, touchy", "Reserved - shy, loner, taciturn");

cout << "Disclosure: ";
print_two("Candid - open book, unreserved, frank", "Secretive - closed, mysterious, evasive, cryptic");

cout << "Conformity: ";
print_two("Conventional - orthodox, formal, down-to-earth, mainstream, traditional", "Heterodox - rebellious, arty, shocking, freethinking, exotic");

num = rand() % lengthOf(humors);
cout << "Sense of Humor: ";
cout << humors[num] << endl;

cout << endl << endl << "++ SEXUALITY ++" << endl << "Sexual Orientation: ";
num = rand() % 100;
cout << (num < 51 ? "Heterosexual": (num < 81 ? "Bisexual": "Homosexual")) << endl;

num = rand() % lengthOf(libidos);
cout << "Libido: ";
cout << libidos[num] << endl;

num = rand() % lengthOf(expressiveness);
cout << "Sexual Expressiveness: ";
cout << expressiveness[num] << endl;

num = rand() % lengthOf(styles);
cout << "Sexual Style: ";
cout << styles[num] << endl;

num = rand() % lengthOf(openness);
cout << "Sexual Openness: ";
cout << openness[num] << endl;

num = rand() % lengthOf(promiscuity);
cout << "Sexual Promiscuity: ";
cout << promiscuity[num] << endl;

num = rand() % lengthOf(faith);
cout << endl << endl << "++ RELIGION AND SPIRITUALITY ++" << endl << "Adherence: ";
cout << faith[num] << endl;

num = rand() % lengthOf(preaching);
cout << "Expression of Beliefs: ";
cout << preaching[num] << endl;

num = rand() % lengthOf(proselytizing);
cout << "Converting Others: ";
cout << proselytizing[num] << endl;

num = rand() % lengthOf(attitudes);
cout << "Attitude: ";
cout << attitudes[num] << endl;

cout << endl << endl << "++ QUIRKS, HABITS, AND ODDITIES ++" << endl;
int already[quirks+1];
count = quirks;
while (count > 0)
{
found = false;
num = rand() % lengthOf(eccentricities);
for(int x=count;x<quirks+1;x++)
if(num == already[x])
found = true;
already[count] = num;
if(!found)
{
cout << eccentricities[num] << endl;
count--;
}
}

int again[hobbies+1];
count = hobbies;
cout << endl << endl << "++ HOBBIES AND ENJOYMENTS ++" << endl;
while (hobbies > 0)
{
found = false;
num = rand() % lengthOf(hobby);
for(int x=count;x<quirks+1;x++)
if(num == again[x])
found = true;
again[count] = num;
if(!found)
{
cout << hobby[num] << endl;
hobbies--;
}
}
}