New answers tagged

0

C#, 159 bytes public class P{public static void Main(string[]a){var f="";foreach (char c in a[0]){f+=" |"+c+"|\n";}System.Console.Write(@" | /_\ "+f+@" |_| /___\ VvV");}} Try Online


0

Keg, 52 characters ?(\|'\| \ )\\\_\/ \ \| ^\ \|\_\|\ \/\_\_\_\\\ VvV Only tricky point is that Keg has no strings, the input is pushed to stack character by character. So the processing order is: read input (?) and turn it into middle section, append top section reversed, reverse them all (^), append bottom section. (Note that the interpreter (TIO ...


1

Python 3, 80 chars, 86 bytes x='( ͡° ͜ʖ ͡°)' n=3-1 print(x[:4]*(n-1)+x[:7]*(n!=0)+x+x[6:]*(n!=0)+x[8:]*(n-1)) Try it online! To put input, change the 3 to whatever input you want, leaving the -1 alone. If anyone knows a better way to do input that would reduce the char count let me know. Nothing fancy going on here, just string slicing and abuse of ...


3

C++ (gcc), 102 bytes #include <string> std::string f(int n){return n?"( ͡°"+(--n>1?f(n):" ͜ʖ"+(n?f(n)+"ʖ ":" "))+"͡°)":"";} Try it online! Shameless port of Arnauld's JavaScript solution.


3

Inform 7, 262 bytes To say x:say "[Unicode 865][Unicode 176]". To say y:say Unicode 860. To say z:say Unicode 662. To say p (N - number):say "( [x][p N minus 1][x])". To say p (N - 2):say "( [x] [y][z][p 1][z][x])". To say p (N - 1):say "( [x] [y][z] [x])". To say p (N - 0):say "". This takes advantage of Inform 7's function overloading: the most specific ...


1

Charcoal, 41 bytes NθP⭆θ✂ʖ ͡°)⊗‹¹ι←⭆θ✂ʖ͜ °͡ (∧‹¹ι³ Try it online! The deverbosifier tries to quote the second string for some reason, but it doesn't seem to be necessary, but here's the verbose version if you want it. Explanation: Nθ Input the number of faces. P⭆θ✂ʖ ͡°)⊗‹¹ι Print the left sides of the faces (on our right as we see them). These consist ...


1

Canvas, 46 bytes b*5USy{↖qYq⇵≡„a¹„┬Hc+ ⁷m;⁷±m±└++ H?34⁸]]⁷]57⁸} Try it here!


5

Excel, 85 bytes =IF(A1>1,REPT("( ͡°",A1-1)&" ʖ( ͡° ͜ʖ ͡°)ʖ "&REPT("͡°)",A1-1),REPT("( ͡° ͜ʖ ͡°)",A1)) Naive solution for n>1. Second repeat required to handle 0 testcase.


1

Python 2, 54 bytes f=lambda i=5:L*0**i or L[:-i]+f(i-1)+L[i:] L='(<>.<>)' Try it online! Slight improvement on the leading Python 2 answer Port of my Lenny's answer


6

Python 3, 75 bytes f=lambda i:L[:7+~2%~i]+f(i-1)+L[6+2%i:]if i>1else L*i L='( ͡° ͜ʖ ͡°)' Try it online! -6 bytes thanks to xnor


3

