Ali dell'alfabeto!


11

Il tuo compito è stampare questo testo esatto:

az                                               za
abyz                                           zyba
abcxyz                                       zyxcba
abcdwxyz                                   zyxwdcba
abcdevwxyz                               zyxwvedcba
abcdefuvwxyz                           zyxwvufedcba
abcdefgtuvwxyz                       zyxwvutgfedcba
abcdefghstuvwxyz                   zyxwvutshgfedcba
abcdefghirstuvwxyz               zyxwvutsrihgfedcba
abcdefghijqrstuvwxyz           zyxwvutsrqjihgfedcba
abcdefghijkpqrstuvwxyz       zyxwvutsrqpkjihgfedcba
abcdefghijklopqrstuvwxyz   zyxwvutsrqpolkjihgfedcba
abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba
  abcdefghijklopqrstuvwxyzyxwvutsrqpolkjihgfedcba  
    abcdefghijkpqrstuvwxyzyxwvutsrqpkjihgfedcba    
      abcdefghijqrstuvwxyzyxwvutsrqjihgfedcba      
        abcdefghirstuvwxyzyxwvutsrihgfedcba        
          abcdefghstuvwxyzyxwvutshgfedcba          
            abcdefgtuvwxyzyxwvutgfedcba            
              abcdefuvwxyzyxwvufedcba              
                abcdevwxyzyxwvedcba                
                  abcdwxyzyxwdcba                  
                    abcxyzyxcba                    
                      abyzyba                      
                        aza                        

Sono ammessi:

  • Tralasciando gli spazi finali alla fine delle linee
  • Fare tutto in maiuscolo anziché in minuscolo
  • Newline finali

Ricorda, questo è , quindi vince il codice con il minor numero di byte.


9
Un'altra sfida di alfabeto ?? Per favore, fai una pausa. Abbiamo abbastanza recenti sfide alfabetiche . Non che sia male, però.
Erik the Outgolfer,

Risposte:


4

05AB1E , 36 byte

Codice:

A13F¦¨DAsKDˆ13N>-·ð׫û,}¯R¦ð2×ì€û.c,

Non funziona ancora su TIO, ma funziona con l' interprete offline .


1
In che modo 05AB1E aggiunge sempre una funzione necessaria per una sfida solo poche ore prima della pubblicazione della sfida stessa?
LegionMammal978,

2
@ LegionMammal978 Onestamente, non ho il minimo indizio ahah.
Adnan,

4

Vim, 94 91 byte

Questo è stato difficile.

:se ri|h<_
jjYZZpqqpi  <Esc>@=17-line('.')
 xxYq11@qy2G:g/^/m0
qqD0Pwq12@q"0pdkGqq$y0A<C-r>"<Esc>kq24@q

Eccolo in azione:

Ali dell'alfabeto in Vim

Ecco un dump xxd con i caratteri non stampabili:

0000000: 3a73 6520 7269 7c68 3c5f 0a6a 6a59 5a5a  :se ri|h<_.jjYZZ
0000010: 7071 7170 6920 201b 403d 3137 2d6c 696e  pqqpi  .@=17-lin
0000020: 6528 272e 2729 0a20 7878 5971 3131 4071  e('.'). xxYq11@q
0000030: 7932 473a 672f 5e2f 6d30 0a71 7144 3050  y2G:g/^/m0.qqD0P
0000040: 7771 3132 4071 2230 7064 6b47 7171 2479  wq12@q"0pdkGqq$y
0000050: 3041 1222 1b6b 7132 3440 71              0A.".kq24@q

Spiegazione:

Il merito delle prime due linee va a DJMcMayhem e Lynn .

:se ri|       " Turn on reverse-insert mode
h<_<CR>jjYZZ  " Yank the lowercase alphabet from help
p             " Paste it
qq            " Start recording a macro
  pi  <Esc>              " Paste, then insert two spaces before the cursor
  @=17-line('.')<CR> xx  " Delete the middle two letters
  Y                      " Yank the current line
q11@q         " Stop recording, execute 11 times
y2G           " Yank everything except the first (blank) line
:g/^/m0<CR>   " Reverse the order of every line
qq            " Record
  D0P           " Delete until the end of the line (i.e. just the letters)
  w             " Skip to the first letter on the next line
