Exemplo n.º 1
0
        public IEnumerable <CellSquare> Walk(CellSquare from)
        {
            var cursor = from;

            for (var index = 0; index < Times; index++)
            {
                cursor = cursor.MoveLeft();
                yield return(cursor);
            }
        }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 3
0
 public int DistanceTo(CellSquare point)
 {
     return(Math.Abs(X - point.X) + Math.Abs(Y - point.Y));
 }
Exemplo n.º 4
0
 public bool Equals(CellSquare other) => X == other.X && Y == other.Y;