Package a5.logic

Class TicTacToe


public class TicTacToe extends MNKGame
The classic game of Tic-Tac-Toe.
  • Constructor Details

    • TicTacToe

      public TicTacToe()
  • Method Details

    • makeMove

      public boolean makeMove(Position p)
      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(), and p is empty on board. on board.
      Specified by:
      makeMove in class MNKGame
      Parameters:
      p - the position to place a stone
      Returns:
      true if the action is valid, false otherwise
    • applyMove

      public TicTacToe applyMove(Position p)
      Returns: a new game state representing the state of the game after the current player takes a move p.
    • gameType

      public GameType gameType()
      Description copied from class: MNKGame
      Returns: the type of this game.
      Specified by:
      gameType in class MNKGame