Ejemplo n.º 1
0
        public string[] PrintBoard(Board board)
        {
            int width  = board.Width;
            int height = board.Height;

            string[] boardPrint = new string[height];

            for (int y = 0; y < height; y++)
            {
                string row = "";
                for (int x = 0; x <= (width - 1); x++)
                {
                    Point atPoint = new Point(x, y);
                    if (board.BlockAt(atPoint) == null)
                    {
                        if (x % 2 == 0)
                        {
                            row += " . ";
                        }
                        else
                        {
                            row += "   ";
                        }
                    }
                    else
                    {
                        row += board.BlockAt(atPoint).Print();
                    }
                }
                boardPrint[y] = $"{row}";
            }

            return(boardPrint);
        }