예제 #1
0
        public List <(int x, int y)> FindMaskWithinImage(ImageMask mask)
        {
            var list = new List <(int x, int y)>();

            for (int baseY = 0; baseY < this.Size - mask.Height; baseY++)
            {
                for (int baseX = 0; baseX < this.Size - mask.Width; baseX++)
                {
                    bool foundMonster = true;

                    foreach ((int offsetX, int offsetY) in mask.GetMaskedLocations())
                    {
                        int x = baseX + offsetX;
                        int y = baseY + offsetY;

                        if (this.rows[y][x] != '#')
                        {
                            foundMonster = false;
                            break;
                        }
                    }

                    if (foundMonster)
                    {
                        list.Add((baseX, baseY));
                    }
                }
            }

            return(list);
        }
예제 #2
0
 public void PrintImageWithinImage(ImageMask mask, IList <(int x, int y)> locations, Action <string> printRowAction)