Table of Contents

Struct Household.RandomConstellation

Namespace
TinyLife.World
Assembly
TinyLife.dll

A struct that is used for the RandomConstellations list and ultimately by Generate(Random).

public readonly struct Household.RandomConstellation
Inherited Members
Extension Methods

Constructors

RandomConstellation(IEnumerable<(RandomPerson Person, int Min, int Max)>, IEnumerable<RandomRelation>, int)

Creates a new random constellation with the given settings.

public RandomConstellation(IEnumerable<(Household.RandomPerson Person, int Min, int Max)> possibleMembers, IEnumerable<Household.RandomRelation> possibleRelations, int minTotalMembers = 1)

Parameters

possibleMembers IEnumerable<(Household.RandomPerson Person, int Min, int Max)>

The set of possible members that can be generated for this constellation. The dictionary maps a Household.RandomPerson to a tuple of the minimum and maximum amount of people that can be generated with that age.

possibleRelations IEnumerable<Household.RandomRelation>

The set of possible relations that can be generated for this constellation. The dictionary maps two people of the given age groups to a set of Household.RandomRelation instances they can be generated with.

minTotalMembers int

The minimum amount of total members to generate.

Fields

MinTotalMembers

The minimum amount of total members to generate.

public readonly int MinTotalMembers

Field Value

int

PossibleMembers

The set of possible members that can be generated for this constellation. The dictionary maps a Household.RandomPerson to a tuple of the minimum and maximum amount of people that can be generated with that age.

public readonly Dictionary<Household.RandomPerson, (int Min, int Max)> PossibleMembers

Field Value

Dictionary<Household.RandomPerson, (int Min, int Max)>

PossibleRelations

The set of possible relations that can be generated for this constellation. The dictionary maps two people of the given age groups to a set of Household.RandomRelation instances they can be generated with.

public readonly Dictionary<(Household.RandomPerson, Household.RandomPerson), Household.RandomRelation[]> PossibleRelations

Field Value

Dictionary<(Household.RandomPerson, Household.RandomPerson), Household.RandomRelation[]>

Methods

Generate(Random)

Generates raw household data for the given constellation, which can then be passed to Generate(Map, Random, List<RandomPerson>, Dictionary<(int Person, int Other), Relation>) to generate the actual people. This method returns the list of people that should be generated (referenced only by their age group), as well as a dictionary of relations between those people.

public (List<Household.RandomPerson>, Dictionary<(int Person, int Other), Household.Relation>) Generate(Random random)

Parameters

random Random

The random instance to use.

Returns

(List<Household.RandomPerson>, Dictionary<(int Person, int Other), Household.Relation>)

The generated household data.