-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCivilization.cs
96 lines (82 loc) · 2.53 KB
/
Civilization.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
namespace Civilizations
{
public enum Age { Bronze, Iron, Golden }
public class Civilization
{
List<Human> humans = new List<Human>();
public int year = 0;
public int humanCount = 100;
public int maleCount;
public int femaleCount;
public int resourcesToWar = 5000;
public int resources = 10000;
public string civilizationName = "Default";
public string civilizatioAge = Age.Bronze.ToString();
public Civilization( string name)
{
civilizationName = name;
}
public void StartCiv()
{
SpawnHuman();
StartYearCount();
}
public void SpawnHuman()
{
for (int i = 0; i < humanCount; i++)
{
humans.Add(new Human(new Random().Next(20, 55)));
if (humans[i].gender == "Male")
{
maleCount++;
}
if (humans[i].gender == "Female")
{
femaleCount++;
}
}
Console.WriteLine($"Civ {civilizationName} | Males = {maleCount} \nFemales = {femaleCount}");
}
public void StartYearCount()
{
while (year < 2022)
{
Console.WriteLine($"It is {year} year | Civ {civilizationName} | Human count = {humans.Count} | Resources = {resources}");
AddAge();
RemoveHuman();
ResourceCount();
year++;
}
}
public void RemoveHuman()
{
for (int i = 0; i < humanCount; i++)
{
//Console.WriteLine($"Age {humans[i]._age} | Die Age {humans[i].dieAge}");
if (humans[i]._age > humans[i].dieAge)
{
humans.Remove(humans[i]);
humanCount--;
}
}
}
public void AddAge()
{
for (int i = 0; i < humanCount; i++)
{
humans[i].Growing();
}
Thread.Sleep(1000);
//Console.Clear();
}
public void ResourceCount()
{
for (int i = 0; i < humanCount; i++)
{
humans[i].ResourceDependence();
resources += humans[i].resoursProducingPerYear;
resources -= humans[i].resoursUsagePerYear;
}
}
}
}