Moore Neighborhood

Author

Eric W. Weisstein
April 15, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/CellularAutomata/MooreNeighborhood.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/MooreNeighborhood.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Definition

MooreNeighborhood[r_,m_]:=Table[If[Abs[x]≤r &&Abs[y]≤r,1,0],{x,-m,m},{y,-m,m}]

Plots

V5

Show[GraphicsArray[Partition[Table[ListDensityPlot[1-MooreNeighborhood[n,4],Frame->False,PlotLabel->TraditionalForm[r==n],DisplayFunction->Identity],{n,0,3}],2]]]

V7

GraphicsGrid[Partition[Table[ArrayPlot[MooreNeighborhood[n,4],Frame->False,Mesh->True,PlotLabel->r==n],{n,0,3}],2],ImageSize->300]

Counts of Black Cells

Table[Count[Flatten[MooreNeighborhood[n,10]],1],{n,0,10}]

A016754