Beispiel #1
0
        private static void WriteBoard()
        {
            var board       = _game.GetBoard();
            var boardHeight = board.GetLength(0);
            var boardWidth  = board.GetLength(1);

            const string labels     = "ABCDEFGH";
            int          labelIndex = 0;

            Console.WriteLine("   A   B   C   D   E   F   G   H"); // FIX - not scalable
            Console.WriteLine("--- --- --- --- --- --- --- --- ---");
            for (var i = 0; i < boardHeight; i++)
            {
                for (var j = 0; j < boardWidth; j++)
                {
                    int cell = board[i, j];
                    Console.Write(" | ");
                    Console.Write(" OX".Substring(cell, 1));
                }

                Console.Write(" | ");
                Console.WriteLine(labels.Substring(labelIndex++, 1));
                Console.WriteLine(new String('-', 3 + (boardWidth * 4)));
            }

            WriteScore();
        }