Exemplo n.º 1
0
        public static Point ApplyDirection(this WireDirection direction, Point position, Dictionary <Point, WirePresence> map,
                                           WirePresence wireType)
        {
            for (int a = 0; a < direction.Length; a++)
            {
                position = new Point(position.X + direction.Vector.X,
                                     position.Y + direction.Vector.Y);

                if (!map.ContainsKey(position))
                {
                    map[position] = WirePresence.None;
                }

                map[position] = map[position] | wireType;
            }

            return(position);
        }
Exemplo n.º 2
0
        public static (int, Point) ApplyDirection(this WireDirection direction, Point position, Dictionary <Point, int> map,
                                                  int count)
        {
            for (int a = 0; a < direction.Length; a++)
            {
                position = new Point(position.X + direction.Vector.X,
                                     position.Y + direction.Vector.Y);
                count++;

                if (!map.ContainsKey(position))
                {
                    map[position] = 0;
                }

                map[position] = count;
            }

            return(count, position);
        }