new Ship(length, row, col, isVertical)
Represents a single ship on a board. Creates a Ship object at the given size, location, and direction.
Parameters:
Name | Type | Description |
---|---|---|
length |
number | How many spaces long the ship should be |
row |
number | The row coordinate of the top end of the ship |
col |
number | The col coordinate of the left end of the ship |
isVertical |
boolean | Direction of ship (false = horizontal) |
Methods
listIntersecting()
Returns:
An array of (row, col) pairs of coordinates