Add caption to verbatim environment and adjust padding?

I do like the verbatim setting and the ascii border, but the wanted algorithm caption padding is too great, same with the top to flow text. Am i doing it right?

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum}

\begin{document}
If we want dummy text in our document then we generally search for lorem ipsum text generators and copy-paste those texts/paragraphs in our do.\\
\begin{minipage}[]{1\linewidth}
\centering
\begin{verbatim}
+----------------------------------------------------------+
| get the power output of PV and load                      |
|     rebalance at the right node: (1)/(2) grid in/outflow |
+----------------------------------------------------------+
\end{verbatim}
\captionof{algorithm}{Core logic of the individual control}
\label{ctrli}
\end{minipage}
In LaTeX, we don’t need to do such copy and paste thing. LaTeX has different packages which automatically generates dummy text in our document. You can generate them with just a few lines of code.
\cref{ctrli} shows \dots
\end{document}


Looks like

• Your MWE does not compile. You're missing \usepackage{caption,cleveref} and the float algorithm is not defined. Using \begin{center}/\end{center} the vertical spacing seems acceptable to me. – Henk Metselaar Apr 30 at 11:14