GridWorld constructor

GridWorld(
  1. int numRows,
  2. List<bool> cells
)

Constructor accepting a pre-defined cell list. Fails if the world isn't rectangular.

Implementation

GridWorld(int numRows, List<bool> cells)
    : _numRows = numRows,
      _numCols = cells.length ~/ numRows,
      _cells = cells,
      assert(cells.length == (numRows * (cells.length ~/ numRows)),
          'world must be rectangular');