@@ -0,0 +1,1160 @@
+package cs437.som.topology;%0A%0Aimport cs437.som.Dimension;%0Aimport cs437.som.GridType;%0Aimport cs437.som.SOMError;%0A%0A/**%0A * A square grid strategy for SOMs, using Chebyshev distance, which corresponds%0A * to the Moore neighborhood.%0A */%0Apublic class Moore implements GridType %7B%0A    private int neuronCount = 0;%0A    private int width = 0;%0A%0A    @Override%0A    public void setNeuronCount(Dimension dimension) %7B%0A        width = dimension.x;%0A        neuronCount = width * dimension.y;%0A    %7D%0A%0A    @Override%0A    public double gridDistance(int neuron0, int neuron1) %7B%0A        if (neuron0 %3E neuronCount %7C%7C neuron0 %3C 0) %7B%0A            throw new SOMError(%22Invalid neuron index: %22 + neuron0);%0A        %7D%0A%0A        if (neuron1 %3E neuronCount %7C%7C neuron1 %3C 0) %7B%0A            throw new SOMError(%22Invalid neuron index: %22 + neuron1);%0A        %7D%0A%0A        int row0 = neuron0 / width;%0A        int col0 = neuron0 %25 width;%0A        int row1 = neuron1 / width;%0A        int col1 = neuron1 %25 width;%0A%0A        int dr = Math.abs(row1 - row0);%0A        int dc = Math.abs(col1 - col0);%0A%0A        return (dr %3E dc) ? dr : dc;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return %22Moore%22;%0A    %7D%0A%7D%0A

Add Moore neighborhood square grid to topologies.