Exemple #1
0
        public List <pos> PositionsAtDistance(int dist)
        {
            List <pos> result = new List <pos>();

            for (int i = row - dist; i <= row + dist; ++i)
            {
                for (int j = col - dist; j <= col + dist; ++j)
                {
                    if (DistanceFrom(i, j) == dist && Global.BoundsCheck(i, j))
                    {
                        result.Add(new pos(i, j));
                    }
                }
            }
            return(result);
        }
Exemple #2
0
        public List <pos> PositionsWithinDistance(int dist, bool exclude_origin)
        {
            List <pos> result = new List <pos>();

            for (int i = row - dist; i <= row + dist; ++i)
            {
                for (int j = col - dist; j <= col + dist; ++j)
                {
                    if (i != row || j != col || exclude_origin == false)
                    {
                        if (Global.BoundsCheck(i, j))
                        {
                            result.Add(new pos(i, j));
                        }
                    }
                }
            }
            return(result);
        }