public LocationOnBoard AiTurn()
        {
            Console.WriteLine("Calculating AI best move... please wait.");
            int             rowIndex = -1, colIndex = -1;
            LocationOnBoard move = new LocationOnBoard();

            ticTacToeLogic.CalculateAiTurn(ref rowIndex, ref colIndex);
            if (rowIndex != -1 && colIndex != -1)
            {
                move.row    = rowIndex;
                move.col    = colIndex;
                move.symbol = 'X';
            }
            return(move);
        }
        public LocationOnBoard HumanTurn()
        {
            string input;
            int    rowInput = 0, colInput = 0;

            Console.Write("Player {0} Turn. {2}Please choose row,col to place the symbol '{1}'{2}", GetCurrentPlayer(), GetSymbol(), "\n");
            input = Console.ReadLine();
            while (InputValidity(input) == false)
            {
                input = Console.ReadLine();
            }
            ObtainMoveValues(input, ref rowInput, ref colInput);
            LocationOnBoard move = new LocationOnBoard();

            move.row    = rowInput - 1; //The matrix is zero based.
            move.col    = colInput - 1; //The matrix is zero based.
            move.symbol = GetSymbol();
            return(move);
        }
Exemple #3
0
 public void UpdateLogicAfterTurn(LocationOnBoard i_move)
 {
     m_GameMatrix[i_move.row, i_move.col] = i_move.symbol;
 }