Package a5.logic
Class TicTacToe
java.lang.Object
a5.logic.MNKGame
a5.logic.TicTacToe
The classic game of Tic-Tac-Toe.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns: a new game state representing the state of the game after the current player takes a movep
.gameType()
Returns: the type of this game.boolean
Effect: place a stone as the current player at p, and advance to the next turn Checks:p
is a valid position to place a stone, that is, 0 <=p.rowNo()
<rowSize()
, 0 <=p.colNo()
<colSize()
, andp
is empty on board.Methods inherited from class a5.logic.MNKGame
advanceTurn, board, changePlayer, colSize, countToWin, currentPlayer, currentTurn, equals, hasEnded, hashCode, legalMoves, result, rowSize, setResult, stateEqual, toString
-
Constructor Details
-
TicTacToe
public TicTacToe()
-
-
Method Details
-
makeMove
Description copied from class:MNKGame
Effect: place a stone as the current player at p, and advance to the next turn Checks:p
is a valid position to place a stone, that is, 0 <=p.rowNo()
<rowSize()
, 0 <=p.colNo()
<colSize()
, andp
is empty on board. on board. -
applyMove
Returns: a new game state representing the state of the game after the current player takes a movep
. -
gameType
Description copied from class:MNKGame
Returns: the type of this game.
-