public interface BattleshipControl
Modifier and Type | Interface and Description |
---|---|
static class |
BattleshipControl.PlayerType
Player type enumeration for Human and Ai game.
|
static class |
BattleshipControl.ViewerType
Represents the types of viewers
|
Modifier and Type | Method and Description |
---|---|
FieldBound |
getBoundary()
Returns the actual boundary used.
|
java.util.List<java.util.List<java.lang.Character>> |
getFieldView(BattleshipControl.PlayerType playerType,
BattleshipControl.ViewerType viewerType)
Get the proper field view depending on the player who owns it and
who is actually accessing it.
|
java.lang.String |
getNextPlaceableShip()
Returns the name of the next placeable ship.
|
void |
initializeAi()
Initializes the Ai
|
boolean |
isAiFleetSunk()
Returns
true if the AI fleet is sunk. |
boolean |
isGameNotFinished()
Returns
true if the game is not finished yet. |
boolean |
isPlayerFleetNotPlaced()
Returns
true if the player fleet isn't placed yet. |
boolean |
isPlayerFleetSunk()
Returns
true if the player fleet is sunk. |
boolean |
isPointWithinBoundaryLimits(Point2d point)
Returns
true if the point is within the boundary limits ,
false otherwise. |
void |
placeNextPlaceableShip(Point2d startingPosition)
Tries to place the next placeable ship on the player
field.
|
void |
setUpAiLevelEasy()
Sets the AI level to easy
|
void |
setUpAiLevelSuperEasy()
Sets the AI level to super easy
|
void |
shootAiField(Point2d point)
Tries to shoot the current cell selected.
|
void |
shootPlayerField()
Tries to shoot the player field.
|
boolean isGameNotFinished()
true
if the game is not finished yet.true
if the game is not finished yet.boolean isPlayerFleetSunk()
true
if the player fleet is sunk.true
if the player fleet is sunk.boolean isAiFleetSunk()
true
if the AI fleet is sunk.true
if the AI fleet is sunk.void shootAiField(Point2d point)
point
- a valid pointjava.lang.IllegalArgumentException
- if point isn't valid for the
current boundary.void shootPlayerField()
Point2d
.java.util.List<java.util.List<java.lang.Character>> getFieldView(BattleshipControl.PlayerType playerType, BattleshipControl.ViewerType viewerType)
playerType
- the type of player who owns the field.viewerType
- who is accessing the field.FieldBound getBoundary()
java.lang.String getNextPlaceableShip()
void placeNextPlaceableShip(Point2d startingPosition)
startingPosition
- the position where the ship will start.java.lang.IllegalArgumentException
- if the Point2d is invalidboolean isPlayerFleetNotPlaced()
true
if the player fleet isn't placed yet.true
if the player fleet isn't placed yet.boolean isPointWithinBoundaryLimits(Point2d point)
true if the point is within the boundary limits
,
false otherwise.point
- the point to checktrue if the point is within the boundary limits
.void setUpAiLevelSuperEasy()
java.lang.IllegalStateException
- if the level was setup alreadyvoid setUpAiLevelEasy()
java.lang.IllegalStateException
- if the level was setup alreadyvoid initializeAi()
java.lang.IllegalStateException
- if the Ai was setup already