We’re rewarding the question askers & reputations are being recalculated! Read more.
    Tweeted twitter.com/StackCodeGolf/status/893662005802012672
2 added 442 characters in body
source | link
[12,2,2,2,3,4,4,8,8]        -> ffgghhiii
                               ddddeeeeeeee
                               bbbbbbbbcccc
                               aaaaaaaaaaaa

[4,4,4,4,4,4,4,4,4,4,4,4]   -> llll
                               aaaa
                               cfghk
                               cfghk
                               cfghk
                               cfghk
                               debij
                               debij
                               debij
                               debij

[4,4,4,4,4,4,3,3,3,2,2,2,1] -> jjml
                               iiil
                               hhhk
                               gggk
                               ffff
                               eeee
                               dddd
                               cccc
                               bbbb
                               aaaa
[12,2,2,2,3,4,4,8,8]      -> ffgghhiii
                             ddddeeeeeeee
                             bbbbbbbbcccc
                             aaaaaaaaaaaa

[4,4,4,4,4,4,4,4,4,4,4,4] -> llll
                             aaaa
                             cfghk
                             cfghk
                             cfghk
                             cfghk
                             debij
                             debij
                             debij
                             debij
[12,2,2,2,3,4,4,8,8]        -> ffgghhiii
                               ddddeeeeeeee
                               bbbbbbbbcccc
                               aaaaaaaaaaaa

[4,4,4,4,4,4,4,4,4,4,4,4]   -> llll
                               aaaa
                               cfghk
                               cfghk
                               cfghk
                               cfghk
                               debij
                               debij
                               debij
                               debij

[4,4,4,4,4,4,3,3,3,2,2,2,1] -> jjml
                               iiil
                               hhhk
                               gggk
                               ffff
                               eeee
                               dddd
                               cccc
                               bbbb
                               aaaa
1
source | link

Stackin' Boards

I have a bunch of boards I need to stack in as small a space as possible. Unfortunately, the boards fall over if I stack them more than 10 high. I need a program to tell me how to stack the boards to take as little horizontal space as possible, without stacking boards more than ten high, or having boards hanging out over empty space.

Your Task:

Write a program or function, that when given an array containing the lengths of boards, outputs as ASCII art the way to stack the boards to conserve as much horizontal space as possible, without stacking the boards more than 10 high or having any part of any board hanging out over empty space. Your ASCII art should show the configuration of the boards, with each one shown using a different character. There will be a maximum of 20 boards. For example, if the input was [2,2,4,2,2,4,4,4], a possible output is:

dhh
dgg
dff
dee
abc
abc
abc
abc

which is a stable configuration (although this would fall over in ~0.1 seconds in real life).

Input:

An array containing up to 20 integers, showing the lengths of the boards.

Output:

ASCII art showing the configurations of the boards, as outlined above.

Test Cases:

Note that there may be other solutions for the test cases, and the characters shown for each board may be different.

[12,2,2,2,3,4,4,8,8]      -> ffgghhiii
                             ddddeeeeeeee
                             bbbbbbbbcccc
                             aaaaaaaaaaaa

[4,4,4,4,4,4,4,4,4,4,4,4] -> llll
                             aaaa
                             cfghk
                             cfghk
                             cfghk
                             cfghk
                             debij
                             debij
                             debij
                             debij

Scoring:

This is , lowest score in bytes wins