Write a program or a function in any programming language that takes a 6 digit hexadecimal input/argument. The input/argument can be 6 values or a 6 character string.
Your program should output an exactly 8 character wide rectangular block of characters containing only the hexadecimals supplied combined with spaces (+Linefeed). The rectangular block is a combination of smaller block shapes, one for each of the 6 supplied values.
Here follows 2 demostrative sample inputs and sample valid outputs:
"464fa6" or [4, 6, 4, 15, 10, 6]
One valid solution output:
44 66 ff 44 66 ff 66 ff aa f aaa ffff aa ffff aaa 6 44 66666 44
One valid solution output:
55555 22 bbbbbbbb b b b 33 fffff 3 ff ff ffffff 1
The output must be a rectangular shape
The output can be of any vertical height, but must be exactly 8 characters wide
The "inner blocks", refered to as the "block shape"s, cannot connect to any other block shape, the block shapes must be separated by a wall of blankspaces exactly 1 character wide horizontally, vertically and diagonally.
The wall of blankspaces cannot run parallell to the outer edges, only 1 character wide wall-edges can exist at the output edges. There should not exist any linked spaces anywhere on the outmost rectangle edge on the output.
The width of the wall of blankspaces should Not at any point exceed 1 character.
The inner block shapes should be uniform with the area of x characters, where x is the hexadecimal value supplied and the shape should consist of the charater x where x is the hexadecimal character representative.
The inner block shapes can be of any form as long as all of the shape characters connects vertically or horizontally, and does not valiating the rules for the wall of blankspaces.
The 6 block shapes can be placed in any internal "order" inside the outputted rectangle.
Valid input range: 1 ... 15 ("1" ... "f") for each shape. The input to your program should not contain any other information than the 6 hexadecimal numbers, and the input should not be sorted in any other way than in the samples before it is supplied to your program/function. Tell us what input format your solution uses (the input can not contain any other information than the hexadecimal values).
A inner block shape can be hollow. The hole should be of blankspace characters which counts as wall of blankspaces, meaning the hole in a hollow inner block shape cannot be more than 1 characters wide.
Three examples of valid hollow shapes:
aaa a aaa aaa 999 9 9 999 9 ffffff f ff ffffff
One example of an invalid hollow shape:
ffffff f f f f fffff
I assume that all input combinations is not possible to "solve" according to the rules above, therefor I list 10 sample inputs that your program should be able to "solve" (all is verified solveable):
1. 464fa6 (same as the first sample) 2. 35bf12 (second example input seen above) 3. 111126 4. ff7fff 5. 565656 6. abcdef 7. 1357bd 8. 8c6a42 9. ab7845 10. 349a67
Your program should be able to solve any of the 10 sample inputs in resonable time. translate resonable time to within 1 hour on a standard desktop computer. Say like: 3 Ghz Dual core, 4GB memory for a reference.
This is code golf, the shortest solution wins. The solution can be a fully working program or a function