Class PlayerNode.Local<P extends Player>
java.lang.Object
org.xxdc.oss.example.PlayerNode.Local<P>
- Type Parameters:
P- the type of the player implementation
- All Implemented Interfaces:
Serializable,ToIntFunction<GameState>,PlayerNode
- Enclosing interface:
PlayerNode
public static final class PlayerNode.Local<P extends Player>
extends Object
implements PlayerNode, Serializable
Represents a local player node that implements the player's logic directly in the application.
The local player node is responsible for providing the player's next move to apply to the game
board. The local player node is serializable, allowing it to be persisted and transferred
between processes.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.xxdc.oss.example.PlayerNode
PlayerNode.Local<P extends Player>, PlayerNode.Remote -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintapplyAsInt(GameState state) Gets the player's next move to apply to the given game board.player()Gets the player's marker: a string representation of the player's identity.toString()
-
Constructor Details
-
Local
-
-
Method Details
-
applyAsInt
Gets the player's next move to apply to the given game board.- Specified by:
applyAsIntin interfacePlayerNode- Specified by:
applyAsIntin interfaceToIntFunction<P extends Player>- Parameters:
state- the current state of the game- Returns:
- the location on the game board where the move was made
-
playerMarker
Description copied from interface:PlayerNodeGets the player's marker: a string representation of the player's identity. Returns the marker (e.g. "X" or "O") used by this player.- Specified by:
playerMarkerin interfacePlayerNode- Returns:
- the player's marker
-
player
-
toString
-