Description:
Add health measure.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r77:b8267925cc8a -

@@ -1,6 +1,7
1 using System;
1 using System;
2 using System.Collections.Generic;
2 using System.Collections.Generic;
3 using static isometricparkfna.CellMap;
3 using static isometricparkfna.CellMap;
4 using System.Linq;
4
5
5 namespace isometricparkfna
6 namespace isometricparkfna
6 {
7 {
@@ -41,8 +42,8
41 private const float NEIGHBOR_NEW_TREE_CHANCE = 0.995f;
42 private const float NEIGHBOR_NEW_TREE_CHANCE = 0.995f;
42 private const float NEIGHBOR_CROWDS_TREE_CHANCE = 0.995f;
43 private const float NEIGHBOR_CROWDS_TREE_CHANCE = 0.995f;
43
44
44 public const int TREE_PLANT_COST = 100;
45 public const int TREE_PLANT_COST = 1000;
45 public const int TREE_CLEAR_COST = 50;
46 public const int TREE_CLEAR_COST = 750;
46
47
47 public int Tick
48 public int Tick
48 {
49 {
@@ -130,8 +131,7
130
131
131 private Random random;
132 private Random random;
132
133
133 //budget params
134 //forest policy params
134
135 public int _tree_planting;
135 public int _tree_planting;
136 public int tree_planting
136 public int tree_planting
137 {
137 {
@@ -153,6 +153,13
153 }
153 }
154 }
154 }
155
155
156 public float healthy_percent
157 {
158 get {
159 return ((float)(this.map.tree_count - this.map.iterate_cells_with_neighbors(7).Count()) / this.map.tree_count) * 100;
160 }
161 }
162
156
163
157
164
158 public Simulation(int width, int height, float millisecondsPerAdvance)
165 public Simulation(int width, int height, float millisecondsPerAdvance)
@@ -43,6 +43,7
43 sim.tree_clearing = new_tree_clearing;
43 sim.tree_clearing = new_tree_clearing;
44
44
45 ImGui.Text(string.Format("Crowded Trees: {0}", sim.map.iterate_cells_with_neighbors(7).Count())); //via LINQ
45 ImGui.Text(string.Format("Crowded Trees: {0}", sim.map.iterate_cells_with_neighbors(7).Count())); //via LINQ
46 ImGui.Text(string.Format("Percent Healthy Trees: {0:F2}", sim.healthy_percent));
46
47
47 if (ImGui.Button("Okay"))
48 if (ImGui.Button("Okay"))
48 {
49 {
You need to be logged in to leave comments. Login now