BaseComm.BotConnection.DecodeObstacleGrid C# (CSharp) Method

DecodeObstacleGrid() public static method

Decode the grid given by the `updateObstacleGrid` function.
public static DecodeObstacleGrid ( long grid ) : ].bool[
grid long Encoded grid
return ].bool[
        public static bool[,] DecodeObstacleGrid(long[] grid)
        {
            bool[,] result = new bool[GRID_HEIGHT, GRID_WIDTH];
            for (int i = 0; i < GRID_HEIGHT; i++) {
                long row = grid[i];
                long colMask = 1;
                for (int j = 0; j < GRID_WIDTH; j++) {
                    result[i, j] = (row & colMask) != 0;
                    colMask = colMask << 1;
                }
            }
            return result;
        }