BaseComm/BotConnection.cs
/// <summary>
/// Decode the grid given by the `updateObstacleGrid` function.
/// </summary>
/// <param name="grid">Encoded grid</param>
/// <returns>Decoded grid, with (0,0) corresponding to upper-left corner</returns>
Decode the grid given by the `updateObstacleGrid` function.
Decode the grid given by the ` updateObstacleGrid ` function .
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;
        }
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 ; }
Decode the grid given by the `updateObstacleGrid` function.
Decode the grid given by the ` updateObstacleGrid ` function .
Decoded grid, with (0,0) corresponding to upper-left corner
Decoded grid with ( 0 0 ) corresponding to upper - left corner
grid
long[]
None