The neighborhood is named after Edward F. Moore, a pioneer of cellular automata theory.
The idea behind the formulation of Moore neighborhood is to find the contour of a given graph.
This idea was a great challenge for most analysts of the 18th century, and as a result an algorithm was derived from the Moore graph which was later called the Moore Neighborhood algorithm.
The pseudocode for the Moore-Neighbor tracing algorithm is The original termination condition was to stop after visiting the start pixel for the second time.
This limits the set of contours the algorithm will walk completely.