Considering that a, b and c are constant integers, is there a small algorithm to find the couple (x, y) with y the closest to (and greater than or equal to) d ? WolframAlpha can give me results, but I have no idea how it found them.

For the case in itself : I'm making a GUI for a video game, and I would like to list, on different lines, the maps that the user can choose. I want the gap between each line to always be the same, and greater than a constant. I know the size of the GUI and the font height. Thus I get the following equation :

GUIHeight - ((#Lines*FontHeight)+((#Lines-1)*GapSize) = 0,

or #Lines*FontHeight + (#Lines-1)*GapSize = GUIHeight, with GapSize >= MinGapSize

The goal is to find the gap the closest to a constant limit in pixels, with the number of lines coming with it, in function of different font sizes (that are known) and the size of the GUI.

The lines and the gaps have to fill the whole GUI.

Thank you in advance ! : )

For the case in itself : I'm making a GUI for a video game, and I would like to list, on different lines, the maps that the user can choose. I want the gap between each line to always be the same, and greater than a constant. I know the size of the GUI and the font height. Thus I get the following equation :

GUIHeight - ((#Lines*FontHeight)+((#Lines-1)*GapSize) = 0,

or #Lines*FontHeight + (#Lines-1)*GapSize = GUIHeight, with GapSize >= MinGapSize

The goal is to find the gap the closest to a constant limit in pixels, with the number of lines coming with it, in function of different font sizes (that are known) and the size of the GUI.

The lines and the gaps have to fill the whole GUI.

Thank you in advance ! : )

Last edited: