Interface PlayerNode
- All Superinterfaces:
ToIntFunction<GameState>
- All Known Implementing Classes:
PlayerNode.Local, PlayerNode.Remote
public sealed interface PlayerNode
extends ToIntFunction<GameState>
permits PlayerNode.Local<P>, PlayerNode.Remote
marker and apply the player's next move to the game state.
The Local implementation of PlayerNode represents a local player, where the player's logic
is implemented directly in the application.
The Remote implementation of PlayerNode represents a remote player, where the player's
logic is implemented in a separate process and communicated with the application through a
transport mechanism.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classPlayerNode.Local<P extends Player>Represents a local player node that implements the player's logic directly in the application.static final classRepresents a remote player node that communicates with a client over a transport server. -
Method Summary
Modifier and TypeMethodDescriptionintapplyAsInt(GameState state) Gets the player's next move to apply to the game board with the current game state.Gets the player's marker: a string representation of the player's identity.
-
Method Details
-
playerMarker
String playerMarker()Gets the player's marker: a string representation of the player's identity. Returns the marker (e.g. "X" or "O") used by this player.- Returns:
- the player's marker
-
applyAsInt
Gets the player's next move to apply to the game board with the current game state.- Specified by:
applyAsIntin interfaceToIntFunction<GameState>- Parameters:
state- the current state of the game- Returns:
- the location on the game board where the move was made
-