Desenhe o ícone de benzeno hegaxon do HyperNeutrino no ASCII

31

Em comemoração ao HyperNeutrino, recuperando sua conta e representante, seguindo o Sr. Xcoder .

O talento de HyperNeutrino

Desculpas por girar a imagem quanto à capacidade de desenhar.


Imprima ou produza exatamente essa arte ASCII. Você pode ter espaços à direita e / ou uma nova linha à direita.

      _______________
     /               \
    /  /           \  \
   /  /             \  \
  /  /               \  \
 /  /                 \  \
/  /                   \  \
\                         /
 \                       /
  \                     /
   \                   /
    \  _____________  /
     \_______________/

Isso representa uma das duas estruturas de ressonância da molécula benzeno insira a descrição da imagem aqui

Related: Hexágonos concêntricos , hexágonos preenchidos com asterisco

Entre os melhores:

xnor
fonte
8
Vejo que @HyperNeutrino girou seu ícone para corresponder a essa pergunta!
Neil
5
@ Neil Sim: P Isso me incomodou tanto que eu apenas mudei para torná-lo consistente. Agora você precisa atualizar as estruturas de ressonância, xnor: P
HyperNeutrino
1
Darn, o talento não irá atualizar embora eu adicionei os parâmetros não utilizados aleatórios até o fim, mudou para StackOverflow, mudou-lo de volta, e editado outro como 10 vezes: I
HyperNeutrino
4
Mas a versão horizontal parece feia quando renderizada no meu perfil na minha opinião; Pode ser que eu não esteja acostumado. Então, eu mudei de volta. : P
HyperNeutrino 23/06
:( Eu queria ver!
CalculatorFeline

Respostas:

24

Carvão , 23 bytes

×_⁷↙←×_⁸↖⁶→↗⁶P×_⁸↘↓↙⁵‖B

Experimente online! Explicação: Imprime as linhas na seguinte ordem e reflete tudo horizontalmente:

      5_______
     /        
    /  6      
   /  ↙       
  /  /        
 ↗  /         
4  /          
\             
 \            
  \           
   \          
    ↖  1→_____
     3______←2
Neil
fonte
5
‖Bsignifica "Reflect Butterfly"
CalculadoraFeline
8

JavaScript (ES6),  144  143 140 138 134 bytes

Uma função recursiva que desenha o caractere de saída por caractere com uma expressão puramente condicional.

f=(p=363)=>(m=p%28-14,x=m<0?-m:m,y=p/28|0,p--)?`\\/ _
`[m+14?x<8-y&y<2|x<8&y>11?3:x==y+8|x==19-y|x==16-y&y>5&x>5?m<0^y>5:2:4]+f(p):''

Quão?

Para cada posição 0 <p ≤ 363 , definimos:

  • m = (p MOD 28) - 14
  • x = | m
  • y = ⌊ p / 28 ⌋

Abaixo está um detalhamento da fórmula que seleciona o caractere apropriado [ '\', '/', ' ', '_', '\n' ].

m + 14 ?                            // if this is not an end of line:
  x < 8 - y & y < 2 |               //   if this is either part D
  x < 8 & y > 11 ?                  //   or part E:
    3                               //     output '_'
  :                                 //   else:
    x == y + 8 |                    //     if this is either part A
    x == 19 - y |                   //     or part B
    x == 16 - y & y > 5 & x > 5 ?   //     or part C:
      m < 0 ^ y > 5                 //       output '/' or '\' depending on the quadrant
    :                               //     else:
      2                             //       output a space
:                                   // else:
  4                                 //   output a Line-Feed

E abaixo estão as diferentes partes no sistema de coordenadas definidas acima:

   | 13 12 11 10 09 08 07 06 05 04 03 02 01 00 01 02 03 04 05 06 07 08 09 10 11 12 13
---+---------------------------------------------------------------------------------
12 | .  .  .  .  .  .  E  E  E  E  E  E  E  E  E  E  E  E  E  E  E  .  .  .  .  .  .
11 | .  .  .  .  .  B  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  B  .  .  .  .  .
10 | .  .  .  .  B  .  .  C  .  .  .  .  .  .  .  .  .  .  .  C  .  .  B  .  .  .  .
09 | .  .  .  B  .  .  C  .  .  .  .  .  .  .  .  .  .  .  .  .  C  .  .  B  .  .  .
08 | .  .  B  .  .  C  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  C  .  .  B  .  .
07 | .  B  .  .  C  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  C  .  .  B  .
06 | B  .  .  C  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  C  .  .  B
05 | A  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  A
04 | .  A  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  A  .
03 | .  .  A  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  A  .  .
02 | .  .  .  A  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  A  .  .  .
01 | .  .  .  .  A  .  .  D  D  D  D  D  D  D  D  D  D  D  D  D  .  .  A  .  .  .  .
00 | .  .  .  .  .  A  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  A  .  .  .  .  .

Demo

Arnauld
fonte
7

05AB1E , 50 bytes

•ι¡≠ït]4uƵŽΣ”9g½ùöèri|)á,ćè’∍é•5B3ÝJ"/ _\"‡4¡.B».∞

Experimente online!


A compactação:

A estratégia aqui era construir metade do objeto e espelhar a imagem na metade do caminho. Para fazer isso, construí a metade esquerda primeiro, com preenchimento frontal:

11111122222222
111110
11110110
1110110
110110
10110
0110
3
13
113
1113
1111311222222
11111322222222

Mas sem preenchimento correto, isso ocorre porque a .Bfunção em 05AB1E pode ser usada para tornar cada elemento igual em comprimento usando espaços. Isso permite que eu omita os espaços estranhos à direita e apenas delimite por novas linhas. Então, peguei esse padrão e removi todas as novas linhas, substituindo-as por, 4para obter:

1111112222222241111104111101104111011041101104101104011043413411341113411113112222222411111322222222

A compactação com base-255 resulta em:

•ι¡≠ït]4uƵŽΣ”9g½ùöèri|)á,ćè’∍é•5B

Onde os dois estão denotando uma sequência compactada de base 255 e 5B a estão convertendo em base-5.


A segunda parte, após a compactação:

3ÝJ                # Push '0123'.
   "/ _\"          # Push '/ _\'.
         ‡         # Replace each in b with a on c.
          4¡       # Split on 4's (the newlines I replaced).
            .B     # Boxify for the mirror (adds padding to longest element).
              »    # Join by newlines. 
               .∞  # Mirror image.
Urna de polvo mágico
fonte
Você pode economizar 3 bytes como este
Emigna
@emigna è, é claro!
Magic Octopus Urn
5

V , 61 bytes

i/  /±¹ \  \
\²µ /6ñGÙlxxhPHÄãxx>ñv$r_jwr w.Gkkl13r_jviwr_jd

Experimente online!

Hexdump:

00000000: 692f 2020 2fb1 b920 5c20 205c 0a5c b2b5  i/  /.. \  \.\..
00000010: 202f 1b36 f147 d96c 7878 6850 48c4 e378   /.6.G.lxxhPH..x
00000020: 783e f176 2472 5f6a 7772 2077 2e47 6b6b  x>.v$r_jwr w.Gkk
00000030: 6c31 3372 5f6a 7669 7772 5f6a 64         l13r_jviwr_jd
DJMcMayhem
fonte
5

Python 2 , 226 213 bytes 179 bytes

Meu primeiro golfe!

b,f,s,u='\/ _'
print'\n'.join([s*6+u*15,s*5+f+s*15+b]+[s*(4-n)+'/ /'+s*(13+2*n)+'\ \\'for n in range(5)]+[s*n+b+s*(25-2*n)+f for n in 0,1,2,3]+[s*4+b+s*2+u*13+s*2+f,s*5+b+u*15+f])

Experimente online!

Tentei fazer um loop dos bits nos quais encontrei um padrão e codifiquei o resto. Definir os diferentes caracteres para uma variável ajudou a economizar bastante bytes.

