Beispiel #1
0
        // 3rd Method
        public bool ChangePlayer()
        {
            // Switch turns after placing a board token for the designated player
            if (playerTurn == BoardToken.X)
            {
                playerTurn = BoardToken.O;
            }
            else if (playerTurn == BoardToken.O)
            {
                playerTurn = BoardToken.X;
            }

            return(true);
        }
Beispiel #2
0
 // 2nd Method
 public bool IsTurn(BoardToken value)
 {
     /**
      *  Checks to see if the "playerturn" is the value of the enum which
      *  designate an X or an O
      **/
     if (playerTurn == value)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #3
0
        // 1st Method
        public void CreateBoard()
        {
            /**
             *  - Using the enum to make a copy of the board using 3 columns and 3 rows
             *    that will be used in a GUI
             **/
            BoardToken[,] boardCopy = new BoardToken[ROWS, COLUMNS];

            /**
             *  - Goes through each of the rows and columns and copy the "board" to
             *    "boardCopy"
             **/
            for (int row = 0; row < ROWS; row++)
            {
                for (int col = 0; col < COLUMNS; col++)
                {
                    boardCopy[row, col] = board[row, col];
                }
            }
        }
Beispiel #4
0
 public AddTokenAction(int row, int column, BoardToken token)
 {
     Token  = token;
     Row    = row;
     Column = column;
 }
Beispiel #5
0
 public void AddToken(BoardToken token)
 {
     _boardTokens.Add(token);
 }