示例#1
0
        private ColoredPoint GetOrCreateFor(Point point)
        {
            if (!_points.TryGetValue(point, out var coloredPoint))
            {
                coloredPoint = new ColoredPoint(point);
                _points.Add(point, coloredPoint);
            }

            return(coloredPoint);
        }
示例#2
0
 public IEnumerable <ColoredPoint> AllPointsFromTopLeftToBottomRight()
 {
     for (var i = Left; i <= Right; i++)
     {
         for (var j = Top; j >= Bottom; j--)
         {
             var point = new Point(i, j);
             if (!_coloredPoints.TryGetValue(point, out var coloredPoint))
             {
                 coloredPoint = new ColoredPoint(point);
             }
             yield return(coloredPoint);
         }
     }
 }
示例#3
0
 public Machine(ColoredPoint from, Direction faces)
 {
     Current = from;
     Faces   = faces;
     _points = new Dictionary <Point, ColoredPoint>();
 }