Stax, 42 bytes ü/┐▐Φd¬•U►^τ∩█┴êZ3↔uº'µ3ó(▀◄Ü▒iÇÆ'[∞_¥▄>A√ Run and debug it I think it appears not to work in Firefox in Windows. But that's just because the FF default font for monospace is Courier, which seems not to support these fancy unicode modifiers or whatever. I think.


2

Japt, 47 bytes (UTF-8) ?"( ͡°{´U>1?ß:" ͜ʖ"+(U?'ʖiß:S} ͡°)":P Saved a byte thanks to Shaggy Try it


2

Haskell, 55 45 bytes map take[2..7]++map drop[1..5]>>=($"(<>.<>)") Try it online! First Haskell answer to beat the hardcoded solution! Explanation The way this answer works is by building a list of functions to be applied to the string (<>.<>). First we build the left and center with map take[2..7] which gives us all the ...


3

Perl 5 -p, 96 bytes $\='( ͡° ͜ʖ ͡°)'if$_--;$\="( ͡° ͜ʖ$\ʖ ͡°)"if$_-->0;$\="( ͡°$\ ͡°)"while$_-->0}{ Try it online!


13

Haskell, 89 87 80 bytes 7 bytes off thanks to xnor (!!)$"":x:iterate(4#8)(7#6$x) x="( ͡° ͜ʖ ͡°)" (a#b)y=take a x++y++drop b x Try it online! To start we assign ( ͡° ͜ʖ ͡°) to a string x for convenience. x="( ͡° ͜ʖ ͡°)" Then we build a list of the answers and index it to find the solution. This is done by hardcoding the first two answers as the first ...


5

Retina 0.8.2, 56 bytes .+ $*< $&$*> >> >ʖ > <(?=<? ) < ͜ʖ < ( ͡° > ͡°) Try it online! Explanation: .+ $*< $&$*> Generate the cheeks, but use <s and >s because (s and )s would need to be quoted. A space in the middle ends up between the middle man's nose and left eye. >> >ʖ > If the ...


2

Julia 1.0, 85 bytes f(n,s="( ͡° ͜ʖ ͡°)")=n<3 ? ["",s,s[1:10]s*s[10:17]][n+1] : s[1:5]f(n-1)s[12:17] Try it online!


7

JavaScript (ES6), 66 bytes f=n=>n?"( ͡°"+(--n>1?f(n):" ͜ʖ"+(n?f(n)+"ʖ ":" "))+"͡°)":"" Try it online! Or try it with the following snippet for a better rendering. f=n=>n?"( ͡°"+(--n>1?f(n):" ͜ʖ"+(n?f(n)+"ʖ ":" "))+"͡°)":"" for(n = 0; n <= 10; n++) { o.innerHTML += '"' + f(n) + '"\n'; } pre { font-family:Arial } <pre id="o">&...


0

Python 3, 189 172 168 173 169 bytes def f(d):t=d.items();a,b=map(lambda*l:max(map(len,l)),*t);c='─'*a,'─'*b;print("┌%s┬%s┐"%c,*[f"│{k:{a}}│{v:{b}}│"for k,v in t],"└%s┴%s┘"%c,sep="\n") Try it online!


1

PHP, 563 bytes <?php $t = ["a"=>"b","c"=>"d"]; $k = $v = $i = $j = 0; foreach ($t as $a => $b){ $k = (strlen($a) > $k ? strlen($a) : $k); $v = (strlen($b) > $v ? strlen($b) : $v); } echo "┏"; for(; $i++ < $k + $v + 3;) echo "━"; echo "┓\n"; foreach ($t as $a => $b){ echo "|{$a} "; ...


0

Charcoal, 62 bytes F²⊞υ×━⌈EθL§κι⟦⪫┏┓⪫υ┳⟧Eθ⪫┃┃⪫Eι◨λL§υμ┃⪫┗┛⪫υ┻ Try it online! Link is to verbose version of code. Charcoal's code page doesn't include box-drawing characters so they cost 3 bytes but the code uses them instead of their three-byte encoding because it looks nicer. Takes input as an array of tuples as Charcoal doesn't have an iterable ...


3

J, 1 byte > So… to take strings as input they need to be in boxes already, and to make them pairs I think they need to be put into a box again so that they can be treated separately. I'm not too sure about the second part. Anyway, unboxing the whole thing gives the desired form. I get a sense that this could be a 0 byte answer if we twist the format ...


8

TryAPL, 1 byteSBCS Anonymous tacit prefix function. As TryAPL has no associative arrays, this takes a list of pairs as argument. ↑ Try APL! ↑ mix the list of pairs into a table


1

Brainfuck, 369 bytes +[[->>>+<<<]>+++++++>+++>+]-<-<<<--<-<<<-<<--<<<-<<+<+<<<<---<<++<---<<<<<+<---<+<++<<<+<[->++<]<<<<<++<-----<<[[-]<]+<-<[++<<+<]>[>>>]<<<...


0

Python 3, 86 bytes code-golf: n=input();print(' |\n / \ ') for l in n:print(' |'+l+'|') print(' |_|\n/___\ \n VvV') normal: n = input() print(' |') print(' / \') for l in n: print(' |' + l + '|') print(' |_|') print('/___\') print(' VvV') ```


3

Charcoal, 78 bytes NθNη”{⊞⊟¦≦⁶q×fΣ\⊙t×_⊟✳-Y⁴℅=⁶υ”≔›θ³ζ≔›η³εFζ≦⁻⁷θFε≦⁻⁷ηJ⊕÷θ²⊕÷粧#$⁺ⅈⅉJθη Fζ‖Fε‖↓ Try it online! Link is to verbose version of code. Outputs using #$% characters. Explanation: NθNη Input the co-ordinates of the blank square. ”{⊞⊟¦≦⁶q×fΣ\⊙t×_⊟✳-Y⁴℅=⁶υ” Output a compressed string. It contains newlines so to avoid breaking up the flow of ...


0

Julia 1.0, 42 40 bytes y(a,b)=strip(b[findfirst("/o\\",a)])>"-" Try it online!


1

Python 3.7, 71 56 Bytes lambda s:sum(j in'/o\\'and p=='-'for j,p in zip(*s))>1 Very simple version and the shortest I could think of using this approach. Input s is a list of two strings, the first one for the Jimmy-row, the second one for the platform. Zip the characters which are above one another and then check whether - is below a part of Jimmy in ...


21

JavaScript (ES6),  184 ... 171  163 bytes Takes input as (x)(y), with \$0\leq x\leq7\$ and \$0\leq y\leq7\$. Outputs as a string with 3 colors (marked as \$0\$, \$1\$ and \$2\$). h=>v=>(a=[...'3232132031021010'],a[5+(v&4|h>3)]^=3,a[v/2<<2|h/2]=v%2*2+h%2,g=x=>y&8?'':(x<8?x-h|y-v?a[y/2<<2|x/2]^y%2*2+x%2?(x^y)&...


0

Julia, 177 bytes println.(prod(get.(" ",reshape([fill.((1:38).%2,[11,1,20,4,10,1,8,4,12,4,3,6,12,4,2,9,9,5,1,99,1,24,2,5,7,11,4,4,7,3,4,3,7,2,7,1,6,2])...;],25,:),'*')[[1:25;24:-1:1],:],dims=1)) Stores only the left half encoded as the numbers of chars until the char changes. Could probably be improved upon with a better encoding. Try it online!


2

Python, 129 113 112 bytes f=lambda n:n>50and f(50)+"\n\n"+f(n-50)or"\n".join(("|||/|||"[k:k+4]+" ")*(n//5)+" "+"|"*(n%5)for k in range(4)) Explanation def p(n): if n > 50: return p(50) + "\n\n" + p(n-50) # Handle 50-groups recursively else: # For each of the 4 lines: rows = [] for row in range(4): # - Build the "|||/"-...


0

Python 3, 234 224 bytes -10 bytes thanks to @Blue for i in range(637):print(' *'[0x301038101800F01C3E1C0781F01FFFFF01F1FFFFFFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFFFFFFFFFFFC7FC01FF007FC1F8007F000FC03C003F800780078010400F00002000000800>>i&1],end=['\n',''][(i+1)%49>0]) Try it online! I made this version before searching through all the ...


0

Perl 5 -MList::Util=pairmap, 313 bytes pairmap{$_=$b;s/\|{3}/|-|/g;y/-/_/c;y/-/ /;s/./ /;chop;say;$_=$b;for$r($a=~/./g){s/\| /|$r/}say;y/|/_/c;say;s,\|_,/_,g;s/_\|/_\\/g;say}"`1234567890-=",($;="|| |")x13 ."||BS ||","QWERTYUIOP[]\\",'||TAB |'.$;x13 .'|',"ASDFGHJKL;'","||CAPS |".$;x11 ."||ENTER ||","ZXCVBNM,./",($s='||SHIFT |').$;x10 ."$s|" Try ...


0

Stax, 43 bytes ¬H∙☼ßú¶ε╥M9rx⌠ªÅ`Fm■♦▓dL∩BF╚3♣æ7~εåIZ▼•sÿ4ú Run and debug it It's just the left-half, run-length encoded and then mirrored.


0

Stax, 24 bytes ⌐å9☼,▄█┌`╕G╛ï╞▬Gpƒ\╜ª_N╬ Run and debug it


2

V, 20 bytes ÑñÀ/vüÞ sv^l?Ö" xH Try it online! Uses some new features, such as Ñ which is incredibly useful.


0

05AB1E, 28 bytes 5‰"|||/"¬‚×J4ôTôεε3Ý._}ø»¶«, Try it online. Explanation: 5‰ # Divmod the (implicit) input-integer by 5 # i.e. 111 → [22,1] "|||/" # Push string "|||/" ¬ # Push its first character (without popping the string itself): "|" ‚ # Pair them together: ["|||/","|"] × ...


0

C (gcc), 107 106 bytes i,j;f(n){for(;n>50;f(50))n-=50;for(i=5;--i;)for(j=0;putchar(++j+~n?j%5?(j-i)%5|n-j<n%5?'|':47:32:10)%5;);} Try it online! -1 thanks to ceilingcat


0

Canvas, 30 bytes H╷‾#%╵¹‾#÷U╷5×¹5%?4|*];4-;4/}╋ Try it here!


0

GolfScript, 53 bytes " |\n /_\\"n@0$1/\;{" |"\"|\n"}/" |_|\n/___\\\n VvV" Try it online! " |\n /_\\"n ascii art @ rotate so input is on top 0$1/ split input into elements of size 1 \; swap top elements, pop top (input) {" |"\"|\n"}/ now the top element is the input array so for each we ...


0

33, 75 69 bytes -6 bytes because I remembered \n is a thing. " |\n /_\\"pi1bzst' | |'j[2ktNpNitclz1aztstcjz]" |_|\n/___\\\n VvV"p Try it online hopefully coming soon Explanation: " |\n /_\\"pi | Print the first part of the rocket -----------------------------------| 1bzs | Get the first command-line ...


0

Wolfram Language (Mathematica), 293 bytes c=##&@@(#|2&/@Characters@#)& r=StringRiffle p=StringPadRight Print/@{j=p["",#2,"_"]&@@@#;(" __"<>#&/@j)<>" ",r[p@@@#,i={l="||","|||",l}],j~r~i,j~r~{"|/","\|/","\|"}}&/@{{c@"`1234567890-=","BS"|6},{"TAB"|6,c@"QWERTYUIOP[]\\"},{"CAPS"|7,c@"ASDFGHJKL;'","ENTER"|6},{h="SHIFT"|9,c@"...


0

perl6 - 69 say " |\n /-\\\n |{@*ARGS.comb.join("|\n |")}|\n |_|\n/___\\\n VvV"


1

Pip, 71 69 64 61 bytes f:"|"u:C95Ps.s.fP" /_\"Fi,#a{Ps.f.a@i.f}P" |_|"P"/___\"" VvV" Try it online! [Try it online!][TIO-jyx4p3hj] f:"|" u:C95 a:q Ps.s.f P" /_\" F i ,#a{ Ps.f.a@i.f make the fuselage } P" |_|" P"/___\" " VvV" nothing fancy happening here.


4

Charcoal, 105 bytes W¬ΦυΣκ⊞υS≔⊟υη≔⪫υ⸿θ≔⟦⟧υ≔>^<vζPθFθ¿№ζι«⊞υ⟦⌕ζιⅉⅈ⟧§+|-↨EKV›κ ²»ιFυ«J⊟ι⊟ι≔⊟ιιFIη«≔⊟Φ⁴∧﹪⁻⊖ι⊕λ⁴›§KV⁻⁵λ ιM✳⊗黧ζι Try it online! Link is to verbose version of code. Includes 22 bytes used to avoid requiring a cumbersome input format. Explanation: W¬ΦυΣκ⊞υS≔⊟υη≔⪫υ⸿θ≔⟦⟧υ Conveniently input the contours and the number of steps. ≔>^<...


2

APL (Dyalog Unicode), 111 bytesSBCS {A[D⍳q-p]@q⊢' |+-'[c×3+/0,c,0]⊣q←⊃¨(⍸c←' '≠⍵)∘∩¨↓⍉D[4|0 1 3∘.+4~⍨,t]+⍤1⊢p←⍸4>t←⍵⍳⍨A←'v>^<'⊣D←9 11∘○¨0j1*⍳4}⍣⎕⊢⎕ Try it online! similar to my k answer


1

Oracle SQL, 77 bytes select' | /_\ '||regexp_replace(x,'(.)',' |\1| ')||' |_| /___\ VvV'from t; It works with an assumption that input string is stored in a table t(x), e.g. with t(x) as (select 'Earth' from dual) Test in SQL*Plus SQL> set pages 0 SQL> with t(x) as (select 'Earth' from dual) 2 select' | 3 /_\ 4 '||regexp_replace(x,'(....


14

JavaScript (ES6),  210 ... 182  180 bytes Takes input as (m)(n), where \$m\$ is a list of lists of characters. Returns the result in the same format. m=>g=n=>n?g(n-1,m=m.map((r,y)=>r.map((c,x)=>(i=0,h=$=>~$?(m[Y=y+($-2)%2]||0)[X=x+~-$%2]>h?"-|+"[n+=`;m[${Y}][${X}]=S[${$}]`,i?2:$&1]:h($^++i):c)((S="<^>v").indexOf(c)))),...


8

K (ngn/k), 183 161 157 bytes {A:"^>v<";D,:-D:(-1 0;!2);s:(#x;#*x);c:~^x;r:" -+|"c*+/'3'0,c,0;$[#p:+s\&~^t:A?,/x;;:r];q:q@'*'&'~^x ./:/:q:+p+/:D@4!(t^0N)+/:0 1 3;s#@[,/r;s/+q;:;A@D?q-p]}/ Try it online! { }/ when called with an int left arg n, this will apply the function in { } n times to the right arg A:"^>v<" arrows D,:-D:(-1 0;!2) ...


0

Bash, 49 bytes [[ "${1:$((`expr index "$0" /`-1)):3}" =~ "--" ]] Jimmy input as command line parameter 0, the platform as parameter 1; Must be aware of Bash's separating and eating whitespace (use single quotes): bash -c '[[ "${1:$((`expr index "$0" /`-1)):3}" =~ "--" ]]' ' /o\' ' -------'


Top 50 recent answers are included