q12@q         " Stop recording, execute 12 times
"0p           " Paste the lines yanked above
dk            " Delete this line and the line above
G             " Go to the last line
qq            " Record
  $y0           " Move to the end of the line, then yank all but the last letter
  A<C-r>"<Esc>  " Append (in insert mode so it's reversed)
  k             " Go up a line
q24@q         " Stop recording, execute 24 times

3

PHP, 158 byte

for(;$i++<25;)echo($a=str_pad)(($t=($f=substr)($j=join(range(a,z)),0,$x=$i>13?13-$i%13:$i).$f($j,-$x)).$a("",51-$i*4," ").$f(strrev($t),$i>12),51," ",2)."\n";

3

Lotto, 395 391 byte

@echo off
set q=
set r=
set s=
set t=
for /l %%i in (1,1,51)do call set s= %%s%%
for %%p in (az by cx dw ev fu gt hs ir jq kp lo mn)do call:u %%p
for /l %%i in (1,1,12)do call:l
exit/b
:u
set p=%1
set q=%q%%p:~,1%
set r=%p:~1%%r%
set s=%s:~4%%p:~1%
set t=%p:~,1%%t%
echo %q%%r%%s%%t%
exit/b
:l
set q=  %q:~,-1%
set r=%r:~1%
set s=%s:~,-1%
set t=%t:~1%
echo %q%%r%%s%%t%

2

Pyke, 27 byte

13FhG'<R>+26{)DFl826^)_+msX

Provalo qui!

13F          )              -    for i in range(13):
   h                        -       i+1
    G'<R>+                  -      alphabet[:^]+alphabet[-^:]
          26{               -     ^.rpad(26)
              D        +    -   ^ + V
               F     )      -     for i in ^^:
                l8          -       ^.lstrip()
                  26^       -      ^.lpad(26)
                      _     -    reversed(^)
                        ms  -  map(palindromise, ^)
                          X - splat(^)

Oh schiocco! Non per Jynx, ma hai appena battuto la gelatina!
Magic Octopus Urn,

1

J, 52 byte

(,.}.@|."1)(}:,|.|.~"#:_2*i.@#)(a.{~97+],25-|.)\i.13

uso

   (,.}.@|."1)(}:,|.|.~"#:_2*i.@#)(a.{~97+],25-|.)\i.13
az                                               za
abyz                                           zyba
abcxyz                                       zyxcba
abcdwxyz                                   zyxwdcba
abcdevwxyz                               zyxwvedcba
abcdefuvwxyz                           zyxwvufedcba
abcdefgtuvwxyz                       zyxwvutgfedcba
abcdefghstuvwxyz                   zyxwvutshgfedcba
abcdefghirstuvwxyz               zyxwvutsrihgfedcba
abcdefghijqrstuvwxyz           zyxwvutsrqjihgfedcba
abcdefghijkpqrstuvwxyz       zyxwvutsrqpkjihgfedcba
abcdefghijklopqrstuvwxyz   zyxwvutsrqpolkjihgfedcba
abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba
  abcdefghijklopqrstuvwxyzyxwvutsrqpolkjihgfedcba  
    abcdefghijkpqrstuvwxyzyxwvutsrqpkjihgfedcba    
      abcdefghijqrstuvwxyzyxwvutsrqjihgfedcba      
        abcdefghirstuvwxyzyxwvutsrihgfedcba        
          abcdefghstuvwxyzyxwvutshgfedcba          
            abcdefgtuvwxyzyxwvutgfedcba            
              abcdefuvwxyzyxwvufedcba              
                abcdevwxyzyxwvedcba                
                  abcdwxyzyxwdcba                  
                    abcxyzyxcba                    
                      abyzyba                      
                        aza                        

1

Gelatina , 35 byte

Ḳṙ-K
CrịØaṙµL26_⁶ẋ;
13RµŒḄǀр⁸¦ŒBY

TryItOnline!

Come?

13RµŒḄǀр⁸¦ŒBY - Main link: no arguments
13R             - range(13) -> [1,2,3,...,12,13]
   µ            - monadic chain separation
    ŒḄ          - bounce    -> [1,2,3,...,12,13,12,...,3,2,1]
      Ç€        - call last link (2) as a monad for €ach
           ¦    - apply to indexes
          ⁸     -    left argument (13R)
        Ñ€      -    next link (1) as a monad for €ach
            ŒB  - bounce with vectorisation at depth 1 (creates the right hand side)
              Y - join with line feeds

