コード例 #1
0
 public string GetCellString(GridPoint3D point)
 {
     if (BugCells.Contains(point))
     {
         return("#");
     }
     if (GetIsPointOffMap(point))
     {
         return(" ");
     }
     if (IsRecursive && CenterPointXY.Equals(point.XYPoint))
     {
         return("?");
     }
     return(".");
 }
コード例 #2
0
        public BigInteger GetBiodiversityRating(int layer)
        {
            BigInteger result         = 0;
            BigInteger cellPointValue = 1;

            for (int y = 0; y < Height; y++)
            {
                for (int x = 0; x < Width; x++)
                {
                    var point = new GridPoint3D(x, y, layer);
                    if (BugCells.Contains(point))
                    {
                        result += cellPointValue;
                    }
                    cellPointValue *= 2;
                }
            }
            return(result);
        }