Alphabet Diamond

31

Você já viu o incrível triângulo do alfabeto , a vingança do triângulo do alfabeto e agora é hora da vingança da vingança do triângulo do alfabeto!

Apresentando ...

O DIAMANTE DO ALFABETO!

Sua tarefa é produzir esse texto exato, em minúsculas / maiúsculas não importa, embora as novas linhas importem:

bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb
cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc
defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed
efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe
fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf
ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg
hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih
ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji
jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj
klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk
lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml
mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm
nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon
opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo
pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp
qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq
rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr
stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts
tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut
uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu
vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv
wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw
xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx
yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy
zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz
abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba
bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb
abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba
zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz
yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy
xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx
wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw
vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv
uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu
tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut
stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts
rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr
qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq
pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp
opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo
nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon
mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm
lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml
klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk
jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj
ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji
hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih
ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg
fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf
efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe
defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed
cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc
bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb

Este é o código-golfe, o menor número de vitórias do número anterior.

Regras:

  1. As brechas padrão não são permitidas.
  2. a deve ser o centro do diamante do alfabeto.
Urna de polvo mágico
fonte
11
Bom desafio. Pessoalmente, acho que faria mais sentido se os cantos fossem ae o centro fossez
ETHproductions
4
@ETHproductions Eu queria dificultar as línguas de golfe que podem empurrar o alfabeto;). Embora eu duvide que seja muito mais difícil.
Magic Octopus Urn
@carusocomputing Uma rotação à esquerda faria isso. Por exemplo, .<faria isso em Pyth: .<S5 1resultaria em [2, 3, 4, 5, 1]. É o mesmo que .<[1 2 3 4 5)1. Não tenho certeza para o diamante, no entanto.
Erik the Outgolfer
@EriktheGolfer, percebo que também existem maneiras mais inteligentes de fazê-lo, como desmoronar a mudança em algum momento. O próprio diamante deve exigir troca, portanto, existem maneiras de combinar a mudança inicial nas iterações reais do diamante. Foi uma parte intencional do desafio de ver quem otimizava seus ciclos.
Magic Octopus Urn
@carusocomputing Eu quis dizer sobre bser a letra inicial em vez de a. É claro que mudar também é vital.
Erik the Outgolfer

Respostas:

16

05AB1E , 13 12 bytes

A27FÀDûˆ}¯û»

Experimente online!

Explicação

A              # push alphabet
 27F           # 27 times do
    À          # rotate alphabet left
     Dû        # create a palendromized copy
       ˆ       # add to global list
        }      # end loop
         ¯     # push global list
          û    # palendromize list
           »   # merge list on newline
               # implicit output
Emigna
fonte
Provavelmente, poderia salvar um byte usando registradores eg para calcular o comprimento do alfabeto em vez de enganá-lo.
Magic Octopus Urn
@carusocomputing: A menos que eu esteja fazendo errado (sinta-se à vontade para me informar se for esse o caso), acabei aos 13 fazendo isso. Eu consegui salvar um byte com a lista global.
Emigna
A©gF®À©û})û»é o que eu estava pensando. De maneira alguma você está fazendo errado! Eu aprendi tudo o que sei assistindo você heh. A lista global é a mesma ideia básica.
Magic Octopus Urn
1
Agora você está amarrado comigo. : 3
Oliver Ni
1
@ Oliver: Realmente! E com 2 abordagens diferentes na mesma língua :)
Emigna
27

Teclas Vim, 62 , 60

:se ri|h<_<cr>jjYZZPqqx$pYpq26@qdjyH:g/^/m0<cr>VP:%norm DPA<C-v><C-r>"<C-v><esc>x<cr>

Inspirando-se na impressionante resposta vim de Lynn para ter a idéia de roubar o alfabeto dos documentos de ajuda.

Você pode assistir isso acontecer em tempo real, enquanto luto para lembrar a sequência correta de teclas!

enter image description here

Observe que este gif está um pouco desatualizado porque produz uma saída incorreta, e ainda não consegui regravá-lo ainda.

DJMcMayhem
fonte
Eu tentei este programa e consegui isso .
precisa
Pls rerecord ty
ASCII-only
8

MATL, 14 bytes

2Y226Zv27Zv!+)

Try it online!

2Y2     % Push string 'abc...z'
26Zv    % Push symmetric range [1 2 ... 25 26 25 ... 2 1]
27Zv    % Push symmetric range [1 2 ... 25 26 27 26 25 ... 2 1]
!       % Transpose into a column
+       % Addition with broadcast. Gives a matrix of all pairwise additions:
        % [  2  3 ... 26 27 26 ...  3  2
             3  4 ... 27 28 27 ...  4  3
             ...
            27 28 ... 51 52 51 ... 28 27
            28 29 ... 52 53 52 ... 29 28
            27 28 ... 51 52 51 ... 28 27
             ...
             2  3 ... 26 27 26 ...  3  2 ]
)       % Index modularly into the string. Display implicitly
Luis Mendo
fonte
6

PHP, 129 Bytes

for(;++$i<27;)$o.=($s=($f=substr)($r=join(range(a,z)),$i,26-$i)).$t.strrev($s.$t=$f($r,0,$i))."\n";echo$o.$f($o,0,51).strrev($o);
Jörg Hülsermann
fonte
syntax error, unexpected '(' on line 1 Which php version?
Tschallacka
1
@Tschallacka PHP > 7 before you can write for($f=substr; and $f($r=join(range(a,z)),$i,26-$i)) instead of ($f=substr)($r=join(range(a,z)),$i,26-$i)) to avoid the error
Jörg Hülsermann
5

Haskell, 75 bytes

g=(++)<*>reverse.init 
unlines$g$g.take 26.($cycle['a'..'z']).drop<$>[1..27]

How it works:

g=(++)<*>reverse.init    -- helper function that takes a list and appends the
                         -- reverse of the list with the first element dropped, e.g.
                         -- g "abc"  -> "abcba"

             <$>[1..27]  -- map over the list [1..27] the function that
           drop          -- drops that many elements from
    ($cycle['a'..'z'])   -- the infinite cycled alphabet and
   take 26               -- keeps the next 26 chars and
  g                      -- appends the reverse of itself

                         -- now we have the first 27 lines

 g                       -- do another g to append the lower half
unlines                  -- join with newlines
nimi
fonte
5

C, 76 bytes

Function, to be called as below. Prints capital letters.

f(i){for(i=2756;--i;)putchar(i%52?90-(abs(i%52-26)+abs(i/52-26)+25)%26:10);}

//call like this
main(){f();}

Simple approach, add the x and y distances from the centre of the square, plus an offset of 25 for the a in the middle, take modulo 26 and subract from 90, the ASCII code for Z. Where i%52==0 a newline ASCII 10 is printed.

Level River St
fonte
Your offset of +25 is the same as -1 in modulo 26
Karl Napf
2
@KarlNapf C doesn't implement modulo of negative numbers the way mathematicians do. -1%26 in C is -1, not 25. The result is a [ in the centre instead of the expected A. Thanks anyway, you would have been correct in a language such as Ruby where -1%26 does equal 25.
Level River St
5

R, 71 bytes

cat(letters[outer(c(1:27,26:1),c(0:25,24:0),"+")%%26+1],sep="",fill=53)

outer creates a matrix with the indices of the letters, letters[...] then creates a vector with the correct letters in. cat(...,sep="",fill=53) then prints it out with the desired formatting.

JDL
fonte
1
Nice one! Somehow I had forgotten about the fill option for cat. Great way of printing formatted matrices.
Billywob
4

Jelly, 13 bytes

Øaṙ1ṭṙJ$ŒBŒḄY

Try it online!

Explanation

Øaṙ1ṭṙJ$ŒBŒḄY  Main link. No arguments
Øa             Get the lowercase alphabet
  ṙ1           Rotate left by 1
    ṭ          Append to
       $       Monadic chain
      J          Indices of the alphabet [1, 2, ..., 26]
     ṙ           Rotate the alphabet by each
        ŒB     Bounce each rotation
          ŒḄ   Bounce the rotations
            Y  Join with newlines and print implicitly
miles
fonte
Øaṙ'JŒBŒḄY for 10 :)
Jonathan Allan
@JonathanAllan Thanks but that's missing the middle part which is why I had to do that ṙ1ṭ bit. Also ØaṙJŒBŒḄY is fine, you don't need the quick since it vectorizes on the right to 0
miles
Totally missed that the diamond was not perfect! Oh well...
Jonathan Allan
4

Jelly, 11 bytes

27RØaṙŒḄŒBY

Explanation:

27R          range of 1...27
   Øa        the alphabet
     ṙ       rotate
      ŒḄŒB   bounce in both dimensions
          Y  join on newline
clap
fonte
3

Python 2, 96 85 bytes

Printing the uppercase version (saves 1 byte).

R=range
for i in R(53):print''.join(chr(90-(abs(j-25)+abs(i-26)-1)%26)for j in R(51))

previous solution with help from muddyfish

s="abcdefghijklmnopqrstuvwxyz"*3
for i in range(53):j=min(i,52-i);print s[j+1:j+27]+s[j+25:j:-1]
Karl Napf
fonte
3
isn't just typing the alphabet fewer chars?
Blue
3

Perl, 77 bytes

Requires -E at no extra cost.

Pretty standard approach... I don't like the calls to reverse I think there's likely a more maths based approach to this, will see how I get on!

@a=((a..z)x3)[$_..$_+26],$a=pop@a,(say@a,$a,reverse@a)for 1..26,reverse 1..25

Usage

perl -E '@a=((a..z)x3)[$_..$_+26],$a=pop@a,(say@a,$a,reverse@a)for 1..26,reverse 1..25'
Dom Hastings
fonte
You can save 1 byte by removing the whitespace after reverse in reverse 1..25. The for needs it though.
simbabque
1
@simbabque maybe it's a Perl version thing, but reverse1..25 results in 0..25. I'm running 5.18.2...
Dom Hastings
You're right. Because the bareword reverse1 is undefined. Makes sense.
simbabque
3

JavaScript (ES6), 97 96 bytes

Saved 1 byte thanks to @user81655

R=(n,s=25,c=(n%26+10).toString(36))=>s?c+R(n+1,s-1)+c:c
C=(n=1,r=R(n))=>n<27?r+`
${C(n+1)}
`+r:r

Two recursive functions; C is the one that outputs the correct text. Try it here:

ETHproductions
fonte
@user81655 I always forget about string interpolation when newlines are involved :P
ETHproductions
3

Python 3, 119 bytes

I tried to exploit the two symmetry axes of the diamond, but this ended up more verbose than Karl Napf's solution.

A='abcdefghijklmnopqrstuvwxyz'
D=''
for k in range(1,27):
 D+=A[k:]+A[:k]
 D+=D[-2:-27:-1]+'\n'
print(D+D[:51]+D[::-1])
ojdo
fonte
A good solution nonetheless! You can cut down 3 bytes by writing the for loop in 1 line: for k in range(1,27):D+=A[k:]+A[:k];D+=D[-2:-27:-1]+'\n'
FlipTack
shortened again: replace A with 'bcdefghijklmnopqrstuvwxyza' and replace range(1,27) with range(26). My byte count is now 114
FlipTack
3

Haskell, 67 66 bytes

unlines[[toEnum$mod(-abs j-abs i)26+97|j<-[-25..25]]|i<-[-26..26]]
Damien
fonte
3

C, 252 bytes

#define j q[y]
#define k(w,v) (v<'z')?(w=v+1):(w=97)
char q[28][52],d;main(){int y,x=1;y=1;j[0]=98;j[50]=98;for(;y<27;y++){for(;x<26;x++){(x<1)?(k(d,q[y-1][50])):(k(d,j[x-1]));j[50-x]=d;j[x]=d;}x=0;j[51]=0;puts(j);}strcpy(j,q[1]);for(;y;y--)puts(j);}

Formatted, macro-expanded version, which is hopefully more intelligible:

#define j q[y]
#define k(w,v) (v<'z')?(w=v+1):(w=97)
char q[28][52],d;
main(){
int y,x=1;
y=1;
q[1][0]=98;q[1][50]=98;
//98 takes one less byte to type than the equivalent 'b'
for(;y<27;y++){
    for(;x<26;x++){
        (x<1)?
            (k(d,q[y-1][50]))
            :(k(d,q[y][x-1]));
        q[y][50-x]=d;
        q[y][x]=d;
        }
    x=0;
    q[y][51]=0;
    puts(q[y]);
    }
strcpy(q[y],q[1]);
for(;y;y--)puts(q[y]);
}

I know this can't win, but I had fun trying. This is my first ever attempt at code golf.

qzlpnfv
fonte
Welcome to code golf, it's addicting haha ;).
Magic Octopus Urn
3

Batch, 255 bytes

@echo off
set l=abcdefghijklmnopqrstuvwxyz
set r=yxwvutsrqponmlkjihgfedcba
for /l %%i in (1,1,27)do call:u
for /l %%i in (1,1,25)do call:l
:l
set r=%r:~2%%l:~-1%.
set l=%l:~-2%%l:~0,-2%
:u
set r=%l:~-1%%r:~0,-1%
set l=%l:~1%%l:~0,1%
echo %l%%r%

Explanation: The subroutine u rotates the alphabet outwards by one letter from the centre, which is the pattern used in the top half of the desired output. The subroutine l rotates the alphabet inwards by two letters. It then falls through into the u subroutine, achieving an effective single letter inward rotation. Finally the last line is printed by allowing the code to fall through into the l subroutine.

Neil
fonte
2

Pyke, 23 22 21 bytes

GV'th+jj_t+j)K]0n'JOX

Try it here!

GV          )         - repeat 26 times, initially push alphabet.
  'th+                -  push tos[1:]+tos[0]
      j               -  j = tos
       j              -  push j
        _t+           -  push pop+reversed(pop)[1:]
           j          -  push j
             K        - pop
              ]0      - list(stack)
                n'JOX - print "\n".join(^),
                      - splat ^[:-1]
Blue
fonte
2

C++, 191 179 166 165 bytes

-12 bytes thanks to Kevin Cruijssen
-14 bytes thanks to Zacharý

#include<iostream>
#define C j;)std::cout<<char(97+(d+j
int main(){for(int i=0,j,d=1;i<53;d+=i++/26?-1:1){for(j=0;26>C++)%26);for(j=24;0<=C--)%26);std::cout<<'\n';}}
HatsuPointerKun
fonte
1
You can save 12 bytes like this: #include<iostream> int main(){for(int i=0,j,d=1;i<53;d+=i++/26?-1:1){for(j=0;j<26;)std::cout<<char((j+++d)%26+97);for(j=24;j>=0;)std::cout<<char((j--+d)%26+97);std::cout<<'\n';};}
Kevin Cruijssen
Dang it Kevin, ya ninja'd me.
Zacharý
@KevinCruijssen Thanks you for the help. By the way, your code in the comment contained unprintable unicode characters.
HatsuPointerKun
@HatsuPointerKun That's something that happens automatically in the comments I'm afraid. It's indeed pretty annoying when you try to copy-paste code from it.. :)
Kevin Cruijssen
2
You can abuse macros by adding this: #define C j;)std::cout<<char(97+(d+j, and then changing the last line to this: int main(){for(int i=0,j,d=1;i<53;d+=i++/26?-1:1){for(j=0;26>C++)%26);for(j=24;0<=C--)%26);std::cout<<'\n';};}
Zacharý
2

Charcoal, 24 21 bytes

-3 bytes thanks to ASCII-only.

F²⁷«P✂×β³⊕ι⁺ι²⁷↓»‖B↓→

Try it online! Link is to verbose version.

...I need to work on my Charcoal-fu. :P

totallyhuman
fonte
some easy bytes off
ASCII-only
Now I find out that the fourth argument to Slice is optional. >_>
totallyhuman
All (yes, all four) arguments are optional
ASCII-only
wat, what does niladic Slice even do?
totallyhuman
2
Oh wait nvm yeah the first argument is required :P
ASCII-only
1

JavaScript (ES6), 128 115 114 bytes

a='abcdefghijklmnopqrstuvwxyz'
for(o=[i=27];i--;)o[26-i]=o[26+i]=(a=(p=a.slice(1))+a[0])+[...p].reverse().join``
o
darrylyeo
fonte
1

Groovy - 103 97 bytes

I realise there are cleverer ways of doing this but...

{t=('a'..'z').join();q={it[-2..0]};c=[];27.times{t=t[1..-1]+t[0];c<<t+q(t)};(c+q(c)).join('\n')}

When run the result of the script is the requested answer.

(Thanks to carusocomputing for the tip on saving 7 bytes).

Updated example accordingly on:

See http://ideone.com/MkQeoW

GolfIsAGoodWalkSpoilt
fonte
Instead of the for loop you can use 27.times(){} and save 7 bytes ;).
Magic Octopus Urn
1

Racket 293 bytes

(let*((ls list->string)(rr reverse)(sr(λ(s)(ls(rr(string->list s))))))(let p((s(ls(for/list((i(range 97 123)))(integer->char i))))
(n 0)(ol'()))(let*((c(string-ref s 0))(ss(substring s 1 26))(s(string-append ss(string c)(sr ss))))(if(< n 53)(p s(+ 1 n)(cons s ol))
(append(rr ol)(cdr ol))))))

Ungolfed:

(define (f)
  (define (sr s)           ; sub-fn reverse string;
    (list->string
     (reverse
      (string->list s))))
  (let loop ((s
              (list->string
               (for/list
                   ((i
                     (range 97 123)))
                 (integer->char i))))
             (n 0)
             (ol '()))
    (define c (string-ref s 0))
    (define ss (substring s 1 26))
    (set! s (string-append
             ss 
             (string c)
             (sr ss)))
    (if (< n 53)
        (loop s (add1 n) (cons s ol))
        (append (reverse ol) (rest ol)))))

Testing:

(f)

Output:

'("bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb"
  "cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc"
  "defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed"
  "efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe"
  "fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf"
  "ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg"
  "hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih"
  "ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji"
  "jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj"
  "klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk"
  "lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml"
  "mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm"
  "nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon"
  "opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo"
  "pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp"
  "qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq"
  "rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr"
  "stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts"
  "tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut"
  "uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu"
  "vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv"
  "wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw"
  "xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx"
  "yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy"
  "zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz"
  "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"
  "bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb"
  "cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc"
  "defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed"
  "efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe"
  "fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf"
  "ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg"
  "hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih"
  "ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji"
  "jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj"
  "klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk"
  "lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml"
  "mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm"
  "nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon"
  "opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo"
  "pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp"
  "qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq"
  "rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr"
  "stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts"
  "tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut"
  "uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu"
  "vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv"
  "wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw"
  "xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx"
  "yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy"
  "zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz"
  "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"
  "bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb"
  "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"
  "zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz"
  "yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy"
  "xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx"
  "wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw"
  "vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv"
  "uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu"
  "tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut"
  "stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts"
  "rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr"
  "qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq"
  "pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp"
  "opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo"
  "nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon"
  "mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm"
  "lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml"
  "klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk"
  "jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj"
  "ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji"
  "hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih"
  "ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg"
  "fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf"
  "efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe"
  "defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed"
  "cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc"
  "bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb"
  "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"
  "zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz"
  "yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy"
  "xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx"
  "wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw"
  "vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv"
  "uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu"
  "tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut"
  "stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts"
  "rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr"
  "qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq"
  "pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp"
  "opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo"
  "nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon"
  "mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm"
  "lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml"
  "klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk"
  "jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj"
  "ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji"
  "hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih"
  "ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg"
  "fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf"
  "efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe"
  "defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed"
  "cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc"
  "bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb")
rnso
fonte
1

Pyth, 21 19 bytes

j+PKm+PJ.<Gd_JS27_K

Try it online!

Explanation:

j+PKm+PJ.<Gd_JS27_K   expects no input

j                     joins on new line
 +   +                joins two strings
  P   P               prints everything but the last element
   K                  initialize K and implicitly print
    m                 for...in loop, uses d as iterator variable
       J              initialize J and implicitly print
        .<            cyclically rotate
          G           initialized to the lowercase alphabet
           d          iterating variables of m
            _    _    reverse
             J        call J
              S27     indexed range of 27
                  K   call K
chromaticiT
fonte
1

SOGL V0.12, 10 bytes

zl{«:}«¹╬,

Try it Here!

Explanation:

z           push the lowercase alphabet
 l{  }      repeat length times
   «          put the 1st letter at the end
    :         duplicate
      «     put the 1st letter at the end (as the last thing called is duplicate)
       ¹    wrap the stack in an array
        ╬,  quad-palindromize with 1 X and Y overlap
dzaima
fonte
1

Java 8, 154 153 bytes

o->{String r="";for(int i=0,j,d=1;i<53;d+=i++>25?-1:1){for(j=0;j<26;r+=(char)((j+++d)%26+97));for(j=24;j>=0;r+=(char)((j--+d)%26+97));r+="\n";}return r;}

Port of @HatsuPointerKun C++ answer, so make sure to upvote him/her as well.

Try it here.

Kevin Cruijssen
fonte
1

Kotlin, 106 bytes

{(0..52).map{i->(0..50).map{j->print((90-((Math.abs(j-25)+Math.abs(i-26)-1)+26)%26).toChar())}
println()}}

Beautified

{
    (0..52).map {i->
        (0..50).map {j->
            print((90 - ((Math.abs(j - 25) + Math.abs(i - 26) - 1)+26) % 26).toChar())
        }
        println()
    }
}

Test

var v:()->Unit =
{(0..52).map{i->(0..50).map{j->print((90-((Math.abs(j-25)+Math.abs(i-26)-1)+26)%26).toChar())}
println()}}

fun main(args: Array<String>) {
    v()
}

TryItOnline

Port of @Karl Napf's answer

jrtapsell
fonte
1

VBA (Excel) , 116 Bytes

Sub a()
For i=-26To 26
For j=-25To 25
b=b & Chr(65+(52-(Abs(j)+Abs(i))) Mod 26)
Next
Debug.Print b
b=""
Next
End Sub

Following Sir Joffan's Logic. :D

remoel
fonte
1

VBA, 109 105 78 Bytes

Anonymous VBE immediate window function that takes no input and outputs the alphabet diamond to the VBE immediate window.

For i=-26To 26:For j=-25To 25:?Chr(65+(52-(Abs(j)+Abs(i)))Mod 26);:Next:?:Next
Taylor Scott
fonte
1

uBASIC, 86 bytes

0ForI=-26To26:ForJ=-25To25:?Left$(Chr$(65+(52-(Abs(J)+Abs(I)))Mod26),1);:NextJ:?:NextI

Try it online!

Taylor Scott
fonte
1

MY-BASIC, 89 bytes

Anonymous function that takes no input and outputs to the console.

For i=-26 To 26
For j=-25 To 25
Print Chr(65+(52-(Abs(j)+Abs(i)))Mod 26)
Next
Print;
Next

Try it online!

Taylor Scott
fonte