রুবি ২.৩.১, 7 777 752 বাইট
সম্পাদনা_0: আমি কিছু গল্ফযোগ্য পরিবর্তনশীল ব্যবহার এবং কিছু অন্যান্য জিনিস পুরোপুরি মিস করেছি।
@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
এন সজ্জা এর ভেরিয়েবল সংখ্যা। এর সাথে আরও কিছু গল্ফিং অবশ্যই করা যেতে পারে। আমি রুবির অনেক কৌশল সম্পর্কে এতটা পরিচিত নই, তবে এটি এখানে শট! এটি সমাধান করতে পেরে আমিও খুশি।
আন 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
পরবর্তী:
ruby deco_g.rb 0000 0001 0002 0003 1110 1111 1112 1113 2220 2221 2222 2223 3310 3312 3321 3323
এটি ফলাফল:
() | () .|. () | () |
^"^ ´` | ^"^ ´` :": ^"^ ´` | ´` ^"^ |
.|. (¯w¯) (¯w¯) (¯w¯) (¯w¯) .|. (^_^) (^_^) .|.
:": _|_ _|_ _|_ _|_ :": _|_ _|_ :":
/[|]\ /[|]\ /[|]\ /[|]\ /[|]\ /[|]\
| | | | , , , , | | , ,
/ \ / \ / \ / \ (-o-) (-o-) (-o-) (-o-) / \ / \ (^_^) (^_^)
9999?