Help me with my Halloween decoration
Java, 829, 798
Yeah. Substantially improved thanks to Kevin Cruijssen and corvus_192.
s->{String[]e=s.split(" ");char c[][]=new char[8][e.length*6],t,u,h='|';int y,x=2,i=0,j;for(String l:e){y=0;char[]p=l.toCharArray(),z=c[y];int a=p[0],b=p[1],f=p[2],d=p[3],k=x-1,m=x+1;t=a<49?'°':a<50?'¯':a<51?45:a<52?'^':39;u=(char)(b<50?b+70:b<51?111:b<52?95:39);if(d>50){z[x]=h;if(f!=49){y=2;c[1][x]=h;c[2][x]=h;}z=c[y];z[k]=46;z[m]=46;z=c[++y];z[k]=58;z[m]=58;z[x]=34;}if(d==50){z[x]=40;z[m]=41;c[++y][x]='´';c[y][m]=96;}if(d==49){z=c[++y];z[k]=94;z[x]=34;z[m]=94;}if(f>49){y=6;c[y][x]=44;}if(f>48){y=f>49?7:3;z=c[y++];z[x]=u;z[k]=t;z[m]=t;z[x-2]=40;z[x+2]=41;}if(f==49){z=c[y++];z[x]=h;z[k]=95;z[m]=95;z=c[y];z[x]=h;z[k]=91;z[m]=93;z[x-2]=47;c[y++][x+2]=92;c[y++][x]=h;c[y][k]=47;c[y][m]=92;}x+=6;}for(;i<8;i++){s="";for(j=0;j<c[0].length;){t=c[i][j++];s+=t<1?' ':t;}System.out.println(s);}};
the ungolfed version
static void makeDecorations(String s){
String[]e=s.split(" ");
char c[][]=new char[8][e.length*6],t,u,h='|';
int x=2,i=0,j,y;
for(String l:e){
y=0;
char[]p=l.toCharArray(), z=c[y];
int a=p[0],b=p[1],f=p[2],d=p[3],k=x-1,m=x+1;
t=a<49?'°':a<50?'¯':a<51?45:a<52?'^':39;
u=(char)(b<50?b+70:b<51?111:b<52?95:39);
if(d>50){z[x]=h;
if(f!=49){y=2;
c[1][x]=h;
c[2][x]=h;
}
z=c[y];
z[k]=46;
z[m]=46;
z=c[++y];
z[k]=58;
z[m]=58;
z[x]=34;
}
if(d==50){
z[x]=40;
z[m]=41;
c[++y][x]='´';
c[y][m]=96;
}
if(d==49){
z=c[++y];
z[k]=94;
z[x]=34;
z[m]=94;}
if(f>49){
y=6;
c[y][x]=44;
}
if(f>48){
y=f>49?7:3;
z=c[y++];
z[x]=u;
z[k]=t;
z[m]=t;
z[x-2]=40;
z[x+2]=41;
}
if(f==49){
z=c[y++];
z[x]=h;
z[k]=95;
z[m]=95;
z=c[y];
z[x]=h;
z[k]=91;
z[m]=93;
z[x-2]=47;
c[y++][x+2]=92;
c[y++][x]=h;
c[y][k]=47;
c[y][m]=92;
}
x+=6;
}
for(;i<8;i++){
s="";
for(j=0;j<c[0].length;){
t=c[i][j++];s+=t<1?32:t;
}
System.out.println(s);
}
}
Favorite decoration (which apparently looks more evil in my console): terminator skeleton
(-w-)
_|_
/[|]\
|
/ \
JavaScript (ES6), 319 315 bytes
let f =
s=>[0,1].map(i=>s.map(([A,B,C,D],x)=>+(z=i?D:C)&&[...'01/21/5015/41211/91/65'.split`/`[z-(i?C+D-13?1:-2:-2)]].map((n,y)=>a[(i?y:6-y)*4+x]=' '+(' ^"^ () ´` / \\ | .|. /[|]\\ _|_ ('+(e='°¯-^'[A])+'vwo_-'[B]+e+') , :": ').substr(p+=n*5,5),p=0)),a=Array(28).fill` `)&&a.join``.match(/.{24}/g).join`
`
console.log(f(["3123","0002","1021","0310"]));
Ruby 2.3.1, 777 752 bytes
Edit_0: I totally missed out on some golfable variable usage and some other stuff.
@o=Array.new;$*.each_with_index do|j,i|a,e,n,b,u,q,r,z,y=0,j[0].to_i,j[1].to_i,j[2].to_i,j[3].to_i,['°','¯','-','^',"'"],['v','w','o','_',"-"],Array.new(7," ")," ";g,h=[z,["(#{q[e]}#{r[n]}#{q[e]})"," _|_ ","/[|]\\"," | "," / \\ "],[" "," , ","(#{q[e]}#{r[n]}#{q[e]})"]],[z,[" "," ^\"^ "],[" () ", " ´` "],[" .|. "," :\": "]];2.times{h[3].unshift(" | ")}unless b==1;if b<1 && u<1;@o.push(z);elsif b<1;u<3 ? (a=5):(a=3);a.times{h[u].push(y)};@o.push(h[u]);elsif u<1;b==1 ? (a=2):(a=4);a.times{g[b].unshift(y)};@o.push(g[b]);elsif u>0;2.times{h[u].push(y)}if u<3&&b>1;@o.push(h[u]+g[b]);end;@o.push(z);end;@o.transpose.each do|v|;v.each do |w|;print w;end;print"\n";end
Takes in N number of variables of decorations. There's certainly some more golfing that can be done with this. I'm not that familiar with a lot of Ruby's tricks, but here's a shot at it! I'm also happy at being able to solve it.
Un-golfed
@output = Array.new
$*.each_with_index do |j, i|
# output decoration combo
s = 0
# set up vars for decoration input
e = j[0].to_i
n = j[1].to_i
b = j[2].to_i
u = j[3].to_i
# Setup decorations/misc
eyes = ['°','¯','-','^',"'"]
nose = ['v','w','o','_',"-"]
nothing = Array.new(7, " ")
skeleton = ["(#{eyes[e]}#{nose[n]}#{eyes[e]})", " _|_ ", "/[|]\\", " | ", " / \\ "]
pumpkin = [" ", " , ", "(#{eyes[e]}#{nose[n]}#{eyes[e]})"]
fbat = [" ", " ^\"^ "]
rbat = [" () ", " ´` "]
spider = [" | ", " .|. ", " :\": "]
spider.unshift(" | ") unless b == 1
a = " "
bot = [nothing, skeleton, pumpkin]
top = [nothing, fbat, rbat, spider]
# if bottom and upper are empty
if b < 1 && u < 1
@output.push(nothing)
# if bottom is empty
elsif b < 1
u < 2 ? (s = 3) : (s = 5)
s.times {top[u].push(a)}
@output.push(top[u])
# if upper is empty
elsif u < 1
# put in white space before the decorations
b == 1 ? (s = 2) : (s = 5)
s.times {bot[b].unshift(a)}
@output.push(bot[b])
# if there's an upper decoration
elsif u > 0
# put in the top deco
2.times {top[u].push(a)} if u < 3 && b > 1
@output.push(top[u] + bot[b])
end
# Input the empty column
@output.push(nothing)
end
# Transpose the array of arrays so that
# instead of outputting each line of a single each decoration
# what's output is each line of each decoration.
# Example:
# [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]]
# [[1, 1, 1, 1, 1], [2, 2, 2, 2, 2], [3, 3, 3, 3, 3], [4, 4, 4, 4, 4], [5, 5, 5, 5, 5]]
@output.transpose.each do |data|
data.each do |data1|
print data1
end
print "\n"
end
The following:
ruby deco_g.rb 0000 0001 0002 0003 1110 1111 1112 1113 2220 2221 2222 2223 3310 3312 3321 3323
Outputs this:
() | () .|. () | () |
^"^ ´` | ^"^ ´` :": ^"^ ´` | ´` ^"^ |
.|. (¯w¯) (¯w¯) (¯w¯) (¯w¯) .|. (^_^) (^_^) .|.
:": _|_ _|_ _|_ _|_ :": _|_ _|_ :":
/[|]\ /[|]\ /[|]\ /[|]\ /[|]\ /[|]\
| | | | , , , , | | , ,
/ \ / \ / \ / \ (-o-) (-o-) (-o-) (-o-) / \ / \ (^_^) (^_^)