public class RemotePlayer extends GreedyPlayer
GreedyPlayer
AI takes over.GreedyPlayer
Player.MergeOption, Player.PlayerStats
Modifier and Type | Field and Description |
---|---|
private Connection |
con
The remote player connection.
|
private boolean |
lost
True if the connection to the remote player was lost.
|
Constructor and Description |
---|
RemotePlayer(Connection con,
boolean ai,
java.lang.String name)
Constructs a new remote player with the given
player connection, AI status and name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
executeMove()
Executes a move for this player.
|
private boolean |
fallback()
Executes a fallback AI move if the player connection was lost.
|
boolean |
isLost()
Checks if the connection to the remote player was lost.
|
addArea, equals, findBestMergeFrom, findLargestUnownedObject, findLargestUnownedObject, getArea, getID, getName, getProxy, getScoreAnimation, getStats, getTheme, hashCode, hasMergeFrom, init, isAI, isLocal, owns, removeArea, setID, setName, stream, toString
private Connection con
private boolean lost
public RemotePlayer(Connection con, boolean ai, java.lang.String name)
con
- The connection to the remote player.ai
- Whether the remote player is an AI.name
- The name of the remote player.public boolean isLost()
private boolean fallback() throws java.lang.InterruptedException
java.lang.InterruptedException
- When the player was
interrupted (signals that the game was aborted).public boolean executeMove() throws java.lang.InterruptedException
Player
executeMove
in class GreedyPlayer
java.lang.InterruptedException
- When the player was
interrupted while making its move. Signalling
that the game was aborted.