Editar: decidiu anexar à mesma matriz em vez de ingressar várias vezes. 13 bytes salvos.

Edição 2: Graças a @ValueInk, @jacoblaw, @WheatWizard, @CalculatorFeline e @ Challenger5, salvaram 34 bytes

emtree
fonte
1
b,f,s,u='\/ _';o,a='/ /','\ \\'economiza 11 bytes sobre sua inicialização de variável atual! Veja aqui
Value Ink
1
usando @ ponta do ValueInk e não fazer uma lista mais de 4 linhas, você tem 195 bytes como esta
jacoblaw
1
@jacoblaw Você não precisa de todos os espaços. Aqui está sem eles.
Assistente de trigo
1
oe asão usados ​​apenas uma vez no código. Aqui está com eles inline.
CalculatorFeline
1
You can use 0,1,2,3 instead of range(4) to save a byte.
Esolanging Fruit
4

J, 155 bytes

('_ /\',LF){~5#.inv 95x#.32-~3 u:'0_C5NcBe''e2kA/jhk>5y~l<Z:AN<QG)V7m>l"x!@A-jp8E%XEh&"$''j(sP8Z!b#e7})]_,L"LCUu)kqsBQ5_5bt}`bq ":1cv(gU;|{I~n5q@(ISCK `'[<

Try it online!

This is a function that expects no input. E.g., f =: <code> then f ''.

Explanation

I encoded this using the following steps. Assume that the desired compression string is contained in the variable h.

   k=:'_ /\',LF                    NB. the dictionary used to encode the string
   k i. h                          NB. numbers corresponding to indices in `k`
1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 4 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 3 1 1 3 4 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 3 4 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 3 4 1 2 1 1 2 1 1 1 ...
   5x#.k i. h                      NB. base 5 to decimal
4571656960356964266407389291886526966074643634545109498506871241033015964671946641835339522170115810676380078148856766959449166714046433431522704650346045752930168245684048485736756807881102718244115576453623363843561553955078139
   95#.inv 5x#.k i. h              NB. decimal to base 95
16 63 35 21 46 67 34 69 7 69 18 75 33 15 74 72 75 30 21 89 94 76 28 58 26 33 46 28 49 39 9 54 23 77 30 76 2 88 1 32 33 13 74 80 24 37 5 56 37 72 6 2 4 7 74 8 83 48 24 58 1 66 3 69 23 93 9 61 63 12 44 2 44 35 53 85 9 75 81 83 34 49 21 63 21 66 84 93 64 66 8...
   quote u:32+95#.inv 5x#.k i. h   NB. base 95 to ASCII repr of string
'0_C5NcBe''e2kA/jhk>5y~ll"x!@A-jp8E%XEh&"$''j(sP8Z!b#e7})]_,L"LCUu)kqsBQ5_5bt}`bq ":1cv(gU;|{I~n5q@(ISCK `'

Then, we just need to decode this. 5#.inv 95x#.32-~3 u: performs the inverse of what I just described, giving us the list of indices. Then, ('_ /\',LF){~ applies the appropriate characters to each index.

Conor O'Brien
fonte
4

Mathematica, 227 bytes

t=Table;T[x_,y_,z_,v_]:=""<>{x,y~t~v,z};Column[Join[b={""<>"_"~t~15},{T["/"," ","\\",15]},t[T["/  /"," ","\\  \\",i],{i,11,19,2}],t[T["\\"," ","/",i],{i,25,19,-2}],{T["\\  ","_","  /",13]},{""<>{"\\",b,"/"}}],Alignment->Center]
J42161217
fonte
4

Charcoal, 47 43 41 bytes

↗⁶F¹⁵_↓↘⁶←↙⁶↷⁴↑F¹⁵_↖⁶M⁴→↗⁵M¹¹→↓↘⁵M⁵↙↑F¹³_

Try it online!

I did not know a thing about Charcoal until right now, I felt like "I have no idea of what I'm doing" while trying to figure out this answer... I'm quite sure this can be golfed a lot.

Updates:

  • I managed to save 4 bytes learning to use cursor directions and movements!
  • 2 more bytes saved after realizing the drawing was not exactly as asked. ^__^U
Charlie
fonte
2
Lmao, trust me, you're not the only one to be in the latter state when using charcoal. The first time I used it was trying to make a cube. I used the "square" built-in then manually drew the back of the cuboid, turns out you can do it in 20 bytes compared to my 57.
Magic Octopus Urn
@carusocomputing I cannot believe that O5AB1E or Jelly still have longer answers... :-D
Charlie
2
Charcoal is an extremely competitive ASCII-oriented language, the optimized answer is likely around 40 bytes which may even obliterate bubblegum.
Magic Octopus Urn
5
@carusocomputing cough did you say 40?
Neil
@Neil I did try to use ‖B but I could not figure out how... nice answer!
Charlie
4

Ruby, 117 bytes

13.times{|i|s=[?_*(15--i%12*1.3),"/%#{i*2+8}s"%?\\,''][(i%12%11+3)/5].center(27)
i>0&&(s[i-=7]=?\\)&&s[~i]=?/
puts s}
Level River St
fonte
4

Retina, 129 114 102 bytes

Thanks to ovs for -12 bytes!


6eea¶5/15\¶4c1b3c3b2c5b1c7bc9b\25d1\23d2\21d3\19d4\2ee_2d5\eea/
e
aa
d
/¶
c
/2/1
b
\2\¶
a
___
\d+
$* 

Try it online!

CalculatorFeline
fonte
101 bytes
CalculatorFeline
3

05AB1E, 92 86 80 bytes

'_15×6ú'/5úð8׫.∞5F'/4N-ú'/2ú«ð6N+׫.∞}4F'\Núð13N-׫.∞}'\4ú'_7×2ú«.∞'\5ú'_8׫.∞»

