Class Player
java.lang.Object
ygraph.ai.smartfox.games.GamePlayer
ubc.team09.player.Player
public class Player
extends ygraph.ai.smartfox.games.GamePlayer
This class handles communication with the game server. It holds no logic
for making decisions; all game decisions are made by the VI that it is
assigned.
Example
Example
Player player = new Player(
"username", // The username used for communication with the server.
new EDI(), // Use the EDI VI to decide moves.
C.BLACK, // Black plays first.
30 // 30 seconds per move.
)
// Try to connect to the server.
try {
player.connect();
} catch (Exception e) {
System.out.println("Error connecting to the server.")
}
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class ygraph.ai.smartfox.games.GamePlayer
Go, handleMessage, postSetup
-
Constructor Details
-
Player
Creates a new game player which consults the givenVIfor decisions.- Parameters:
username- The username assigned to this player.vi- The VI to consult for move recommendations.startingColor- Indicates which color will move first (in case, for some reason, Black is supposed to move first).timeLimit- The time limit per turn, in seconds.
-
-
Method Details
-
connect
public void connect()- Specified by:
connectin classygraph.ai.smartfox.games.GamePlayer
-
getGameClient
public ygraph.ai.smartfox.games.GameClient getGameClient()- Specified by:
getGameClientin classygraph.ai.smartfox.games.GamePlayer
-
getGameGUI
public ygraph.ai.smartfox.games.BaseGameGUI getGameGUI()- Specified by:
getGameGUIin classygraph.ai.smartfox.games.GamePlayer
-
handleMessage
-
handleGameMessage
-
onLogin
public void onLogin()- Specified by:
onLoginin classygraph.ai.smartfox.games.GamePlayer
-
userName
- Specified by:
userNamein classygraph.ai.smartfox.games.GamePlayer
-