geneticshuman

package
v0.0.0-...-ac9a7a9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2024 License: GPL-3.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	TraitDeceptive = 1 << iota
	TraitHonest
	TraitAggressive
	TraitCalm
	TraitCowardly
	TraitBrave
	TraitAmbitious
	TraitContent
	TraitCareless
	TraitCareful
	TraitParanoid
	TraitTrusting
	TraitCruel
	TraitKind
	TraitShy
	TraitGregarious
	TraitArrogant
	TraitHumble
	TraitMax
)

The various traits of a person.

View Source
const (
	TraitMaxVal = 15
	TraitHigh   = TraitMaxVal / 3 * 2
	TraitMid    = TraitMaxVal / 2
	TraitLow    = TraitMaxVal / 3
)

Variables

View Source
var (
	GGender = genetics.Gene{
		NumBits: 2,
		Offset:  62,
	}
	GEyeColor = genetics.Gene{
		NumBits: 2,
		Offset:  60,
	}
	GHairColor = genetics.Gene{
		NumBits: 3,
		Offset:  57,
	}
	GComplexion = genetics.Gene{
		NumBits: 4,
		Offset:  53,
	}
	GHeight = genetics.Gene{
		NumBits: 3,
		Offset:  50,
	}
	GMass = genetics.Gene{
		NumBits: 3,
		Offset:  47,
	}
	GGrowth = genetics.Gene{
		NumBits: 3,
		Offset:  44,
	}
	GStrength = genetics.Gene{
		NumBits: 4,
		Offset:  40,
	}
	GIntelligence = genetics.Gene{
		NumBits: 4,
		Offset:  36,
	}
	GDexterity = genetics.Gene{
		NumBits: 4,
		Offset:  32,
	}
	GResilience = genetics.Gene{
		NumBits: 4,
		Offset:  28,
	}
	GOpenness = genetics.Gene{
		NumBits: 4,
		Offset:  24,
	}
	GConscientiousness = genetics.Gene{
		NumBits: 4,
		Offset:  20,
	}
	GExtraversion = genetics.Gene{
		NumBits: 4,
		Offset:  16,
	}
	GAgreeableness = genetics.Gene{
		NumBits: 4,
		Offset:  12,
	}
	GNeuroticism = genetics.Gene{
		NumBits: 4,
		Offset:  8,
	}
)

Functions

func GetHairColorStr

func GetHairColorStr(g *genetics.Genes) string

GetHairColorStr returns a string representation of the hair color of a person.

func SetEyeColor

func SetEyeColor(g *genetics.Genes, val EyeColor)

SetEyeColor sets the eye color of a person based on their genes.

func SetGender

func SetGender(g *genetics.Genes, val Gender)

SetGender sets the genetic gender of a person.

func SetHairColor

func SetHairColor(g *genetics.Genes, val HairColor, curls bool)

SetHairColor sets the hair color of a person based on their genes.

func String

func String(g genetics.Genes) string

String returns a string representation of a person based on their genes.

Types

type Attrs

type Attrs struct {
	Complexion int
	Height     int
	Mass       int
	Growth     int
}

func GetAttrs

func GetAttrs(g *genetics.Genes) Attrs

GetAttrs returns the physical attributes of a person based on their genes. This includes complexion, height, mass, and growth.

func (Attrs) String

func (s Attrs) String() string

type EyeColor

type EyeColor int

EyeColor represents the eye color of a person.

const (
	EyeColorRed   EyeColor = 0x0
	EyeColorBlue  EyeColor = 0x1
	EyeColorGreen EyeColor = 0x2
	EyeColorBrown EyeColor = 0x3
)

The various eye colors of a person.

func GetEyeColor

func GetEyeColor(g *genetics.Genes) EyeColor

GetEyeColor returns the eye color of a person based on their genes.

func (EyeColor) String

func (g EyeColor) String() string

String returns a string representation of the eye color of a person.

type FiveFactor

type FiveFactor struct {
	Openness          int // openness to experience
	Conscientiousness int // conscientiousness
	Extraversion      int // extraversion
	Agreeableness     int // agreeableness
	Neuroticism       int // neuroticism
}

FiveFactor represents a simplified version of the five factor personality model.

func GetFiveFactor

func GetFiveFactor(g *genetics.Genes) FiveFactor

GetFiveFactor returns the five factor personality of a person based on their genes.

func (FiveFactor) String

func (s FiveFactor) String() string

String returns a string representation of the five factor personality.

type Gender

type Gender int

Gemder represents the gender of a person.

const (
	GenderMale   Gender = 0x1
	GenderFemale Gender = 0x3
)

The various genders of a person.

func GetGender

func GetGender(g *genetics.Genes) Gender

GetGender returns the gender of a person based on their genes.

func (Gender) String

func (g Gender) String() string

String returns a string representation of the gender of a person.

type HairColor

type HairColor int

HairColor represents the hair color of a person.

const (
	HairColorBlonde   HairColor = 0x0
	HairColorRed      HairColor = 0x1
	HairColorBrown    HairColor = 0x2
	HairColorBlack    HairColor = 0x3
	HairColorCurlMask HairColor = 0x4
)

The various hair colors of a person.

func GetHairColor

func GetHairColor(g *genetics.Genes) (HairColor, bool)

GetHairColor returns the hair color of a person based on their genes.

type Stats

type Stats struct {
	Strength     int
	Intelligence int
	Dexterity    int
	Resilience   int
}

Stats represents the physical stats of a person. This includes strength, intelligence, dexterity, and resilience.

func GetStats

func GetStats(g *genetics.Genes) Stats

GetStats returns the stats of a person based on their genes.

func (Stats) String

func (s Stats) String() string

String returns a string representation of the stats.

type Trait

type Trait int

func GetTraits

func GetTraits(ff FiveFactor) Trait

GetTraits returns the traits of a person based on their five factor personality.

func (Trait) Compare

func (t Trait) Compare(other Trait) float64

func (Trait) CountCommon

func (t Trait) CountCommon(other Trait) int

func (Trait) CountOpposites

func (t Trait) CountOpposites(other Trait) int

func (Trait) HasTrait

func (t Trait) HasTrait(trait Trait) bool

func (Trait) String

func (t Trait) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL