Sayap alfabet!

11

Tugas Anda adalah mencetak teks ini:

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                        

Berikut ini diizinkan:

  • Meninggalkan ruang jejak di ujung garis
  • Melakukan semuanya dalam huruf besar, bukan huruf kecil
  • Mengejar baris baru

Ingat, ini adalah , jadi kode dengan jumlah byte terkecil menang.

Oliver Ni
sumber
9
Tantangan alfabet LAIN ?? Tolong, istirahatlah. Kami memiliki cukup tantangan alfabet terbaru . Bukan berarti itu buruk.
Erik the Outgolfer

Jawaban:

4

05AB1E , 36 byte

Kode:

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

Belum bekerja di TIO, tetapi bekerja dengan penerjemah offline .

Adnan
sumber
1
Bagaimana 05AB1E selalu menambahkan fitur yang dibutuhkan untuk tantangan hanya beberapa jam sebelum tantangan itu sendiri diposting?
LegionMammal978
2
@ LegionMammal978 Jujur, saya tidak punya petunjuk sedikit pun haha.
Adnan
4

Vim, 94 91 byte

Yang ini rumit.

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

Ini dia sedang beraksi:

Sayap alfabet di Vim

Berikut ini adalah xxd dump dengan karakter yang tidak patut dicetak:

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

Penjelasan:

Kredit untuk dua baris pertama jatuh ke DJMcMayhem dan 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
Yordania
sumber
3

PHP, 158 Bytes

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";
Jörg Hülsermann
sumber
3

Batch, 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%
Neil
sumber
2

Pyke, 27 byte

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

Coba di sini!

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(^)
Biru
sumber
Oh snap! Bukan untuk Jynx kamu, tetapi kamu hanya mengalahkan jelly!
Magic Octopus Mm
1

J, 52 byte

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

Pemakaian

   (,.}.@|."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                        
mil
sumber
1

Jelly , 35 byte

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

TryItOnline!

Bagaimana?

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                    "
Jonathan Allan
sumber
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  [email protected].../CD
00000090: ec8d 9010 7a12 1784 701b a8d4 a884 48e3  ....z...p.....H.
000000a0: 5050 9508 00                             PP...

Hanya menjalankan string melalui Zopfli untuk banyak iterasi.

LegionMammal978
sumber
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`

Dimana \nmewakili karakter baris baru literal. Ini baru saja menghilangkan jawaban membangun karakter saya di 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`
Neil
sumber
0

Ruby, 109 byte

Program lengkap yang mencetak string seperti yang dipersyaratkan oleh pertanyaan. Satu byte dapat disimpan dengan mengubah fungsi lambda yang mengembalikan array string.

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}

Tidak disatukan

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.
}
Level River St
sumber
0

Japt, 49 byte (tidak bersaing)

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

Saya terutama menulis jawaban ini untuk mencoba fungsi (agak) baru ê(bounce; "abc" -> "abcba"). Uji secara online!

Penjelasan

;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
Produksi ETH
sumber
0

C #, 473 Bytes

"Concat", "Reverse", "Substring" ... Begitu banyak kata-kata besar ...

Golf:

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;}

Tidak Disatukan:

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;
}

Output:

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
Pete Arden
sumber