private ColoredPoint GetOrCreateFor(Point point) { if (!_points.TryGetValue(point, out var coloredPoint)) { coloredPoint = new ColoredPoint(point); _points.Add(point, coloredPoint); } return(coloredPoint); }
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); } } }
public Machine(ColoredPoint from, Direction faces) { Current = from; Faces = faces; _points = new Dictionary <Point, ColoredPoint>(); }