예제 #1
0
        public static IEnumerable <AoCPoint> Adjacent(this AoCPoint point, bool diagonal)
        {
            if (diagonal)
            {
                yield return(point.Up().Left());
            }
            yield return(point.Up());

            if (diagonal)
            {
                yield return(point.Up().Right());
            }
            yield return(point.Right());

            if (diagonal)
            {
                yield return(point.Down().Right());
            }
            yield return(point.Down());

            if (diagonal)
            {
                yield return(point.Down().Left());
            }
            yield return(point.Left());
        }
예제 #2
0
        public static IEnumerable <AoCPoint> Adjacent(this AoCPoint point)
        {
            yield return(point.Up());

            yield return(point.Right());

            yield return(point.Down());

            yield return(point.Left());
        }