Falcon Heavy stages

43

Choose a set of four bytes without replacement (i.e. no byte repeated), and not necessarily in any particular order, from any one of the following four sets:

  1. The characters of any one single-byte encoding
  2. The Unicode characters in the range 00–FF
  3. The signed decimal integers in the range −128–127
  4. The unsigned decimal integers in the range 0–255

The four values you chose (please state which they are) will be the valid inputs. You must pair each value with one of the below ASCII artworks.

Given (by any means) one of your four valid inputs, respond (by any means, even list of strings) with the corresponding ASCII art. Extra white-space is allowed on all sides, as long as the image is in there in one contiguous 2D area.

First byte:

     /\
    /  \
   |    |
   |    |
   |    |
   |____|
    \__/
    |  |
    |  |
    |  |
    |  |
 /\ |  | /\
/  \|  |/  \
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
|  ||  ||  |
AAAAAAAAAAAA

Second byte:

  /\
 /  \
|    |
|    |
|    |
|____|
 \__/
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 AAAA

Third byte:

  /\
 /  \
|    |
|    |
|    |
|____|
 \__/
 |  |
 |  |
 |  |
 |__|
  /\

Fourth byte:

 db
_/\_
\__/
|  |
|  |
|  |
|__|
 /\

What's new about this ASCII art Kolmogorov complexity challenge?

  1. The ability to select valid inputs presents a new aspect to the challenge. The inputs are clearly too limited to encode the entire result, but can carry enough information to merit attention.

  2. The multiple possible outputs share a lot of structure, so reuse of code or sub-images is feasible both within each image and between images.

  3. There is enough duplication that even languages which are not well-geared towards challenges like this have a fair chance of being able to use clever code rather than just hard-coding strings extensively.

Adám

Posted 2018-02-06T23:47:50.070

Reputation: 37 779

2db sounds like an Aston Martin! AFAIK it's a Tesla Roadster. – Level River St – 2018-02-06T23:56:21.987

1@LevelRiverSt Bowie, not Brown! – Adám – 2018-02-06T23:59:56.407

Is leading / trailing whitespace allowed, particularly on the left? – Level River St – 2018-02-07T00:12:26.907

@LevelRiverSt Thanks. I forgot to write it, though I did think of it. – Adám – 2018-02-07T00:14:36.843

1Is this really [tag:animation]? – FantaC – 2018-02-18T05:01:44.150

Answers

41

JavaScript (ES6), 247 bytes

RegPack'ed. Expects 0...3 as input.

n=>[...'BigFu!#?%$Rocket'].reduce((s,c)=>(x=s.split(c)).join(x.pop()),`oF#$!
FRFRFRF|??|$i$t$t$t$t%# t #
!t!BBB
uuceeeeeee%c%|?|
o#, db
_#_
iggg
|?|%#g|o|e%t%t%tkgttgttcu,o#%!
RRR|??|%ieF R|oo|
$
oo%
 ?__#/\\!/o\\uAAAAFo g
ti\\?/Bkkk`).split`,`[n]

Try it online!

Arnauld

Posted 2018-02-06T23:47:50.070

Reputation: 111 334

16BigFu!#?%$Rocket? But this is just Falcon Heavy! – Adám – 2018-02-07T06:25:20.397

16@Adám That's right. But BFR.reduce() == FalconHeavy :p – Arnauld – 2018-02-07T12:48:20.003

This is genius. For a second I was like wait what, theres a javascript builtin for that?! Then I came to my senses... +1! – rodolphito – 2018-02-08T09:32:49.140

Impressive as ever. – Weijun Zhou – 2018-03-02T19:27:23.637

"FRFRFRF" = "Fu!#?%$RocketFu!#?%$RocketFu!#?%$RocketFu!#" right? I love this answer more than anything lol. – Magic Octopus Urn – 2018-06-25T23:41:33.907

13

Charcoal, 67 bytes

NθF⁼³θ«PAA↑↑¹⁸↗²‖MM⁴±χ»¿θ«↙²↓⁴M↗__¶\_¶»↓d/_¶ _\↓×⁴∨›²θ⁶¿‹¹θAA↑¶/_‖M

Try it online! Link is to verbose version of code. Takes input as a number 3-0. Explanation:

Nθ

Input the number.

F⁼³θ«PAA↑↑¹⁸↗²‖MM⁴±χ»

If it is 3, draw half the booster, then mirror it, then move to the tip of the rocket.

¿θ«↙²↓⁴M↗__¶\_¶»

If it is not 0, draw the left half of the front fuel tank.

