public void RenderBoard(IBoard board) { //TODO: validate console diimensions var startRowPrint = Console.WindowHeight / 2 - board.TotalRows / 2 * ConsoleConstants.CharactersPerBoardSquareRow; var startColPrint = Console.WindowWidth / 2 - board.TotalCols / 2 * ConsoleConstants.CharactersPerBoardSquareCol; // var startRowPrint = Console.WindowWidth / 2 - board.TotalRows / 2 * ConsoleConstants.CharactersPerBoardSquareRow; // var startColPrint = Console.WindowHeight / 2 - board.TotalCols / 2 * ConsoleConstants.CharactersPerBoardSquareCol; //fix charactersperboadsquareCol е първо var currentRow = startRowPrint; var currentCol = startColPrint; Console.BackgroundColor = ConsoleColor.White; int counter = 1; for (int top = 0; top < board.TotalRows; top++) { for (int left = 0; left < board.TotalCols; left++) { currentRow = startRowPrint + top * ConsoleConstants.CharactersPerBoardSquareCol; currentCol = startColPrint + left * ConsoleConstants.CharactersPerBoardSquareRow; // currentRow = startColPrint + top * ConsoleConstants.CharactersPerBoardSquareRow; // currentCol = startRowPrint + left * ConsoleConstants.CharactersPerBoardSquareRow; ConsoleColor backgroundColor; if (counter % 2 == 0) { backgroundColor = DarkSquareBoardColor; Console.BackgroundColor = DarkSquareBoardColor; } else { backgroundColor = LightSquareBoardColor; Console.BackgroundColor = LightSquareBoardColor; } var position = Position.GetPositionFromCoordinatesArray(top, left, board.TotalRows); var piece = board.GetPieceAtPosition(position); ConsoleFeatures.PrintPiece(piece, backgroundColor, currentRow, currentCol); counter++; } counter++; } Console.SetCursorPosition(Console.WindowWidth / 2, 2); }