Try it online!


Explanation in parts

The bar at the top

'_      # underscore
  15×   # repeated 15 times
     6ú # with 6 spaces in front

The line immediately below the bar

'/         # forward slash
  5ú       # with 5 spaces in front
    ð      # space
     8×    # repeated 8 times
       «   # concatenated with the earlier string
        .∞ # intersected mirror (i.e middle space not affected)
           # mirroring: "  /  " => "  /    \  "

The remainder of the upper portion of the hexagon

5F                     # for N in 0..4
  '/                   # forward slash
    4N-                # 4 - N
       ú               # spaces in front of the slash
        '/             # another forward slash
          2ú           # with 2 spaces in front
            «          # concatenated with the other string
             ð         # a space character
              6N+      # N + 6
                 ×     # times
                  «    # concatenated with the other string
                   .∞  # intersected mirror
                     } # end for

The remainder except for the last 2 lines

4F               # for N in 0 .. 3
  '\             # backslash
    Nú           # with N spaces in front 
      ð          # a space
       13N-      # 13 - N
           ×     # repeated
            «    # concatenated with other string
             .∞  # intersected mirror
               } # end for

The second to last line

'\ # backslash
  4ú # with 4 spaces in front
    '_ # underscore
      7× # repeated 7 times
        2ú # with 2 spaces in front
          « # concatenated with earlier string
           .∞ # intersected mirror

The last line

'\ # backslash
  5ú # with 5 spaces in front
    '_ # underscore
      8× # repeated 8 times
        « # concatenated with other string
         .∞ # intersected mirror

The » at the end joins everything on newlines.

