diff --git a/VsProject/PropagationRemasteredBeta/Human.cs b/VsProject/PropagationRemasteredBeta/Human.cs index fa5052a..317662f 100644 --- a/VsProject/PropagationRemasteredBeta/Human.cs +++ b/VsProject/PropagationRemasteredBeta/Human.cs @@ -119,17 +119,128 @@ namespace PropagationRemasteredBeta //check bottom right peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y - 1)); + } + else + { + //now we have te peoples that are in sides or corners - foreach (Point p in peopleToCheckLocations) + if (Position.Y == 0) { - target = T.Population[p.X, p.Y]; - if (target.State == Human.SAIN) + if (Position.X == 0) { - T.PeopleToCheck.Add(target); + //top left corner + // @# + // ## + peopleToCheckLocations.Add(new Point(Position.X + 1,Position.Y)); + peopleToCheckLocations.Add(new Point(Position.X, Position.Y + 1)); + peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y + 1)); + } + else if (Position.X >= T.TerrainSize.Width -1) + { + //top right corner + // #@ + // ## + peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y + 1)); + peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y)); + peopleToCheckLocations.Add(new Point(Position.X, Position.Y + 1)); + } + else + { + //on the top side + // #@# + // ### + peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y + 1)); + peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y)); + peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y)); + peopleToCheckLocations.Add(new Point(Position.X, Position.Y + 1)); + peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y + 1)); } } - T.InfectedsToCheck.Add(this); + else + { + if (Position.Y >= T.TerrainSize.Height - 1) + { + if (Position.X == 0) + { + //bottom left corner + // ## + // @# + peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y)); + peopleToCheckLocations.Add(new Point(Position.X, Position.Y - 1)); + peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y - 1)); + } + else if (Position.X >= T.TerrainSize.Width - 1) + { + //Bottom right corner + // ## + // #@ + peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y - 1)); + peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y)); + peopleToCheckLocations.Add(new Point(Position.X, Position.Y - 1)); + } + else + { + //on the bottom side + // ### + // #@# + peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y - 1)); + peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y)); + peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y)); + peopleToCheckLocations.Add(new Point(Position.X, Position.Y - 1)); + peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y - 1)); + } + } + else + { + //on the left side + if (Position.X >= T.TerrainSize.Width -1) + { + // ## + // #@ + // ## + peopleToCheckLocations.Add(new Point(Position.X,Position.Y)); + + peopleToCheckLocations.Add(new Point(Position.X -1, Position.Y -1)); + peopleToCheckLocations.Add(new Point(Position.X, Position.Y -1)); + peopleToCheckLocations.Add(new Point(Position.X -1, Position.Y)); + peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y +1)); + peopleToCheckLocations.Add(new Point(Position.X, Position.Y +1)); + } + else + { + //on the right side + // ## + // @# + // ## + peopleToCheckLocations.Add(new Point(Position.X, Position.Y)); + + peopleToCheckLocations.Add(new Point(Position.X, Position.Y -1)); + peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y -1)); + peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y)); + peopleToCheckLocations.Add(new Point(Position.X, Position.Y + 1)); + peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y + 1)); + } + } + } + + + + + + + + } + + foreach (Point p in peopleToCheckLocations) + { + target = T.Population[p.X, p.Y]; + if (target.State == Human.SAIN) + { + T.PeopleToCheck.Add(target); + } + } + T.InfectedsToCheck.Add(this); return this; } public Human CheckInfection(int infectiosity, Random rnd) diff --git a/VsProject/PropagationRemasteredBeta/SimulationVue.cs b/VsProject/PropagationRemasteredBeta/SimulationVue.cs index 732bcab..c3de594 100644 --- a/VsProject/PropagationRemasteredBeta/SimulationVue.cs +++ b/VsProject/PropagationRemasteredBeta/SimulationVue.cs @@ -126,6 +126,9 @@ namespace PropagationRemasteredBeta //this.Invalidate(); BufferImage = t.Display(); + + tmrTick.Start(); + pbxTerrain.Image = BufferImage; stopwatch.Stop(); totalTime = stopwatch.ElapsedMilliseconds; @@ -137,12 +140,10 @@ namespace PropagationRemasteredBeta //refresh all the stats lblMemory.Text = GetMemoryUsage().ToString() + " Mb"; lblelementsCounter.Text = t.DRAWED_ELEMENTS.ToString(); - lblInfected.Text = t.InfectedCount[t.InfectedCount.Count() - 1].ToString(); - lblImmunes.Text = t.ImmuneCount[t.ImmuneCount.Count() - 1].ToString(); - lblSain.Text = t.SainCount[t.SainCount.Count() - 1].ToString(); - lblDeaths.Text = t.DeadCount[t.DeadCount.Count() - 1].ToString(); - - tmrTick.Start(); + //lblInfected.Text = t.InfectedCount[t.InfectedCount.Count() - 1].ToString(); + //lblImmunes.Text = t.ImmuneCount[t.ImmuneCount.Count() - 1].ToString(); + //lblSain.Text = t.SainCount[t.SainCount.Count() - 1].ToString(); + //lblDeaths.Text = t.DeadCount[t.DeadCount.Count() - 1].ToString(); } private double GetMemoryUsage()