A little library for generating [Moore neighborhoods] (i.e., the surrounding cells of a single cell in a grid) of arbitrary range and dimensions. Or, the red edge squares for a blue center square:
The code was ported from [hughsk/moore] and adjusted for Rust features such as const generics.
```rust use moore_neighboorhood::dynamic::moore;
fn example() {
let mut result: Vec
let mut expected = [
[-1,-1], [ 0,-1], [ 1,-1],
[-1, 0], [ 1, 0],
[-1, 1], [ 0, 1], [ 1, 1]
];
result.sort();
expected.sort();
assert_eq!(result, expected);
} ```
Using const generics for the dimension:
```rust use mooreneighboorhood::genericdimension::moore;
fn example() { let mut result: Vec<[isize; 2]> = moore(1);
let mut expected = [
[-1,-1], [ 0,-1], [ 1,-1],
[-1, 0], [ 1, 0],
[-1, 1], [ 0, 1], [ 1, 1]
];
result.sort();
expected.sort();
assert_eq!(result, expected);
} ```