# Grid

#### new Grid(rows, cols)

##### Parameters:

Name | Type | Description
--- | --- | ---
`rows` | rows | Number of rows in the grid.
`cols` | cols | Number of cols in the grid.

Source:
  - graphics/grid.js, line 3

### Methods

#### get(i, j) → {object}

Gets the object stored at the requested row and column.

##### Parameters:

Name | Type | Description
--- | --- | ---
`i` | number | The row of the desired object.
`j` | number | The col of the desired object.

Source:
  - graphics/grid.js, line 48

##### Returns:

The object stored in the grid at that position.

Type
  object

#### inBounds(row, col, Whether)

Checks whether the given row and col exist in the grid.

##### Parameters:

Name | Type | Description
--- | --- | ---
`row` | number | Row of the position being checked.
`col` | number | Col of the position being checked.
`Whether` | boolean | or not the given position is in bounds.

Source:
  - graphics/grid.js, line 83

#### init(value)

Initializes the contents of the grid with `value`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | number | string | object | The value to be inserted in all positions of the grid.

Source:
  - graphics/grid.js, line 34

#### initFromArray(arr)

Initializes a Grid from an array.

##### Parameters:

Name | Type | Description
--- | --- | ---
`arr` | array | Array containing elements to be made into a Grid.

Source:
  - graphics/grid.js, line 19

#### numCols() → {number}

Returns the number of cols in the grid.

Source:
  - graphics/grid.js, line 73

##### Returns:

The number of cols in the grid.

Type
  number

#### numRows() → {number}

Returns the number of rows in the grid.

Source:
  - graphics/grid.js, line 65

##### Returns:

The number of rows in the grid.

Type
  number

#### set(i, j)

Sets an object at the requested row and column.

##### Parameters:

Name | Type | Description
--- | --- | ---
`i` | number | The row of the destination of the object.
`j` | number | The row of the destination of the object.

Source:
  - graphics/grid.js, line 57

#### toList() → {array}

Converts a grid to a list. For example: ------- A B C D E F G H I J K L ------- would convert to: ------- [[0, 0, 'A'], [0, 1, 'B'], [0, 2, 'C'], [0, 3, 'D'], [1, 0, 'E']...[2, 3, 'L']]

Source:
  - graphics/grid.js, line 106

##### Returns:

List representation of the Grid.

Type
  array

#### toString() → {string}

Generates a string representation of the Grid.

Source:
  - graphics/grid.js, line 124

##### Returns:

A representatino of a grid of the format "A B C
D E F
G H I
"

Type
  string