| Bytes | Lang | Time | Link |
|---|---|---|---|
| 089 | Ruby | 240717T163200Z | int 21h |
| 012 | Japt R | 170904T095950Z | Shaggy |
| 111 | Elixir | 210721T182737Z | Dom Hast |
| 011 | Vyxal jr | 210720T170127Z | Aaroneou |
| 137 | FALSE | 201226T193006Z | ReedsSho |
| 141 | Java 10 | 170904T110439Z | Kevin Cr |
| 139 | C++ | 170904T070459Z | HatsuPoi |
| 013 | Stax | 201207T075840Z | Razetime |
| 064 | PowerShell | 200225T205624Z | mazzy |
| 059 | PowerShell v6+ | 200225T152148Z | Veskah |
| 009 | 05AB1E | 200225T143258Z | Grimmy |
| 021 | APL Dyalog Classic | 180131T190739Z | ngn |
| 074 | Yabasic | 180131T180025Z | Taylor R |
| 160 | Visual Basic .NET Mono | 180131T062519Z | Taylor R |
| 089 | MYBASIC | 180131T062119Z | Taylor R |
| 086 | uBASIC | 180131T061911Z | Taylor R |
| 078 | VBA | 170813T180112Z | Taylor R |
| 116 | VBA Excel | 170918T101908Z | remoel |
| 019 | Recursiva | 170912T065020Z | 0xffcour |
| 166 | Retina | 170915T075543Z | Dom Hast |
| 106 | Kotlin | 170912T085306Z | jrtapsel |
| 021 | Charcoal | 170904T002253Z | totallyh |
| 051 | q/kdb+ | 170905T081901Z | mkst |
| 031 | Dyalog APL | 170904T174655Z | Adalynn |
| 221 | Common Lisp | 170813T191805Z | Renzo |
| 010 | SOGL V0.12 | 170813T092627Z | dzaima |
| 048 | J | 170813T075716Z | Jonah |
| 2119 | Pyth | 170813T032724Z | chromati |
| 011 | Jelly | 170813T061338Z | clapp |
| 293 | Racket | 161030T180233Z | rnso |
| 255 | Batch | 161025T235633Z | Neil |
| 097 | Groovy | 161027T221744Z | GolfIsAG |
| 252 | C | 161027T085710Z | qzlpnfv |
| 066 | Haskell | 161027T071119Z | Damien |
| 119 | Python 3 | 161026T220857Z | ojdo |
| 060 | Vim | 161025T204454Z | DJMcMayh |
| 096 | JavaScript ES6 | 161025T204154Z | ETHprodu |
| 129 | PHP | 161025T211839Z | Jör |
| 071 | R | 161026T075447Z | JDL |
| 077 | Perl | 161026T072651Z | Dom Hast |
| 012 | 05AB1E | 161025T203659Z | Emigna |
| 014 | MATL | 161025T211800Z | Luis Men |
| 114 | JavaScript ES6 | 161025T232354Z | darrylye |
| 085 | Python 2 | 161025T205409Z | Karl Nap |
| 076 | C | 161025T223829Z | Level Ri |
| 013 | Jelly | 161025T220448Z | miles |
| 075 | Haskell | 161025T204657Z | nimi |
| 021 | Pyke | 161025T203642Z | Blue |
Ruby, 89 bytes
a=[*?a..?z].join;v=[];u=1..-1
27.times{v<<(a=a[u]+a[0])+a.reverse[u]}
puts v+v.reverse[u]
This solution is loosely based on other answers, for instance, this one.
Japt -R, 15 12 bytes
;26ÆCé´T êÃê
;26ÆCé´T êÃê
26Æ :Map the range [0,26)
; C : Lowercase alphabet
é : Rotate right by
´T : T (initially 0) prefix decremented
ê : Palindromise
à :End map
ê :Palindromise
:Implicit output joined with newlines
Elixir, 111 bytes
import Enum
c=?a..?z
a=map 1..26,&(drop(c,&1)++slice c,0,&1)
map a++[hd a]++reverse(a),&IO.puts&1++tl reverse&1
Feel like there are some key savings I'm missing here...
Vyxal jr, 11 bytes
27ƛkaǓøm;øm
Explanation:
27ƛ ; # For each number x in range [1..27]:
ka # Lowercase alphabet
Ǔ # Rotate it left x times
øm # Mirror without duplicating middle
øm # Mirror without duplicating middle
# 'j' flag - Join top of stack with newlines and print
FALSE, 137 bytes
1c:53 0$d:[65@$0=~\1-\][@@\c;+d;1=[1_c:]?$26=[%0 1d:]?$1_=[%25]?$@+1b:51[$0=~][$26=[1_b:]?\$,b;+[$a:$64=[90a:]?91=[65a:]?a;]!\1-]#%%10,]#
Java 10, 154 153 151 148 147 142 141 bytes
v->{var r="";for(int i=0,j,d=1;i<53;d+=1-++i/27*2){for(j=d;j<26+d;)r+=(char)(j++%26+97);for(j--;j>d;)r+=(char)(--j%26+97);r+="\n";}return r;}
Port of @HatsuPointerKun C++ answer, so make sure to upvote him/her as well.
-8 bytes thanks to @ceilingcat.
-1 byte thanks to @Grimmy.
C++, 191 179 166 165 139 bytes
-12 bytes thanks to Kevin Cruijssen
-14 bytes thanks to Zacharý
-26 bytes thanks to ceilingcat
#import<cstdio>
#define C j;)putchar(97+j
main(){for(int i=0,j,d=1;i<53;d+=i++/26?-1:1){for(j=d;26+d>C++%26);for(j--;d<=--C%26);puts("");}}
PowerShell, 64 bytes
1..27+26..1|%{$y=$_
-join(0..25+24..0|%{[char](97+($_+$y)%26)})}
PowerShell v6+, 59 bytes
1..27+26..1|%{-join(('a'..'z'*3)[$_..($_+25)+($_+24)..$_])}
Ranges on ranges on ranges.
APL (Dyalog Classic), 21 bytes
(⍉⊢⍪1↓⊖)⍣2⍉1↓27 27⍴⎕a
With the alphabet (⎕a) fill in row-major order a 27x27 matrix (27 27⍴), then drop the first row (1↓) and transpose (⍉).
Do this twice (⍣2): concatenate to the bottom (⍪) of this matrix (⊢) a vertically reversed copy (⊖) without its first row (1↓) and transpose (⍉) the result.
Yabasic, 74 bytes
Now I'm telling you that this challenge BASIC. /sarcasm
For i=-26To 26
For j=-25To 25
?Chr$(65+Mod(Abs(j)+Abs(i),26));
Next
?
Next
Visual Basic .NET (Mono), 160 bytes
Declared Subroutine that takes no input and outputs to the console.
Module M
Sub Main
Dim S,I,J
For I=-26To 26
S=""
For J=-25To 25
S+=Chr(65+(52-(Math.Abs(j)+Math.Abs(i)))Mod 26)
Next
Console.WriteLine(S)
Next
End Sub
End Module
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
uBASIC, 86 bytes
0ForI=-26To26:ForJ=-25To25:?Left$(Chr$(65+(52-(Abs(J)+Abs(I)))Mod26),1);:NextJ:?:NextI
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
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
Recursiva, 44 25 21 19 bytes
{p+)'a'"Pp+J''_Q)}}
Explanation:
{p+)'a'"Pp+J''_Q)}}
{ - For each
p+)'a' - 'abc..xyzazyx..abc'
" - Iteration command begin
P - Print
p - palindromize 'cde..xyzabazyx..cde'
+ - concatenate 'cde..xyzab'
J'' - join with nothing 'cde..xyza'
_ - reverse ['cde...xyz', 'a']
Q)} - split ) at } ['a','cdef..xyz']
} - current element (say 'b' for 2nd iteration)
Retina, 166 bytes
bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb____________________________________________________
+(`([a-z]+)_(_+)
$1¶$1$2¶$1
(.)(.{24})(.)(.{24})._
$2$3$1$3$4
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()
}
Port of @Karl Napf's answer
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
q/kdb+, 51 bytes
Solution:
-1 .Q.a t{rotate[y;x]x,1_(|)x}/:(1+t),1,(-)t:(!)26;
Explanation:
Build the range of 1..26,1,0,-1..-25, feed this into a lambda that rotates the range 0..25 and indexes in at the range 0..25,24..0... Then use this to index into the lowercase alphabet.
-1 .Q.a t{rotate[y;x]x,1_reverse x}/:(1+t),1,neg t:til 26; / ungolfed
-1 ; / print to stdout and swallow return value
t:til 26 / store range of 0..25 in variable t
neg / negate (0..-25)
1, / prepend 1
(1+t), / prepend 1+t (1..26)
t{ }/: / lambda function with parameters t, and each-right
reverse x / x = t = 0..25, reversed is 25..0
1_ / 1 drop, so 24..0
x, / prepend x, so 0..25,24..0
rotate[y;x] / rotate x by y (rotate[1;"abc"] -> "bca")
.Q.a / index into alphabet at these indices
Notes:
Feels like it should be able to be golfed further, building the ranges seems clunky.
Common Lisp, 221 bytes
(let((k 26)a(s"~26{~a~}~25{~a~}~%"))(#4=dotimes(i k)(push(code-char(- 90 i))a))(let*((u(append a a a))(b(reverse u)))(#4#(i 27)(#3=format t s #1=(nthcdr(1+ i)u)#2=(nthcdr(- k i)b)))(rotatef u b)(#4#(i k)(#3#t s #2##1#))))
More readable version:
(let (a) ; variable to hold the alphabet
(dotimes (i 26) ; creation of the alphabet as list
(push (code-char (- 90 i)) a))
(let* ((u (append a a a)) ; make three copies of a
(b (reverse u))) ; reverse u
(dotimes (i 27) ; first half: form a line with two parts
(format t "~26{~a~}~25{~a~}~%" (nthcdr (1+ i) u) (nthcdr (- 26 i) b)))
(rotatef u b) ; exchange the role of u and b
(dotimes (i 26) ; second half: exchange the two parts
(format t "~26{~a~}~25{~a~}~%" (nthcdr (- 26 i) b) (nthcdr (1+ i) u)))))
SOGL V0.12, 10 bytes
zl{«:}«¹╬,
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
Pyth, 21 19 bytes
j+PKm+PJ.<Gd_JS27_K
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
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
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")
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.
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:
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.
Haskell, 67 66 bytes
unlines[[toEnum$mod(-abs j-abs i)26+97|j<-[-25..25]]|i<-[-26..26]]
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])
Vim, 62, 60 keystrokes
:se ri|h<_<cr>jjYZZPqqx$pYpq26@qdjyH:g/^/m0<cr>VP:%norm DPA<C-v><C-r>"<C-v><esc>x<cr>
Drawing on inspiration from Lynn's awesome vim answer to take the idea of stealing the alphabet from the help docs.
You can watch it happen in real time as I struggle to remember the right sequence of keystrokes!
Note that this gif is slightly outdated because it produces the wrong output, and I haven't gotten around to re-recording it yet.
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:
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
console.log(C())
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);
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.
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'
05AB1E, 13 12 bytes
A27FÀDûˆ}¯û»
Explanation
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
MATL, 14 bytes
2Y226Zv27Zv!+)
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
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
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]
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.
Jelly, 13 bytes
Øaṙ1ṭṙJ$ŒBŒḄY
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
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
Pyke, 23 22 21 bytes
GV'th+jj_t+j)K]0n'JOX
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]