Neil A.
fonte
@carusocomputing: hmm, I didn't think of "mirroring" it.
Neil A.
Mirror is like palindromize, except with palindromize {_ becomes {_{, where with mirror it becomes {_}. Palendromize is û, while mirror is . There is also an intersected mirror, which is .∞.
Magic Octopus Urn
@downvoter stoppit. He said he's still golfing it.
Magic Octopus Urn
3

C#, 210 199 bytes

Encodes the length of space runs and underscore runs:

var h=@"5KL4/>\L3/1/:\1\L2/1/<\1\L1/1/>\1\L0/1/@\1\L/1/B\1\L\H/L0\F/L1\D/L2\B/L3\1I1/L4\K/L";for(var i='M';--i>'/';)h=h.Replace(""+i,i>75?"\n":"".PadLeft(i>72?i-60:i-47," _"[i/73]));Console.Write(h);

Ungolfed:

var h = @"5KL4/>\L3/1/:\1\L2/1/<\1\L1/1/>\1\L0/1/@\1\L/1/B\1\L\H/L0\F/L1\D/L2\B/L3\1I1/L4\K/L";
for (var i = 'M'; --i > '/'; )
    h = h.Replace("" + i, i > 75 ? "\n" : "".PadLeft(i > 72 ? i - 60 : i - 47, " _"[i / 73]));
Console.Write(h);

Try It Online!

Geoffrey
fonte
2

Retina, 129 bytes


5$* ¶    
\G (?=( *))
¶$1/  /$`11$* $`\  \
r`(?<=( *)) \G
$1\$'19$* $'/¶
^
6$* 15$*_¶5$* /15$* \
¶$
¶    \  13$*_  /¶5$* \15$*_/

Try it online! Completely different approach, yet coincidentally the same length!

Neil
fonte
1

///, 152 bytes

/,/  //'/\\!!!//&/\\"\\
//%/\/"\/!!//#/_____//"/,\\//!/,, /! ###
!\/!!!\\
,"% \& "% "&"%!\& \%!"&\%!,"&\'!!\/
 \'! "/
"'! \/
 "',"/
,"\,##___"/
!\\###\/

Try it online!

Conor O'Brien
fonte
1

Pyth, 111 bytes

J\/K\\+*6d*15\_+++*5dJ*15dKV5+++*-5hNd"/  /"*+yN11d+++KddK)V4+++*NdK*-25yNdJ)+++++*4dK*2d*13\_*2dJ+++*5dK*15\_J

This code basically prints the lines one after another (in the naive way of doing it). Yeah it sucks, but right now I'm in no state of doing better, and I too still wanted to pay tribute to HyperNeutrino.

Try it online!

Jim
fonte
1

PHP, 122 bytes

<?=gzinflate(base64_decode("ddDBDQAgCEPRO1N0AxYicf8tFK2JIPT4HycA34iTHRVxJqwvGLvme8LXrxRAKoVmBZypoMNFjbmUtMEl/OV2WHqYTg"));

Try it online!

PHP, 158 bytes

for(;~$c='f000
e/o1d/b/k\b1c/b/m\b1b/b/o\b1a/b/q\b1/b/s\b1\y/
a\w/
b\u/
c\s/
d\b00___b/
e\000/'[$i++];)echo$c>_?str_pad("",ord($c)^96):strtr($c,[_____,"\
"]);

Try it online!

PHP, 165 bytes

<?=strtr("5566666
57/3334
5 13552513352713332 13355 213335 2433335 0 433355 0743333054333505 476666_ 057466666/",[" /
","/  /","\  \
","     ","\\","   ",___,"  "]);

Try it online!

Jörg Hülsermann
fonte
1

SOGL V0.12, 53 52 bytes

/↕Υ¦‛¾}`¼Pσ↕ΗΦ▒∙⌠N►4┼ΥjΠ⌡jOT?»m,┌∆Χ⁶↑┌≠Γ‽‼║%Ν□‘7«n╬⁷

Try it Here!

dzaima
fonte
1

Python 2, 187 bytes

a=`int("7YSUQZDJS0I3J2QJ40G9WNPIRBTBC1KF0F3X5WDMBW8CG5BVDHBJQ71V3UHCSY3TR8LC4IIEE5SZ",36)`[:-1]
for i in"0666666_!6__!5/!3\\!9\n!844!422!211!1 ".split("!"):a=a.replace(i[0],i[1:])
print a

Try it online!

officialaimm
fonte
1

C# (.NET Core), 169 bytes

var d=new char[364];for(int i=10;i-->0;)for(int j="ppnggffggn"[i]-97;j-->0;)d[28*"amlhbccbha"[i]+"ggh{fguva|"[i]-2813+j*("b|~}"[i/3]-97)]="_/\\\n"[i/3];Console.Write(d);

Ungolfed:

var d = new char[364];
for (int i = 10; i-- > 0; )
    for (int j = "ppnggffggn"[i] - 97; j-- > 0; )
        d[28 * "amlhbccbha"[i] + "ggh{fguva|"[i] - 2813 + j * ("b|~}"[i / 3] - 97)] = "_/\\\n"[i / 3];
Console.Write(d);

For each stroke I encoded the start position, length, character used, and direction within various strings. I saved a few bytes by grouping up similar strokes.

Sadly, this prints a little weird in tio. This is because I'm not printing out real spaces. Looks fine in my console, though. So probably this submission doesn't count. Here's the link anyways.

Try it online! (fake spaces 169 bytes)

Try it online! (real spaces 191 bytes)

Geoffrey
fonte
1

Python 2, 154 138 bytes

print'eNp10MEJAEEIA8C/VaSDNBTY/rtYlByci+aZER8BMqcnqiR6FG7/IPd87w0c/pQMYBrFJmxhQDstljJSQUrb5euhZzBe6PI3aQ=='.decode('base64').decode('zip')

Try it online!

mdahmoune
fonte
1

Paintbrush, 43 bytes, non-competing

13→'_8×←↓s/5{↙s/3→s/3←}↓'\6×↘↑'_8×→↖'_7×←▕┣

Explanation

13→'_8×←↓s/5{↙s/3→s/3←}↓'\6×↘↑'_8×→↖'_7×←▕┣  Program
13→                                          Move the pointer 13 spaces right
   '_                                        Push '_' onto the stack
     8×                                      Multiply it 8 times
       ←                                     Draw out '________' moving to the left
        ↓                                    Move down
         s/                                  Set that cell to a slash
           5{         }                      Execute function 5 times
             ↙                               Move the pointer one spot down and one spot to the left
              s/                             Set that cell to a slash
                3→                           Move 3 spaces right
                  s/                         Set that cell to a slash
                    3←                       Move 3 spaces left
                      ↓                      Move down
                       '\                    Push r'\'
                         6×                  Multiply it 6 times
                           ↘                 Draw out r'\\\\\\' moving down-right
                            ↑                Move up
                             '_              Push '_'
                               8×            Multiply it 8 times
                                 →           Draw out '________' moving to the right
                                   ↖         Move the pointer one spot up and one spot to the right
                                    '_       Push '_'
                                      7×     Multiply it 7 times
                                        ←▕┣  Draw out '_______' moving to the left
                                         ▕   Remove the rightmost column
                                          ┣  Mirror the entire grid to the right, overlapping the inner column, flipping some characters that have backwards variants

Beta Testing in the Real World:

Charcoal: 1
Paintbrush: 0

Gotta make a lot of improvements, huh. :P

HyperNeutrino
fonte
And user themself posts a solution!
Value Ink
@ValueInk It's about time, huh? :P
HyperNeutrino
1

Bubblegum, 67 54 bytes

00000000: 55c9 310d 0040 0804 c1fe 55e0 0043 24f8  [email protected]$.
00000010: 77f1 c955 cc96 3b95 d65e 6697 4d76 0b93  w..U..;..^f.Mv..
00000020: cf06 f847 0448 d1e6 0ceb 5722 8421 1010  ...G.H....W".!..
00000030: d95b 7e60 ad3f                           .[~`.?

Try it online!

ovs
fonte
0

C (gcc), 200 bytes

char o[28];i,j,k,p;f(){for(k=0;k<39;puts(o))for(memset(o,k&&k<32?32:95,27),i=3;i--;k++)for(j=3;j--;o[24-i*3+j]=" _\\/"[p])o[i*3+2-j]=" _/\\"[p="U@@@B@HH@``@@BB@HH@``@@p@@L@@C@p@EL@UC@"[k]-64>>j*2&3];}

Try it online!

gastropner
fonte