Example #1
0
        public IEnumerable <CellSquare> Walk(CellSquare from)
        {
            var cursor = from;

            for (var index = 0; index < Times; index++)
            {
                cursor = cursor.MoveLeft();
                yield return(cursor);
            }
        }
Example #2
0
        public IEnumerable <CellSquare> Walk(CellSquare from)
        {
            var cursor = from;

            foreach (var instruction in Instructions)
            {
                foreach (var point in instruction.Walk(cursor))
                {
                    cursor = point;
                    yield return(point);
                }
            }
        }
Example #3
0
 public int DistanceTo(CellSquare point)
 {
     return(Math.Abs(X - point.X) + Math.Abs(Y - point.Y));
 }
Example #4
0
 public bool Equals(CellSquare other) => X == other.X && Y == other.Y;