Interface StrategicTurningPoint
- All Known Implementing Classes:
StrategicTurningPoint.CenterSquareControl, StrategicTurningPoint.GameWon, StrategicTurningPoint.ImmediateLossPrevention
public sealed interface StrategicTurningPoint
permits StrategicTurningPoint.CenterSquareControl, StrategicTurningPoint.ImmediateLossPrevention, StrategicTurningPoint.GameWon
A strategic turning point in a game of Tic-Tac-Toe.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordA strategic turning point where the player has control of the center square.static final recordA strategic turning point where the player has won the game.static final recordA strategic turning point where the player has prevented an immediate loss.static enumPriority/severity level of the strategic turning point. -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<StrategicTurningPoint> The game state at the strategic turning point.intThe move number at the strategic turning point.static booleanmovePreventedImmediateLoss(GameState prevGameState, GameState gameState) Check for a strategic turning point where the player is about to lose.static booleanmoveTakesCenterSquareControl(GameState prevGameState, GameState gameState) Check for a strategic turning point where the player has control of the center square.static booleanmoveWinsGame(GameState gameState) Check for a strategic turning point where the player has won the game.The player marker for the player who made the strategic move.The priority level of the strategic turning point.
-
Method Details
-
playerMarker
String playerMarker()The player marker for the player who made the strategic move. -
gameState
GameState gameState()The game state at the strategic turning point. -
moveNumber
int moveNumber()The move number at the strategic turning point. -
priorityLevel
StrategicTurningPoint.PriorityLevel priorityLevel()The priority level of the strategic turning point. -
moveTakesCenterSquareControl
Check for a strategic turning point where the player has control of the center square.- Parameters:
prevGameState- the game state before the strategic movegameState- the game state after the strategic move- Returns:
- true if the strategic turning point is a center square control
-
movePreventedImmediateLoss
Check for a strategic turning point where the player is about to lose.- Parameters:
prevGameState- the game state before the strategic movegameState- the game state after the strategic move- Returns:
- true if the player is about to lose, false otherwise
-
moveWinsGame
Check for a strategic turning point where the player has won the game.- Parameters:
gameState- the game state after the strategic move return true if the player has won the game, false otherwise
-
from
static Optional<StrategicTurningPoint> from(GameState prevGameState, GameState gameState, int moveNumber)
-