↓d/_¶ _\

But if it is 3, draw left half of the nose cone.

↓×⁴∨›²θ⁶

Draw the left side of the rocket.

¿‹¹θAA↑¶/_‖M

Draw the appropriate base of the rocket and then mirror to finish.

Neil

Posted 2018-02-06T23:47:50.070

Reputation: 95 035

Did you create Charcoal just for this contest? – nielsbot – 2018-02-08T19:58:24.863

@nielsbot Charcoal is 7 months old (see commit log). – phyrfox – 2018-02-08T20:20:22.250

I was kidding. But I guess it raises the question: is it golfing if you create a language to solve the problem? Where's the boundary? – nielsbot – 2018-02-09T21:33:32.390

1

@nielsbot I think that counts as one of the standard loopholes.

– Neil – 2018-02-09T23:36:06.637

7

Clean, 292 278 273 271 262 261 bytes

-5 bytes thanks to Adám

import StdEnv,Text
e=[k,k,k,"|__|",m]
l=repeatn
o="\\__/"
n="/  \\"
m="/\\"
u="|    |"
s="AAAA"
k="|  |"
?z=[m,n,u,u,u,"|____|",o:z]

\i=[cjustify 12[c\\c<-:q]\\q<-[?[k,k,k,k,m+" "+k+" "+m,n+k+n,k+k+k:l 18(k+k+k)]++[s+s+s],?(l 24k++[s]),?e,["db","_/\\_",o:e]]!!i]

Try it online!

A lambda function, mapping the Int values 0..3 to the images in the order listed in the OP.

Οurous

Posted 2018-02-06T23:47:50.070

Reputation: 7 916

1287 – Adám – 2018-02-07T00:50:29.840

@Adám Thanks! I was able to apply that, but I only saw it after I'd shortened it further - still saves bytes though :) – Οurous – 2018-02-07T00:55:12.917

Uh, why are there two snippets? – Erik the Outgolfer – 2018-02-07T11:35:51.747

@EriktheOutgolfer the second one is the lambda. The first one is the code it depends on. I don't put them in the same snippet because I can't multiline an assignment into the snippet. – Οurous – 2018-02-07T19:13:56.593

5

Ruby, 234 212 205 bytes

->n{y=*"| "
h=%w{/ /\ }+["|  "]*3+%w{|__ \\_}+y*3
t=%w{|_ /}
[h+["| ","/\\ | ","/  \\| ",*["|  || "]*18,?A*6],h+y*21<<?A*2,h+t,%w{d _/ \\_}+y*3+t][n].map{|a|a.rjust(6," ")+a.reverse.tr("\\\\/d","/\\\\b")}}

Try it online!

Takes an integer 0-3. Builds an array of the left halves of each phase, indexes in, then pads and reflects each row. All padding is to the same width, so the latter phases have leading whitespace. Returns an array of strings.

-2 bytes: Declare y as an array right away instead of needing *[y] later.

-5 bytes: Replace x="\\" with t=%w{_| \\}.

-5 bytes: Less dereferencing, more array addition.

-1 bytes: h+y*21+[?A*2] -> h+y*21<<?A*2 in phase 1.

-3 bytes: The spec allows the omission of *$/ to join the result.

-4 bytes: ["b","\\_","_/"] -> %w{b \\_ _/} in phase 3.

-2 bytes: Use %w notation in the head array also.

-7 bytes: Use rjust instead of manual padding (this also means generating the left side and mirroring it, instead of starting with the right side)

Ungolfed:

->n{
  y=*"| "                                            # Same as y=[" |"]
  h=%w{/ /\ }+["|  "]*3+%w{|__ \\_}+y*3              # Head for phases 0-2
  t=%w{|_ /}                                         # Tail for phases 2,3
  [
    h+["| ","/\\ | ","/  \\| ",*["|  || "]*18,?A*6], # Phase 0
    h+y*21<<?A*2,                                    # Phase 1
    h+t,                                             # Phase 2
    %w{d _/ \\_}+y*3+t                               # Phase 3
  ][n].map{|a|                                       # Choose phase
    a.rjust(6," ") +                                 # Pad left to width 6
    a.reverse.tr("\\\\/d","/\\\\b")                  # Add mirror (right side)
  }
}

benj2240

Posted 2018-02-06T23:47:50.070

Reputation: 801

5

Python 2, 292 290 284 282 281 bytes

