Ejemplo n.º 1
0
        /// <summary>Draws the current board for a command line interface.</summary>
        private void DrawBoard()
        {
            byte i = 0;                 // iterator

            // iterate through the board
            for (i = 0; i < theBoard.Length; ++i)
            {
                if (theBoard.At(i))
                {
                    switch (theBoard.GetAt(i).Value)
                    {
                    case Piece.PieceValue.X:
                        Console.Write("X ");
                        break;

                    case Piece.PieceValue.O:
                        Console.Write("O ");
                        break;

                    default:
                        // some kind of error has occured
                        throw new System.Exception();
                    }                     // end switch
                }
                else
                {
                    Console.Write("{0} ", i);
                }

                // start a new line after mDim squares
                if (i % theBoard.Dimension == theBoard.Dimension - 1)
                {
                    Console.WriteLine();
                }
            }             // end for loop
        }