Documentation ¶
Overview ¶
Package aifiver implements a simplified representation of the five factor model.
Index ¶
- Variables
- func Compatibility(p1, p2 Model) int
- func DefaultTraits(tt *Traiter)
- func MarkOppositeTraits(a, b *Trait)
- type AIMod
- type BigModel
- type Facet
- type Factor
- type Fate
- type Model
- type Modifier
- type Opinion
- type Personality
- func (p *Personality) AddModifier(m *Modifier)
- func (p *Personality) Get(f Factor) int
- func (p *Personality) GetFacet(f Facet) int
- func (p *Personality) Interaction(b *Personality) int
- func (p *Personality) Log()
- func (p *Personality) Opinion(b *Personality) int
- func (p *Personality) Rebuild()
- func (p *Personality) RemoveModifier(m *Modifier)
- func (p *Personality) Stats() *Stats
- type Skill
- type SmallModel
- type Stats
- type Trait
- type TraitType
- type Traiter
Constants ¶
This section is empty.
Variables ¶
var ( ModRecentBetrayal = &Modifier{ Name: "recent betrayal", Factors: [5]int{ 0, 0, 0, -1, 1, }, Facets: [30]int{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -5, -1, 0, 0, 0, 3, 1, 1, 1, 0, }, } ModGriefing = &Modifier{ Name: "griefing", Factors: [5]int{ 0, 0, -1, 0, 1, }, Facets: [30]int{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, }, } ModSetback = &Modifier{ Name: "setback", Factors: [5]int{ 0, 1, 0, 0, 1, }, Facets: [30]int{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 2, 0, }, } )
var PresetFool = map[Facet]int{
FacetOpenFantasy: 8,
FacetOpenAesthetics: 4,
FacetOpenFeelings: 6,
FacetOpenAdventurousness: 4,
FacetOpenIdeas: 7,
FacetOpenValues: 6,
FacetConsCompetence: 0,
FacetConsOrder: 2,
FacetConsDutifulness: -3,
FacetConsAchievementStriving: -1,
FacetConsSelfDicipline: -5,
FacetConsCautiousness: -7,
FacetExtrWarmth: 7,
FacetExtrGregariousness: 8,
FacetExtrAssertiveness: -2,
FacetExtrActivity: 5,
FacetExtrExcitementSeeking: 3,
FacetExtrPositiveEmotions: 7,
FacetAgreTrust: 8,
FacetAgreStraightforwardness: -3,
FacetAgreAltruism: 5,
FacetAgreCompliance: 8,
FacetAgreModesty: 6,
FacetAgreTenderMindedness: 5,
FacetNeurAnxiety: 3,
FacetNeurAngryHostility: -5,
FacetNeurDepression: -2,
FacetNeurSelfConciousness: 5,
FacetNeurImpulsiveness: 5,
FacetNeurVulnerability: 4,
}
var PresetUnstable = map[Facet]int{
FacetOpenFantasy: 3,
FacetOpenAesthetics: 4,
FacetOpenFeelings: -3,
FacetOpenAdventurousness: 4,
FacetOpenIdeas: -3,
FacetOpenValues: -10,
FacetConsCompetence: 8,
FacetConsOrder: 7,
FacetConsDutifulness: 3,
FacetConsAchievementStriving: 10,
FacetConsSelfDicipline: 4,
FacetConsCautiousness: -4,
FacetExtrWarmth: 0,
FacetExtrGregariousness: 3,
FacetExtrAssertiveness: 9,
FacetExtrActivity: 5,
FacetExtrExcitementSeeking: 3,
FacetExtrPositiveEmotions: -3,
FacetAgreTrust: -5,
FacetAgreStraightforwardness: -4,
FacetAgreAltruism: -4,
FacetAgreCompliance: -10,
FacetAgreModesty: -10,
FacetAgreTenderMindedness: -6,
FacetNeurAnxiety: 0,
FacetNeurAngryHostility: 2,
FacetNeurDepression: -10,
FacetNeurSelfConciousness: -10,
FacetNeurImpulsiveness: 6,
FacetNeurVulnerability: -5,
}
Functions ¶
func Compatibility ¶
Compatibility returns a compatibility value for the given personalities. TODO: Provide function to calculate conflict potential of larger groups. https://github.com/FZarattini/PirateShip/blob/master/PirateShip/Assets/Scripts/AI/Empathy.cs
func DefaultTraits ¶
func DefaultTraits(tt *Traiter)
DefaultTraits adds the default traits to the traiter. These are just examples. If you have suggestions for better traits, please open an issue or a pull request!
func MarkOppositeTraits ¶
func MarkOppositeTraits(a, b *Trait)
MarkOppositeTraits defines two traits as their polar opposite.
Types ¶
type AIMod ¶
type AIMod int
AIMod influences a specific aspect of decision making - AI Boldness - AI Compassion - AI Energy - AI Greed - AI Honor - AI Rationality - AI Sociability - AI Vengefulness
type BigModel ¶
BigModel represents a more granular five factor model.
func RandomBig ¶
func RandomBig() *BigModel
RandomBig randomizes a big model by distributing half of the total range (-10 to 10 = 20) of each factor and facet randomly. We use a point buy system to distribute the points randomly, however there in reality some factors are more likely to be linked to each other than others. TODO: Find a way to better distribute the points according to the real world.
type Facet ¶
type Facet int
Facet represents specific facets within the five factors.
const ( FacetOpenFantasy Facet = iota // Proneness to imagination, day-dreaming, and creating FacetOpenAesthetics // Appreciation for beauty in e.g. art, music, poetry, or nature FacetOpenFeelings // Receptivity to and intensity of experienced emotions FacetOpenAdventurousness // The tendency to choose novelty over the familiar FacetOpenIdeas // The degree of interest and curiosity in entertaining new thoughts and ideas FacetOpenValues // Willingness to re-evaluate norms and values FacetConsCompetence // Belief in one's own capacity to handle life's many challenges FacetConsOrder // Degree of neatness and orderliness FacetConsDutifulness // How strongly ethical principles guide action FacetConsAchievementStriving // Aspiration-level, the willingness to work towards goals FacetConsSelfDicipline // The ability to follow through on tasks despite boredom FacetConsCautiousness // The care and thought put into actions FacetExtrWarmth // The degree of displayed affection and closeness in relationships FacetExtrGregariousness // The tendency of seeking the company of others FacetExtrAssertiveness // The degree of dominance in social interaction FacetExtrActivity // The level of energy and activity in daily life FacetExtrExcitementSeeking // The need for thrills and intense stimulation FacetExtrPositiveEmotions // The tendency to be happy, excited, and cheerful FacetAgreTrust // The general level of wariness or suspicion in contact with other people FacetAgreStraightforwardness // Degree of sincerity vs shrewdness FacetAgreAltruism // Active concern for the well-being of others FacetAgreCompliance // Inhibiting vs expressing agression towards others in conflict FacetAgreModesty // Degree of humility vs arrogance FacetAgreTenderMindedness // Propensity to empathize with others FacetNeurAnxiety // Proneness to worry and rumination FacetNeurAngryHostility // The readiness to experience frustration, anger, and bitterness FacetNeurDepression // The tendency for guilt, sadness, lonliness, and hopelessness FacetNeurSelfConciousness // Sensitivity in social situations, such as ridicule, rejection, or awkwardness FacetNeurImpulsiveness // The ability to tolerate frustration and to control urges, cravings, and desires FacetNeurVulnerability // The ability to cope with stress )
The facets.
type Fate ¶
type Fate int
Fate that can befall an individual - Early death - Capture in battle - Death in battle - Accidental injury - Bad investment - Scheme fallacy - Scheme discovery
type Modifier ¶
type Modifier struct { Name string // Name of the modifier Factors [5]int // Modifiers for the five factors Facets [30]int // Modifiers for the 30 facets }
Modifier is a personality modifier which can be applied to a personality. TODO: - Add persistance to indicate how long this would last. - Should this maybe amplify pre-existing traits instead of simply modifying them? - Should we derive the factor modifiers from the facet modifiers?
type Personality ¶
type Personality struct { BigModel // The model which influences which traits are expressed. Expressed []*Trait // Traits expressed based on the underlying 5 factor model. // TODO: Proneness to fall victim to cetain fates (accidental death, falling victim to intrigue) Modifiers []*Modifier // Temporary facet modifiers (Griefing, Recent Betrayal, Setback, ...) // contains filtered or unexported fields }
Personality represents a personality that is a combination of facet scores and expressed traits.
func NewPersonality ¶
func NewPersonality(t *Traiter) *Personality
NewPersonality returns a new, pretty boring personality.
func NewPersonalityFromPreset ¶
func NewPersonalityFromPreset(t *Traiter, ps map[Facet]int) *Personality
NewPersonalityFromPreset returns a new personality based on the given preset.
func NewPersonalityRandomized ¶
func NewPersonalityRandomized(t *Traiter) *Personality
NewPersonalityRandomized returns a new personality with random facet values. TODO: Allow custom rand source or seed.
func (*Personality) AddModifier ¶
func (p *Personality) AddModifier(m *Modifier)
AddModifier adds a modifier to the personality (if it is not already present).
func (*Personality) Get ¶
func (p *Personality) Get(f Factor) int
Get implements the Model interface and applies any modifiers to the base value.
func (*Personality) GetFacet ¶
func (p *Personality) GetFacet(f Facet) int
GetFacet implements the Model interface and applies any modifiers to the base value.
func (*Personality) Interaction ¶
func (p *Personality) Interaction(b *Personality) int
Interaction returns a value for how well the personalities interact face to face.
func (*Personality) Opinion ¶
func (p *Personality) Opinion(b *Personality) int
Opinion returns the opinion of the other personality based on their reputation. TODO: What about a misperception of the other person?
func (*Personality) Rebuild ¶
func (p *Personality) Rebuild()
Rebuild re-evaluates expressed traits based on the facet ratings.
func (*Personality) RemoveModifier ¶
func (p *Personality) RemoveModifier(m *Modifier)
RemoveModifier removes a modifier from the personality (if it is present).
func (*Personality) Stats ¶
func (p *Personality) Stats() *Stats
Stats returns the stats for the personality.
type Skill ¶
type Skill int
Skill for various aspects
type SmallModel ¶
type SmallModel [5]int
SmallModel represents a simplified five factor model. Please note that this is not granular enough to simulate real personalities.
func RandomSmall ¶
func RandomSmall() *SmallModel
RandomSmall randomizes a small model by distributing half of the total range (-10 to 10 = 20) of each factor randomly. We use a point buy system to distribute the points randomly, however there in reality some factors are more likely to be linked to each other than others.
func (*SmallModel) Get ¶
func (p *SmallModel) Get(factor Factor) int
Get returns the value of the given factor.
func (*SmallModel) GetFacet ¶
func (p *SmallModel) GetFacet(facet Facet) int
GetFacet returns the value of the given facet.
type Stats ¶
type Trait ¶
type Trait struct { Type TraitType Opposite *Trait Name string Description string IsExpressedBy func(*Personality) bool *Stats // Contains all modifiers. }
Trait represents a character trait that influences behavior and decisions.
type TraitType ¶
type TraitType int
TraitType defining how a trait can be aquired
const ( TTypePersonality TraitType = iota TTypeEducation TTypeCongenital TTypeCongenitalLeveled TTypePhysical TTypeLifestyle TTypeLifestyleLeveled TTypeCommander TTypeInfamous TTypeCopingMechanism TTypeChildhood TTypeHealth TTypeDiseases TTypeDynasty TTypeDescendant TTypeDecision TTypeOther )
Various trait types.
type Traiter ¶
type Traiter struct {
Traits []*Trait
}
Traiter is an index used for assigning traits to personalities.
func (*Traiter) NewPersonality ¶
func (tt *Traiter) NewPersonality() *Personality
NewPersonality returns a new, pretty boring personality.
func (*Traiter) NewPersonalityFromPreset ¶
func (tt *Traiter) NewPersonalityFromPreset(ps map[Facet]int) *Personality
NewPersonalityFromPreset returns a new personality based on the given preset.