TicTacToe—Collection-View

Game Rules
A game will consist of a sequence of the following actions:

  1. Initially, the “X” marks will play first (we call him/her player 1) and the player that gets to play with the “O” marks will play second (we call him/her player 2).

  2. Player 1 and 2 take turns making moves. A move (mark row column) should satisfy the following constraints:
    a. Move preconditions

    1. mark is “X” if it is player 1’s turn and “O” if it is player 2’s turn.
    2. The position (row, column) on the board is empty.
      b. Move postconditions
    3. After the move, the position (row, column) on the board will be occupied by a mark .
    4. It will be the other player’s turn.
  3. The game ends when either:
    a. one of the players wins the game, i.e. this player gets three of his/her marks in a row (vertically, horizontally, or diagonally).
    b. all the positions on the board are occupied. In this case, the game ends in a draw.

Assigment8

GitHub

View Github