neighbors8

list neighbors only inside

neighbors8
(
int[2] p
,
)

Examples

1 import std.algorithm : equal;
2 assert(equal(
3     [0, 0].neighbors8(Dungeon(3, 3)),
4     [[1, 0], [1, 1], [0, 1]],
5     ));

Meta