i,j,d,e,x,y=input()," "," /\\ ","/  \\","|  |","\__/"
f=i<1
l,m,n,p,q,s=3*f*j,j*(i<3),d*f,e*f,x*f,j*(i>0)
print"\n".join(([l+j+d,l+j+e]+[l+"|    |"]*3+[l+"|____|",l+j+y],[" db\n_/\_",y])[i>2]+([l+j+x]*4+[n+s+x+n,p+s+x+p]+[q+s+x+q]*18+[s+"A"*(4,12)[f]],[m+x]*3+[m+"|__|",m+d])[i>1])

Try it online!

Takes an integer 0 to 3 as input and uses list indexing (1 or 0) to build each output.

-2 for an unneeded pair of brackets.

-6 by removing a variable assignment that was only used once.

-2 for another single use variable.

-1 with a tip from @Rod

ElPedro

Posted 2018-02-06T23:47:50.070

Reputation: 5 301

1The n, p and q variables are unnecessary too (-2 bytes each). " db" and "_/\_" will be joined with "\n" later, you can turn both into " db\n_/\_" to save another byte. You can (probably) move the +y, from each element, out of the list (and remove the const too) something like (...)[i>2]+["\__/"] – Rod – 2018-02-07T13:55:50.213

@Rod Thanks for the \n tip. I missed that one. Not sure about n,p and q though. They are used twice each, one each side of the main rocket to define whether the boosters are needed or not. Simailarly y in one case needs newline before it and in the other case some other characters. Could probably benefit from a complete rewrite to be honest. Feel free to take any ideas from it and use them to post your own answer. – ElPedro – 2018-02-07T19:00:13.570

2

SOGL V0.12, 90 bytes

┐∙2╚;+ƨA+.1>?jj■|_ /√+}R
3<?'».1>⌡9R"    kΓC+SA}‘03ž}.‽'⁴R╬³2±6«ž}.3=?4R╬³"XƧ⁸│\׀2⁴‘4n10žP}╬³

Try it Here!

Inputs 0/1/2/3 correspondingly to the bytes 1/2/3/4

dzaima

Posted 2018-02-06T23:47:50.070

Reputation: 19 048

2

Ruby, 209 183 bytes

->n{z=[a=' /\\ ',b='/  \\']+['|    |']*3+%w{|____| \__/}+[c='|  |']*24+[?A*n]
n>4&&z[10..-n/6]=n>8?[c,a+c+a,b+c+b]+[c*3]*18:['|__|',a]
n==5&&z[0,6]=%w{db _/\_}
z.map{|i|i.center(12)}}

Try it online!

Required inputs as follows:

Centre core + upper stage + fairing: 4
As above + boosters : 12
Upper stage + fairing: 6
Upper stage without fairing 5

The idea is to take the centre core + upper stage + fairing as a default and modify it for the other outputs.

Commented

->n{
  #z = array of parts for centre core + upper stage + fairing, with n A's at the bottom
  z=[a=' /\\ ',b='/  \\']+['|    |']*3+%w{|____| \__/}+[c='|  |']*24+[?A*n]

  #if n not 4, z from element 10 to the last [10..-1] or last but one [10..-2] =
  n>4&&z[10..-n/6]=
    n>8?[c,a+c+a,b+c+b]+[c*3]*18:   #centre core + boosters#
    ['|__|',a]                      #upper stage engine
  n==5&&z[0,6]=%w{db _/\_}        #if n==5, replace first 6 elements with unfaired payload
  z.map{|i|i.center(12)}          #pad each element of array to 12 characters
}                                 #return array of strings (format allowed by question)

Level River St

Posted 2018-02-06T23:47:50.070

Reputation: 22 049

The first answer to make non-trivial use of the input! Very nice. – benj2240 – 2018-03-02T19:33:52.717

1

Red, 333 bytes

f: func[g][t:{    }b:{ /\ }c:{/  \}d:{   |}e:{|}j:{\__/}k:{|  |}a:{AAAA}h:[1[t b]1[t c]3[d t e]1[d{____}e]1[t j]]z:[3[t k]1[t{|__|}]1[t b]]r: func[w][foreach[i v]w[loop i[print rejoin v]]]switch g[1 do[r h r[4[t k]1[b k b]1[c k c]18[k k k]]r[1[a a a]]]2 do[r h r[24[t k]]r[1[t a]]]3 do[r h r z]4 do[r[1[t{ db}]1[t{_/\_}]1[t j]]r z]]]

Try it online!

Takes 1 - 4 as input

