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