age

package
v0.0.0-...-a30bc99 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package age implements structures and routines for age calculation and reasoning.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRandomAge

func GetRandomAge(ageCategory Category) int

GetRandomAge returns a random age in years within the age category range

func GetRandomHeight

func GetRandomHeight(gender string, ageCategory Category) int

GetRandomHeight returns a random weight given the age category and gender

func GetRandomWeight

func GetRandomWeight(gender string, ageCategory Category) int

GetRandomWeight returns a random weight given the age category and gender

Types

type Category

type Category struct {
	Name             string        `json:"name" db:"name"`
	MinAge           int           `json:"age_min" db:"age_min"`
	MaxAge           int           `json:"age_max" db:"age_max"`
	MaleHeightBase   int           `json:"male_height_base" db:"male_height_base"`
	FemaleHeightBase int           `json:"female_height_base" db:"female_height_base"`
	HeightRangeDice  dice.Dice     `json:"height_range_dice" db:"height_range_dice"`
	MaleWeightBase   int           `json:"male_weight_base" db:"male_weight_base"`
	FemaleWeightBase int           `json:"female_weight_base" db:"female_weight_base"`
	WeightModifier   int           `json:"weight_modifier" db:"weight_modifier"`
	WeightRangeDice  dice.Dice     `json:"weight_range_dice" db:"weight_range_dice"`
	SizeCategory     size.Category `json:"size_category" db:"size_category"`
	Commonality      int           `json:"commonality" db:"commonality"`
}

Category is metadata about a general age

func GetCategoryByName

func GetCategoryByName(name string, categories []Category) Category

GetCategoryByName returns the age category given a name

func GetCategoryFromAge

func GetCategoryFromAge(years int, categories []Category) Category

GetCategoryFromAge returns the age category that fits the age for the given set of age categories

func GetWeightedAgeCategory

func GetWeightedAgeCategory(categories []Category) (Category, error)

GetWeightedAgeCategory returns a random age category for a race

Jump to

Keyboard shortcuts

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