CrịØaṙµL26_⁶ẋ; - Link 2: make the left side of a row, with spaces at the left: i (e.g. 3)
C              - complement (1-i)       e.g. 1-3=-2
 r             - range(1-i, i)          e.g. [-2,-1,0,1,2,3]
  ị            - index into
   Øa          - lowercase alphabet     e.g. "xyzabc"
      µ        - monadic chain separation
     ṙ         - rotate left by i       e.g. "abcxyz"
        26_    - literal 26 minus
       L       - length                 e.g. 26-6=20
           ⁶   - literal ' '
            ẋ  - repeat 26-length times e.g. "                    "
             ; - concatenate            e.g. "                    abcxyz"

Ḳṙ-K - Link 1, swap spaces to the right: left half of a row
Ḳ    - split on spaces                  e.g. [[],[],...,"abcxyz"]
 ṙ   - rotate left by
  -  - literal -1                       e.g. ["abcxyz",...,[],[]]
   K - join with spaces                 e.g. "abcxyz                    "

1

Bubblegum , 165 byte

hexdump:

00000000: 4aac 5220 0d54 25f2 7201 e896 8b03 86a2  J.R .T%.r.......
00000010: 1806 60ab bcd5 fa99 19a7 2f43 ec3a 77e9  ..`......./C.:w.
00000020: 129d a2f9 e58c 9e29 3e64 d3e5 88df 29d9  .......)>d....).
00000030: a9f9 654f be29 dda8 7965 4b4d ca56 6aba  ..eO.)..yeKM.Vj.
00000040: ac19 a47c 518d ca92 532a 6668 aacc c55f  ...|Q...S*fh..._
00000050: 2a27 6e54 a652 a46a c446 65ac 64aa 0768  *'nT.R.j.Fe.d..h
00000060: 5886 da49 4d8f cd94 be71 53db d966 4ad7  X..IM....qS..fJ.
00000070: 620a c136 2771 8124 0b07 2822 20a7 c07c  b..6'q.$..(" ..|
00000080: 424c 9c30 52c2 4011 1235 1019 c12f 4344  BL.0R.@..5.../CD
00000090: ec8d 9010 7a12 1784 701b a8d4 a884 48e3  ....z...p.....H.
000000a0: 5050 9508 00                             PP...

Ho appena passato la stringa attraverso Zopfli per molte iterazioni.


0

JavaScript (ES6), 215 211 byte

_=>[...Array(25)].map((_,i)=>` `.repeat(++i>13&&i*2-26)+a.slice(0,j=i>13?26-i:i)+a.slice(-j)+` `.repeat(i<13&&51-i*4)+b.slice(i>12,j)+b.slice(-j),a=`abcdefghijklmnopqrstuvwxyz`,b=[...a].reverse().join``).join`\n`

Dove \nrappresenta il carattere letterale di newline. Questo ha appena superato la mia risposta sulla creazione del personaggio a 213 byte:

_=>[...Array(25)].map((_,i)=>` `.repeat(51).replace(/./g,(b,j)=>(j=i<13?j<i?j+10:j<h?36+j-h:j<51-h?0:j<51-i?86-h-j:60-j:j<h-26?0:j<i?36+j-h:j<26?j+10:j<51-i?60-j:j<77-h?86-h-j:0)?j.toString(36):b,h=++i+i)).join`\n`

0

Rubino, 109 byte

Programma completo che stampa una stringa come richiesto dalla domanda. È possibile salvare un byte cambiando in una funzione lambda che restituisce una matrice di stringhe.

s=[*(?a..?z)]*""
puts (-12..12).map{|i|(t="%#{(i<=>0)*26}s"%(s[0,13-i.abs]+s[13+i.abs..26]))+t[0,25].reverse}

Ungolfed

s=[*(?a..?z)]*""                     #Convert range 'a'..'z' into an array, then a string.
puts (-12..12).map{|i|               #Iterate over -12..12, make an array of lines then print them.
  (t=                                #t= left side of pattern.
    "%#{(i<=>0)*26}s"%               #Compose format string %-26s or %26s to pad to 26 chars and left/right justify depending on sign.
     (s[0,13-i.abs]+s[13+i.abs..26]) #In this format, print the appropriate number of beginning and ending letters of the alphabet.
   )+
     t[0,25].reverse                 #Righthand side of pattern. Remove the rightmost column from t, reverse it, and concatenate to left side.
}

0

Japt, 49 byte (non concorrenti)

;1o14@CjX26-2*XÃê £Y<12?X+S²p12-Y :S²pY-12 +X ê÷

Ho principalmente scritto questa risposta per provare la (in qualche modo) nuova êfunzione (rimbalzo; "abc" -> "abcba"). Provalo online!

Spiegazione

;1o14@CjX26-2*X} ê £Y<12?X+S²p12-Y :S²pY-12 +X ê} ·

;                                                    // Set C to "abc...xyz".
 1o14                                                // Create the range [1, 14).
     @         }                                     // Map each item X by this function:
         26-2*X                                      //   Take 26 - 2X.
      CjX                                            //   Remove this many chars from index X in C.
                                                     // We now have ["az", "abyz", ..., "abc...xyz"].
                 ê                                   // Bounce. This gives us ["az", "abyz", ..., "abc...xyz", ..., "abyz", "az"].
                   £                            }    // Map each item X and index Y by this function:
                    Y<12?                            //   If Y is less than 12,
                         X+S²p12-Y                   //   append 12 - Y double-spaces.
                                   :S²pY-12 +X       //   Otherwise, prepend Y - 12 double-spaces.
                                                     //   This gives us the left half of the wings.
                                               ê     //   Bounce. This creates the right half.
                                                  ·  // Join the resulting array with newlines.
                                                     // Implicit: output last expression

0

C #, 473 byte

"Concat", "Reverse", "Substring" ... Tante grandi parole ...

golfed:

string A(){string a="abcdefghijklmnopqrstuvwxyz",r=string.Concat(a.Reverse()),o="",x="",y="",z="";int i=0;var l=new List<string>();for(i=0;i<13;i++){x=a.Substring(0,i);y=r.Substring(0,i);z=x+string.Concat(y.Reverse())+string.Concat(Enumerable.Repeat(" ",51-i*4))+y+string.Concat(x.Reverse())+"\n";o+=z;l.Add(z.Replace(" ","").Replace("zz","z"));}o+=a+r.Substring(1,r.Length-1)+"\n";l.Reverse();for(i=0;i<12;i++)o+=string.Concat(Enumerable.Repeat(" ",i+i+2))+l[i];return o;}

Ungolfed:

public string A()
{
  string a = "abcdefghijklmnopqrstuvwxyz", r = string.Concat(a.Reverse()), o = "",x="",y="",z="";
  int i=0;
  var l = new List<string>();
  for (i = 0; i < 13; i++)
  {
    x = a.Substring(0, i);
    y = r.Substring(0, i);
    z = x + string.Concat(y.Reverse()) + 
      string.Concat(Enumerable.Repeat(" ", 51-i*4)) + 
      y + string.Concat(x.Reverse()) + "\n";
    o += z;
    l.Add(z.Replace(" ", "").Replace("zz", "z"));
  }
  o += a + r.Substring(1, r.Length - 1) + "\n";
  l.Reverse();
  for (i = 0; i < 12; i++)
    o += string.Concat(Enumerable.Repeat(" ", i + i + 2)) + l[i];
  return o;
}

Uscite:

az                                               za
abyz                                           zyba
abcxyz                                       zyxcba
abcdwxyz                                   zyxwdcba
abcdevwxyz                               zyxwvedcba
abcdefuvwxyz                           zyxwvufedcba
abcdefgtuvwxyz                       zyxwvutgfedcba
abcdefghstuvwxyz                   zyxwvutshgfedcba
abcdefghirstuvwxyz               zyxwvutsrihgfedcba
abcdefghijqrstuvwxyz           zyxwvutsrqjihgfedcba
abcdefghijkpqrstuvwxyz       zyxwvutsrqpkjihgfedcba
abcdefghijklopqrstuvwxyz   zyxwvutsrqpolkjihgfedcba
abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba
  abcdefghijklopqrstuvwxyzyxwvutsrqpolkjihgfedcba
    abcdefghijkpqrstuvwxyzyxwvutsrqpkjihgfedcba
      abcdefghijqrstuvwxyzyxwvutsrqjihgfedcba
        abcdefghirstuvwxyzyxwvutsrihgfedcba
          abcdefghstuvwxyzyxwvutshgfedcba
            abcdefgtuvwxyzyxwvutgfedcba
              abcdefuvwxyzyxwvufedcba
                abcdevwxyzyxwvedcba
                  abcdwxyzyxwdcba
                    abcxyzyxcba
                      abyzyba
                        aza
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.