EDIT: How do I make a population simulator, that simulates population growth?
(Unnecessary)
Hi I'm Jake and recently I've started designing a population simulator. What would be the best way to make a population simulator running on a timeline? How would I incorporate random gender, age, height and weight. When people in this game have children how would I make the child have the last name of the male parent. How would I implement a count of my population.
So far I started to work on the Person class:
public class Person
{
public PName Name = new PName("", new List<string>(), "");
public Gender Gender = Gender.Male;
public Person(PName name, Gender gender)
{
Name = name;
Gender = gender;
}
public Person(PName name)
{
Name = name;
Random random = new Random();
Gender = (Gender)random.Next(1, 2);
}
public string GetGender()
{
if (Gender == Gender.Female)
{
return "Female";
}
else
{
return "Male";
}
}
}
Here is the Gender enum:
public enum Gender : int
{
Male = 1,
Female = 2,
}
Here is the PName class:
public class PName
{
public string FirstName = "";
public List<string> MiddleNames = new List<string>();
public string LastName = "";
public PName(string firstName, List<string> middleNames, string lastName)
{
FirstName = firstName;
MiddleNames = middleNames;
LastName = lastName;
}
public string GetName()
{
string middleNames = "";
int middleNameCount = 0;
foreach (string middleName in MiddleNames)
{
if (middleNameCount == 0)
{
middleNames = " " + middleName;
}
else if (middleNameCount == MiddleNames.ToArray().GetLength(0))
{
middleNames = middleNames + " " + middleName;
}
else
{
middleNames = middleNames + middleName;
}
middleNameCount += 1;
}
return FirstName + middleNames + " " + LastName;
}
public static implicit operator string(PName a)
{
return a.GetName();
}
}