Beispiel #1
0
        /// <summary>
        /// Gets the viruses on the grid in the provided point.
        /// </summary>
        /// <param name="point">The point on the grid from where get the number of viruses.</param>
        /// <returns>Hov many unity of viruses there are in the provided point.</returns>
        public decimal GetViruses(CoViD.CL.Point point)
        {
            var r          = this.X2R(point.X);
            var c          = this.Y2C(point.Y);
            var isInternal = (r >= 0 && c >= 0 && r < this.IndexMax && c < this.IndexMax);

            return(isInternal ? this.Contamination[r, c] : 0);
        }
Beispiel #2
0
        /// <summary>
        ///  Sets the contamination for a point
        /// </summary>
        /// <param name="viruses">The number of viruses (unity of viruses) in the provided point.</param>
        /// <param name="location">The location where is the contamination</param>
        public void Contaminate(decimal viruses, CoViD.CL.Point location)
        {
            if (viruses > 0)
            {
                var r = this.X2R(location.X);
                var c = this.Y2C(location.Y);

                var isInternal = (r >= 0 && c >= 0 && r < this.IndexMax && c < this.IndexMax);
                if (isInternal)
                {
                    var virusesRC = this.Contamination[r, c];
                    if (virusesRC == 0)
                    {
                        this.Contaminated.Add(new CL.Point(location.X, location.Y));
                        var _x = this.R2X(r);
                        var _y = this.C2Y(c);
                        this.OnAdd(_x, _y);
                    }
                    this.Contamination[r, c] = virusesRC + viruses;
                }
            }
        }
Beispiel #3
0
 private void Person_Sneeze(decimal viruses, CoViD.CL.Point location)
 {
     this.Grid.Contaminate(viruses, location);
 }
Beispiel #4
0
 private decimal Person_Inhale(CoViD.CL.Point location)
 {
     return(1000 + this.Grid.GetViruses(location));
 }
Beispiel #5
0
 /// <summary>
 /// Main CTor (sets location and beds).
 /// </summary>
 /// <param name="location">The posizion on the grid.</param>
 /// <param name="beds">The number of bed available in the hospital.</param>
 public Hospital(CoViD.CL.Point location, int beds)
 {
     this.Location = location;
     this.Beds     = beds;
 }
Beispiel #6
0
 /// <summary>
 /// Draws a point over the drawing grid at position x, y
 /// </summary>
 /// <param name="point">The 'location' of the point.</param>
 /// <param name="color">The color of the new point.</param>
 public void Point(CoViD.CL.Point point, Color color)
 {
     this.Cartesian.Point(point.X, point.Y, color);
 }
Beispiel #7
0
 public void Point(CoViD.CL.Point point, System.Drawing.Color color)
 {
     this.Point(point.X, point.Y, new System.Drawing.SolidBrush(color));
 }