isShiftingNeighbourhood

Tests if something is a ShiftingNeighbourhood.

returns true if T is a ShiftingNeighbourhood of dimension N.

A ShiftingNeighbourhood is a $(NEIGHBOURHOOD) that can change each generation. It's shift function is meant to be called by the ca's $(LATTICE) every time a generation changes.

A ShiftingNeighbourhood is a neighbourhood with the additional primitive void shift()

template isShiftingNeighbourhood (
T
uint N
) {}

Members

Manifest constants

isShiftingNeighbourhood
enum isShiftingNeighbourhood;
Undocumented in source.

Parameters

T

type to be tested

N

number of dimensions

Return Value

true if T is a ShiftingNeighbourhood, false if not

Examples

struct Foo {
	enum uint Dimension = 2;

	private bool state = false;

	int[2][] getNeighboursCoordinates(int x, int y) {
		if(state) {
			return [[x+1, y+1]];
		} else {
			return [[x-1, y-1]];
		}
	}

	void shift() { state = !state; }
}

static assert( isNeighbourhood!(Foo, 2));
static assert( isShiftingNeighbourhood!(Foo, 2));
static assert(!isShiftingNeighbourhood!(string, 1));

Meta