8th, 232 bytes
Code
0 >r a:new swap ( nip >bin s:len r> n:max >r a:push ) a:each drop a:new swap ( nip '0 G:c# r@ G:#> s:fmt a:push ) a:each drop rdrop a:new swap ( nip /0/ " " s:replace! a:push ) a:each drop ( nip /1/ "*" s:replace! . cr ) a:each drop
Ungolfed version with comments
\ convert to binary
: f 0 >r a:new swap ( nip >bin s:len r> n:max >r a:push ) a:each drop ;
\ pad binary number with zero
: f1 a:new swap ( nip '0 G:c# r@ G:#> s:fmt a:push ) a:each drop rdrop ;
\ replace every 0 with space
: f2 a:new swap ( nip /0/ " " s:replace! a:push ) a:each drop ;
\ replace every 1 with * and print each line of bricks
: f3 ( nip /1/ "*" s:replace! . cr ) a:each drop ;
These words must be invoked in sequence (see example)
Usage and examples
ok> [15,7,13,11] 0 >r a:new swap ( nip >bin s:len r> n:max >r a:push ) a:each drop a:new swap ( nip '0 G:c# r@ G:#> s:fmt a:push ) a:each drop rdrop a:new swap ( nip /0/ " " s:replace! a:push ) a:each drop ( nip /1/ "*" s:replace! . cr ) a:each drop
****
***
** *
* **
Or more clearly
ok> [15,11,15,15] f f1 f2 f3
****
* **
****
****