Package com.neven.ticTacToeGame.model
Class PlayerVsPlayerGame
- java.lang.Object
-
- com.neven.ticTacToeGame.model.Game
-
- com.neven.ticTacToeGame.model.PlayerVsPlayerGame
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
PLAYER_2_NAME
Constant with a name of the player2(in this case an second user for games Player versus Player).
-
Constructor Summary
Constructors Constructor Description PlayerVsPlayerGame()
Constructor for classPlayerVsPlayerGame
.
Initialize parent(Game
class) constructor with a name of second player.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Game
makeFirstMove()
This method overrides parentGame.makeFirstMove()
method.protected void
makeMove()
This method overrides parentGame.makeMove()
method.-
Methods inherited from class com.neven.ticTacToeGame.model.Game
isPlayerWin, switchCurrentPlayer, winningCheckAndMakingMove
-
-
-
-
Field Detail
-
PLAYER_2_NAME
private static final java.lang.String PLAYER_2_NAME
Constant with a name of the player2(in this case an second user for games Player versus Player). Used in constructor for creation an object of theGame
.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PlayerVsPlayerGame
public PlayerVsPlayerGame()
Constructor for classPlayerVsPlayerGame
.
Initialize parent(Game
class) constructor with a name of second player.
-
-
Method Detail
-
makeFirstMove
public Game makeFirstMove()
This method overrides parentGame.makeFirstMove()
method.
This method just switch current player usingGame.switchCurrentPlayer()
method and return currentGame
.
Games Player versus Player does not have any logic for making moves.- Specified by:
makeFirstMove
in classGame
- Returns:
Game
with switched current player.
-
makeMove
protected void makeMove()
This method overrides parentGame.makeMove()
method.
This method just switch current player usingGame.switchCurrentPlayer()
method.
Games Player versus Player does not have any logic for making moves.
-
-