Movement in Play Space

Play space is cube N units in each dimension.

* Ordered triple

Current position: (x0, y0, z0)
Next position:    (x1, y1, z1)

Play space boundary:

 0 <= x < N AND  0 <= y < N AND  0 <= z < N

Valid moves:

 |x1 - x0| <= 1 AND |y1 - y0 | <= 1 AND |z1 - z0 | <= 1

* Array

Index numbers assigned sequentially parallel to x axis for each y and
each z.

Play space boundary:

 Position index p: 0 <= p < N^3

Transform functions:

 x(p) = p % N
 y(p) = p % N^2 / N
 z(p) = p / N^2

Valid moves:

 |x(p1) - x(p0) | <= 1
 |y(p1) - y(p0) | <= 1
 |z(p1) - z(p0) | <= 1

(Or enumerate)
* Statistics

** Cubic lattice interior node ratio

<interior nodes>/<total nodes>

interior nodes = (n - 2)^3 (n: n >= 3)

total nodes = n^3

interior ratio = (n - 2)^3 / n^3

|  n | total | ratio   | remarks |
|----+-------+---------+---------|
|  3 |    27 | 1/27    |         |
|  4 |    64 | 1/8     |         |
|  5 |   125 | 27/125  |         |
|  6 |   216 | 8/27    |         |
|  7 |   343 | 125/343 |         |
|  8 |   512 | 27/64   |         |
|  9 |   729 | 343/729 |         |
| 10 |  1000 | 64/125  | > 1/2   |
|    |       |         |         |