Exemplo n.º 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());
        }
Exemplo n.º 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());
        }