public interface Field
extends java.io.Serializable
Modifier and Type | Method and Description |
---|---|
FieldBound |
getFieldBound()
Returns the boundary of the field.
|
FieldCell[][] |
getFieldCells()
Returns the field cells matrix.
|
boolean |
isShipPlaceable(Ship ship,
Point2d point)
Returns true if the ship is placeable.
|
void |
placeShip(Ship ship,
Point2d point)
Places a ship in the field with a standard direction (EAST).
|
void |
placeShip(Ship ship,
Point2d point,
ShipDirection direction)
Places a ship in the field.
|
void |
updateStateWithShot(Shot shot)
Updates the field with a shot.
|
void placeShip(Ship ship, Point2d point, ShipDirection direction)
ship
- ship to place. The field cells which will be occupied
by the ship must be emptypoint
- position where the ship starts. The field cell must be
empty.direction
- direction of the shipjava.lang.IllegalArgumentException
- if the field cells are not emptyvoid placeShip(Ship ship, Point2d point)
ship
- ship to place. The field cells which will be occupied
by the ship must be emptypoint
- position where the ship starts. The field cell
must be emptyjava.lang.IllegalArgumentException
- if the field cells are not emptyboolean isShipPlaceable(Ship ship, Point2d point)
ship
- the current ship to placepoint
- position where the ship will start. It must be within
the boundary.true
if the ship is placeablejava.lang.IllegalArgumentException
- if the point is not within the boundaryvoid updateStateWithShot(Shot shot)
shot
- any kind of shot Shot
. It must be within
the boundary limit.java.lang.IllegalArgumentException
- if the point is not within the boundary.FieldBound getFieldBound()
FieldCell[][] getFieldCells()