f: func [ g ] [
    t: {    }
    b: { /\ }
    c: {/  \}
    d: {   |}
    e: {|}
    j: {\__/}
    k: {|  |}
    a: {AAAA} 
    h: [1 [t b] 1 [t c] 3 [d t e] 1 [d {____} e ] 1 [t j]]
    z: [3 [t k] 1 [t {|__|}] 1 [t b]]
    r: func [ w ] [
        foreach [ i v ] w [
            loop i [print rejoin v]]]
    switch g [
        1 do [r h r [4 [t k] 1 [b k b] 1 [c k c] 18 [k k k]] r [1 [a a a]]]
        2 do [r h r [24 [t k]] r [1 [t a]]]
        3 do [r h r z]
        4 do [r [ 1 [t { db}] 1 [t {_/\_}] 1 [t j] ] r z]
    ]
]

Rebol, 258 bytes

I made an experiment with Rebol's compress function, compressing a string of all the 4 stages and printing the corresponding part of it after decompression:

f: func[n][o:[[1 374][374 196][570 74][644 37]]
b: decompress debase{eJzjUgAB/RguMKWgAGbUgDg1OFnxQABmKcTEx+uDGTVQOZwM/RgwA2QTyBYQG2wbiAHDw5vjiAS4IEEOCwGoWmQKGsaQAIYE4eAhqeMFSCICGZKSxBWvHxPPBVYKDzkoAVamHwMAjkWmoKkCAAA=}
repeat i o/(n)/2[prin b/(i + o/(n)/1)]]

 f 3
  /\
 /  \
|    |
|    |
|    |
|____|
 \__/
 |  |
 |  |
 |  |
 |__|
  /\

Galen Ivanov

Posted 2018-02-06T23:47:50.070

Reputation: 13 815

1

Jstx, 124 bytes

↕t▌ÇÇÉÇ~éÇÇÇÇÇÇÇÉΘçK↑ε♀▄ü╙Çz⌡"#ße┐é+\òEhZ█╣S♪[ƒuø>!f♪K▌;0♂9☺}ås══½☻eP▌◙&£óZß:&╝af$V≈-wº[√D(♪╘Pφó√ò▲¶>å⌡◘├^∟z◘αßj◙÷»|æ⌠┼øk&£b

Explanation

↕t▌ÇÇÉÇ~éÇÇÇÇÇÇÇÉΘçK↑ε♀▄ü╙Çz⌡"#ße┐é+\òEhZ█╣S♪[ƒuø>!f♪K▌;0♂9☺}ås══½☻eP▌◙&£óZß:&╝af$V≈-wº[√D(♪╘Pφó√ò▲¶>å⌡◘├^∟z◘αßj◙÷»|æ⌠┼ # Push literal      /\\n    /  \\n   |    |\n   |    |\n   |    |\n   |____|\n    \__/\n    |  |\n    |  |\n    |  |\n    |  |\n /\ |  | /\\n/  \|  |/  \\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\n|  ||  ||  |\nAAAAAAAAAAAA0\n  /\\n /  \\n|    |\n|    |\n|    |\n|____|\n \__/\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n |  |\n AAAA0\n  /\\n /  \\n|    |\n|    |\n|    |\n|____|\n \__/\n |  |\n |  |\n |  |\n |__|\n  /\0\n db\n_/\_\n\__/\n|  |\n|  |\n|  |\n|__|\n /\
ø                                                                                                                       # Push literal 0
k                                                                                                                       # Push a list of strings obtained by splitting the second stack value with the first stack value.
&                                                                                                                       # Swap the top two stack values.
£b                                                                                                                      # Push the value in the list of the second stack value at the index of the first stack value.

Try it online!

Quantum64

Posted 2018-02-06T23:47:50.070

Reputation: 371

0

C (clang), 421 408 bytes

r,d,i;f(t){char *s="    ",*e="\n",*l[]={" /\\ ","/  \\","|    |","|____|","\\__/","|  |","AAAA","|__|"," /\\ ","_/\\_","\n"," db","|  ||  ||  |"},*p[]={"VABU3C1DVE8FFF1G","VABU3C1DVE4F1RYAFAKBFBKZ9MM1YGGG","VABU3C1DVE3F1HI","VLJE3F1HI"},*a="",*b,*c=e,*q=p[t];for(r=1;d=*q++;r=(d/48&&57/d)?d-48:r,c=(d/89&&90/d)?e+90-d:c,a=(d/82&&86/d)?s+86-d:a)if(d/65&&77/d)for(b=l[d-65],i=0;i<r;i++)printf("%s%s%s",a,b,c);}

Try it online!

GPS

Posted 2018-02-06T23:47:50.070

Reputation: 341

383 bytes – ceilingcat – 2019-07-31T04:39:07.583