// constructor public Maze(int cols, int rows, WallInit init) { // basic properties Cols = cols; Rows = rows; Count = rows * cols; // array with the cells Cells = new byte[Count]; if (init == WallInit.Perimeter) { // top and down int br = rows - 1; for (int c = 0; c < cols; c++) { this [c, 0] |= (byte)Direction.N; this [c, br] |= (byte)Direction.S; } // left and right int bc = cols - 1; for (int r = 0; r < rows; r++) { this [0, r] |= (byte)Direction.W; this [bc, r] |= (byte)Direction.E; } } else if (init == WallInit.Full) { for (int r = 0; r < rows; r++) { for (int c = 0; c < cols; c++) { // four sides this [r, c] = Cell_NESW; } } } }