dkh.dungeon
Unstable
-
Declaration
static immutable int[2][4] direction4;
[+row, +col, -row, -col]
-
Declaration
static immutable int[2][8] direction8;
[+col, +row+col, +row, +row-col, ...]
-
Declaration
struct Dungeon;
プロコンでよくある2Dダンジョン探索を支援するライブラリ
int[2] = [row, column]
をベースとする-
Declaration
static int[2] move4(int[2] p, int dir);
pからdir方向に移動したときの座標
-
Declaration
static int[2] move8(int[2] p, int dir);
pからdir方向に移動したときの座標, 8方向
-
Declaration
this(int R, int C);
Parameters
int R
row_max
int C
column_max
-
Declaration
const bool isInside(int[2] p);
pが[0, 0] ~ [R-1, C-1]に入っているか?
-
Declaration
const int getID(int[2] p);
1次元に潰したときのID, r*R+c
-
-
Declaration
auto neighbors4(int[2] p);
Examples
import std.algorithm : equal; assert(equal( [3, 5].neighbors4, [[4, 5], [3, 6], [2, 5], [3, 4]], ));
-
Declaration
auto neighbors4(int[2] p, in Dungeon dg);
list neighbors only inside
Examples
import std.algorithm : equal; assert(equal( [0, 0].neighbors4(Dungeon(3, 3)), [[1, 0], [0, 1]], ));
-
Declaration
auto neighbors8(int[2] p, in Dungeon dg);
list neighbors only inside
Examples
import std.algorithm : equal; assert(equal( [0, 0].neighbors8(Dungeon(3, 3)), [[1, 0], [1, 1], [0, 1]], ));