Devices | Rows | D/R |
---|---|---|
1 | 1 | 1 |
2 | 1 | 2 |
3 | 2 | 2 |
4 | 2 | 2 |
5 | 2 | 2 |
6 | 2 | 3 |
7 | 3 | 3 |
8 | 3 | 3 |
9 | 3 | 3 |
10 | 3 | 4 |
11 | 3 | 4 |
12 | 3 | 4 |
13 | 4 | 4 |
14 | 4 | 4 |
15 | 4 | 4 |
16 | 4 | 4 |
17 | 4 | 5 |
18 | 4 | 5 |
19 | 4 | 5 |
20 | 4 | 5 |
21 | 5 | 5 |
-
-
Save jbis9051/b88dd8e4fad47cdfdab8c4cb8cc21b45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function LayoutFinder(numDevices: number): DeviceLayout { | |
let rows = 1; | |
let devices_per_row = 1; | |
for(let i = 2; i <= numDevices; i++){ | |
if(numDevices > rows * devices_per_row){ | |
if(rows === devices_per_row){ | |
devices_per_row++; | |
} else { | |
rows++; | |
} | |
} | |
} | |
return { | |
devices: numDevices, | |
rows: rows, | |
devices_per_row: devices_per_row | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment