Print an alphabet wave

37

6

You are to print this exact text:

ABABABABABABABABABABABABAB
BCBCBCBCBCBCBCBCBCBCBCBCBC
CDCDCDCDCDCDCDCDCDCDCDCDCD
DEDEDEDEDEDEDEDEDEDEDEDEDE
EFEFEFEFEFEFEFEFEFEFEFEFEF
FGFGFGFGFGFGFGFGFGFGFGFGFG
GHGHGHGHGHGHGHGHGHGHGHGHGH
HIHIHIHIHIHIHIHIHIHIHIHIHI
IJIJIJIJIJIJIJIJIJIJIJIJIJ
JKJKJKJKJKJKJKJKJKJKJKJKJK
KLKLKLKLKLKLKLKLKLKLKLKLKL
LMLMLMLMLMLMLMLMLMLMLMLMLM
MNMNMNMNMNMNMNMNMNMNMNMNMN
NONONONONONONONONONONONONO
OPOPOPOPOPOPOPOPOPOPOPOPOP
PQPQPQPQPQPQPQPQPQPQPQPQPQ
QRQRQRQRQRQRQRQRQRQRQRQRQR
RSRSRSRSRSRSRSRSRSRSRSRSRS
STSTSTSTSTSTSTSTSTSTSTSTST
TUTUTUTUTUTUTUTUTUTUTUTUTU
UVUVUVUVUVUVUVUVUVUVUVUVUV
VWVWVWVWVWVWVWVWVWVWVWVWVW
WXWXWXWXWXWXWXWXWXWXWXWXWX
XYXYXYXYXYXYXYXYXYXYXYXYXY
YZYZYZYZYZYZYZYZYZYZYZYZYZ
ZAZAZAZAZAZAZAZAZAZAZAZAZA

Specs

  • You can print all lowercase instead of all uppercase. However, case must be consistent throughout the output.
  • You may print one extra trailing linefeed.

Scoring

Since this is an alphabet wave that fluctuates to a small extent, your code should also be small in terms of byte-count. In fact, the smallest code in terms of byte-count wins.

Leaky Nun

Posted 2016-08-09T23:29:18.710

Reputation: 45 011

39Seriously, another alphabet challenge? – Nathan Merrill – 2016-08-09T23:33:12.047

6@NathanMerrill As numerous as they are, I don't think they are worthy of downvotes. (I do not imply you downvoted, I am merely saying.) – Conor O'Brien – 2016-08-09T23:34:07.570

14As long as the patterns are sufficiently different, I don't think it matters if we use the alphabet, decimal digits, asterisks and underscore, etc. – Dennis – 2016-08-09T23:35:42.053

Can I use function return? – Conor O'Brien – 2016-08-09T23:37:47.007

@ConorO'Brien No, the same with the other alphabet challenges. – Leaky Nun – 2016-08-09T23:38:34.773

9@Dennis regardless of the characters used, its these type of "pattern" challenges that are getting overused, IMO. I don't think its offtopic, but I would enjoy some fresh air. – Nathan Merrill – 2016-08-09T23:40:33.203

1Merely generating the alphabet makes for overlapping code in Python for all these challenges. – xnor – 2016-08-10T01:40:10.893

13It's clear there's no more demand for alphabet challenges - only 39 people answered in the first 15 hours... – trichoplax – 2016-08-10T15:23:58.050

3These challenges instantly go HNQ and the result is a massive amount of votes for an otherwise meh challenge – Insane – 2016-08-11T18:09:52.347

@Insane If it is a meh challenge it would not have gone HNQ – Leaky Nun – 2016-08-11T18:17:34.650

6@LeakyNun Lots of meh challenges go to HNQ. The HNQ algorithm favors answers. On our site, that doesn't work so well, because the number of answers to a challenge is proportional to the triviality of the challenge. – Mego – 2016-08-12T09:15:01.567

1This might not be a Programming Puzzle, but it´s definitely Code Golf. Four answers with different approaches for some languages - I like the diversity. – Titus – 2016-11-11T17:00:41.137

Can I use a leading linebreak instead of a trailing one? – Titus – 2016-11-11T17:01:11.493

Answers

37

C, 60 bytes

main(i){for(;i<703;)putchar(i++%27?65+(i/27+i%27%2)%26:10);}

orlp

Posted 2016-08-09T23:29:18.710

Reputation: 37 067

10This is genius. – Leaky Nun – 2016-08-10T06:11:13.977

Nice to see C in a code golf challenge. – Micheal Johnson – 2016-08-11T14:03:54.993

@MichealJohnson "see C", I C what you did there. ;) And I agree with Leaky Nun. Sometimes I wonder how people come up with some of these ingenious answers. – Kevin Cruijssen – 2016-09-02T12:41:07.210

@KevinCruijssen That was unintentional lol. – Micheal Johnson – 2016-09-02T19:52:00.353

17

Brainfuck, 104 bytes

>+[+[<]>>+<+]><<+++++[>+++++>>++<<<-]>[-<+++++++++++++[->>.+.-<<]>>>.<+<]<----[>+<----]>++>>+++[-<.<.>>]

orlp

Posted 2016-08-09T23:29:18.710

Reputation: 37 067

1Practically the same size as Hello World. Impressive! – phyrfox – 2016-08-10T09:00:31.017

3

@phyrfox Actually...

– Sp3000 – 2016-08-10T12:29:58.273

14

Convex, 10 bytes

U_(+]D*zN*

Try it online!

U               Predefined Variable: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 _(+            Push a copy with the 'A at the end.
    ]           Add both strings to an array.
     D*         Repeat array 13 times. D defaults to 13.
       z        Transpose.
        N*      Join by newlines. N defaults to "\n"

GamrCorps

Posted 2016-08-09T23:29:18.710

Reputation: 7 058

9

Pyth, 11 10 bytes

jC*13.<BG1

Try it here.

        G   the alphabet
       B    bifurcate over
     .<  1  left shift by 1
  *13       repeat 13 times
 C          transpose
j           join on newlines

Doorknob

Posted 2016-08-09T23:29:18.710

Reputation: 68 138

8

Ruby, 42 39 38 37 bytes

-3 bytes thanks to @user81655
-1 byte thanks to @manatwork
-1 byte thanks to @NotthatCharles

?A.upto(?Z){|a|puts (a+a.next[0])*13}

See it on repl.it: https://repl.it/CmOJ

Jordan

Posted 2016-08-09T23:29:18.710

Reputation: 5 001

8

Vim, 85 83 bytes

:h<_<cr><cr><cr>YZZP:s/./\0\r/g<cr><c+v>ggy25Pqqlxj:let @a='xkPjj'<cr>25@akia<esc>25klq11@qh<ctrl+v>25jylpl<c+v>25jdGdd

I know this can be golfed more, but my head hurts so I gotta stop for now.

<cr> is the enter key, <c+v> is ctrl+v, and <esc> is the escape key. Those were all counted as one byte.

I recorded a gif of this, but it got screwed up. The video is fine though: http://recordit.co/ldLKvho9Gi

addison

Posted 2016-08-09T23:29:18.710

Reputation: 993

7

Cheddar, 48 bytes

print(65|>90).map(l->@"[l,l>89?65:l+1]*13).vfuse

Cheddar is good with strings :D

Try it online!

Explanation

print
  (65|>90)            // Range from 65 (A) to 90 (Z)
  .map(l->            // Map through range
    @"                // Convert following array of char codes to string
      [l,             // The character 
       l>89?65:l+1]   // See below for explanation
      *13             // Repeat 13 times
  ).vfuse             // Vertically fuse

What does l>89?65:l+1 do? Well 89 is the char code for Y. Basically, l>89 is checking if the letter is Z, that means we should be returning A. If l>89 is false. I'll return l+1, the next char

Downgoat

Posted 2016-08-09T23:29:18.710

Reputation: 27 116

I thought you can insert @" between them. – Leaky Nun – 2016-08-09T23:45:28.573

Doesn't this use a function return? – Conor O'Brien – 2016-08-09T23:46:36.867

@ConorO'Brien yeah? – Downgoat – 2016-08-09T23:47:20.297

@ConorO'Brien oh, didn't see in challenge spec. will fix – Downgoat – 2016-08-09T23:48:10.030

@Downgoat it isn't in spec >_< just in comments – Conor O'Brien – 2016-08-09T23:48:44.787

7

Haskell, 60 58 bytes

mapM putStrLn[[0..12]>>[a,b]|a:b:_<-scanr(:)"A"['A'..'Z']]

Starting with "A" scanr(:) builds the a list from the chars of ['A'..'Z'] from the right. (-> ["ABCDE...A", "BCDEF..A", ..., "XYZA", "YZA", "ZA", "A"]). (a:b:_) matches the first two chars of each sublists (with at least two chars) and makes 13 copies of it.

nimi

Posted 2016-08-09T23:29:18.710

Reputation: 34 639

Considering some of the cheats used by other languages on a regular basis I consider it only fair to not include the actual printing. In this case you could replace it with "(++"\n")=<<" and save 2 bytes. Possibly more. – MarLinn – 2016-08-11T05:44:57.303

@MarLinn: No, I don't think so. Golfing languages are designed with implicit printing in mind and most other answers do have some sort of printing command. Btw, unlines is even shorter than (++"\n")=<<. – nimi – 2016-08-11T15:37:54.143

7

Jelly, 10 bytes

26ḶḂØAṙZj⁷

Try it online!

How it works

26ḶḂØAṙZj⁷  Main link. No arguments.

26Ḷ         Yield [0, ..., 25].
   Ḃ        Bit; compute the parity of each intger.
    ØAṙ     Rotate the alphabet by these amounts.
       Z    Zip; transpose rows and columns.
        j⁷  Join, separating by linefeeds.

Dennis

Posted 2016-08-09T23:29:18.710

Reputation: 196 637

Didn't Y exist back then? Also congrats for 100k rep!! – Erik the Outgolfer – 2016-09-30T15:46:27.090

Thanks! I checked and, sadly, Y was added two days after the challenge was posted. – Dennis – 2016-09-30T15:50:03.503

Because you could have golfed it further down to 26ḶḂØAṙZY. But, as it is right now, it's still good. – Erik the Outgolfer – 2016-09-30T15:51:32.350

7

PowerShell, 49 43 bytes

TimmyD's remix:

65..89|%{-join[char[]]($_,++$_)*13};"ZA"*13

was, 49 bytes:

0..25|%{(""+[char]($_+++65)+[char]($_%26+65))*13}

Example output

TessellatingHeckler

Posted 2016-08-09T23:29:18.710

Reputation: 2 412

6

Python 2, 70 68 54 bytes

List based solution:

L=map(chr,range(65,91))
for i in range(-26,0):print(L[i]+L[i+1])*13

But why create a list? Thanks LeakyNun:

for i in range(26):print(chr(i+65)+chr(-~i%26+65))*13

Karl Napf

Posted 2016-08-09T23:29:18.710

Reputation: 4 131

6

R, 72 67 60 56 bytes

write(matrix(LETTERS[c(1:26,2:26,1)],26,26,T),"",26,,"")

Thanks to @Giuseppe for the extra 4 bytes off!

Old rep-based solution at 60 bytes:

for(i in 1:26)cat(rep(LETTERS[c(i,i%%26+1)],13),"\n",sep="")

See here on an online interpreter. Thanks to @user5957401 for the extra 7 bytes off!

Old matrix-based solution at 72 bytes:

for(i in 1:26)cat(matrix(LETTERS[c(1:26,2:26,1)],26,26)[i,],"\n",sep="")

See here on an online interpreter.

plannapus

Posted 2016-08-09T23:29:18.710

Reputation: 8 610

1if you change the indext to i in 1:26 and then the letter selection to LETTERS[c(i,i%%26+1)] you can drop like 6 or 7 bytes – user5957401 – 2016-08-10T13:07:29.577

1@user5957401 arf I was so stubbornly doing (i+1)%%26 that it didn't occur to me to do the opposite! Thanks! – plannapus – 2016-08-10T13:54:56.840

156 bytes using matrices again :) – Giuseppe – 2017-09-13T18:23:02.443

5

Perl, 26 bytes

Solution from @Dom Hastings. (12 bytes shorter than mine!)
-1 byte thanks to @Ton Hospel

say+($_++,chop)x13for A..Z

Run with -M5.010 or -E :

perl -E 'say+($_++,chop)x13for A..Z'

Dada

Posted 2016-08-09T23:29:18.710

Reputation: 8 279

Managed to get this down to 33: say+($_++,$_--=~/^./g)x13for A..Z, but I'm sure there's a way to get a shorter one from: say+($_++,$_--)x13for A..Z... – Dom Hastings – 2016-08-10T07:36:44.460

Not sure why I have the -- in there, it's not needed! O_o. 27: say+($_++,/^./g)x13for A..Z – Dom Hastings – 2016-08-10T07:52:37.103

@DomHastings Nicely done! I tried say+($_,$_++)x13for A..Z at first which didn't work, but it seems I should have push further into that direction! – Dada – 2016-08-10T10:42:02.750

1say+($_++,chop)x13for A..Z saves one more byte – Ton Hospel – 2016-08-10T14:59:01.093

@TonHospel great, thanks for that. – Dada – 2016-08-10T15:17:06.703

5

MATL, 13 bytes

1Y2tn:!to~!+)

Try it online!

1Y2    % Predefined string literal: 'AB···Z'
tn:    % Duplicate, number of elements, range: gives [1, 2, ···, 26]
!      % Transpose into a column vector
to~!   % Duplicate and transform into [0, 1, 0, 1, ···, 1] using modulo 2
+      % Addition with broadcast. Gives 2D numeric array
)      % Index (modularly) into string. Implicitly display.

Luis Mendo

Posted 2016-08-09T23:29:18.710

Reputation: 87 464

5

Jellyfish, 26 bytes

P
+'A
~
| S
+$ r2
 ,'
r'

Note the trailing unprintable characters on the last two lines. Try it online!

Explanation

This is basically an arithmetic manipulation approach: make a 26×26 grid with alternating 0-1 pattern, add the index of each row to every element of the row, reduce mod 26, and add the ASCII value of A. Characters in Jellyfish are just numbers with a special flag, and all arithmetic works on them as expected.

From bottom to top:

  • The 's are character literals; they are followed by unprintables with ASCII code 26, and stand for those characters.
  • The lower r computes the character range from 0 to 25.
  • The , forms a pair from the two unprintable chars.
  • The higher r is given argument 2, and forms the range [0 1].
  • The $ takes that range, and reshapes it into the shape given by its other argument, which is the pair of unprintables. This gives a 26×26 matrix of alternating rows 0 1 0 1 0 1 ...
  • The lower + adds the char range 0-25 to this matrix. The addition distributes on the rows, so row i is incremented by i. It's also converted to a char matrix, since the south argument consists of chars.
  • The ~| is modulus with flipped arguments: the south argument (the above char matrix) is reduced modulo the east argument (the S turns the argument-seeking process south, so this is the unprintable literal 26).
  • The higher + adds the literal A to every coordinate of the resulting matrix.
  • The P prints the result in matrix format, that is, each row on its own line without quotes.

Zgarb

Posted 2016-08-09T23:29:18.710

Reputation: 39 083

1I wanted to try to golf but then I saw the name of him who wrote the code. – Leaky Nun – 2016-08-10T08:04:42.277

@LeakyNun You can still try! Although 26 bytes is fitting for this challenge. – Zgarb – 2016-08-10T08:26:26.280

5

T-SQL 133 Bytes (Golfed by : @t-clausen.dk)

SELECT REPLICATE(Char(number+65)+IIF(number=25,'A',Char(number+66)),13)FROM spt_values WHERE number<26and'P'=TYPE

T-SQL , 151 Bytes

Using CTE to generate sequence of number

;WITH n(a,v) AS(SELECT CHAR(65)+CHAR(66), 66 UNION ALL SELECT CHAR(v)+CHAR(v+1), v+1 FROM n WHERE v < 91)SELECT REPLICATE(REPLACE(a,'[','A'),13) FROM n

T-SQL, 155 Bytes

SELECT REPLICATE(Char(number+65)+ CASE WHEN number=25 THEN 'A' ELSE Char(number+66) END, 13) FROM master.dbo.spt_values  WHERE name IS NULL AND number < 26

Anuj Tripathi

Posted 2016-08-09T23:29:18.710

Reputation: 211

I have golfed your answer down to 113 characters. I provided a very different answer in TSQL

– t-clausen.dk – 2016-08-10T15:00:17.730

@t-Clausen.dk That is excellent. Please post your answer. I would delete mine. – Anuj Tripathi – 2016-08-10T16:24:34.000

no reason to delete your answer, you can just use my fiddle to improve your answer. I already posted 1 hour ago ago, if you enjoy TSQL , you should take a look at my other answers. I made Fiddles for most of them – t-clausen.dk – 2016-08-10T16:38:46.663

5

Vim, 31 bytes

:h<_↵↵↵YZZPJra0qqy2l13Plr↵25@qD

Where is the Return key.

enter image description here

Lynn

Posted 2016-08-09T23:29:18.710

Reputation: 55 648

4

Julia, 46 bytes

[println("$c$(c+1-26(c>89))"^13)for c='A':'Z']

Try it online!

Dennis

Posted 2016-08-09T23:29:18.710

Reputation: 196 637

4

Pyth, 10 bytes

jCm.<G~!ZG

Demonstration

Explanation:

jCm.<G~!ZG
  m      G    Map over G, predefined to the lowercase alphabet.
              This will give 26 columns.
   .<G        Left shift (cyclically) G by
        Z     Z elements. Z is initialized to 0.
      ~!      After using its value, logical not Z. (0 -> 1, 1 -> 0)
 C            Transpose
j             Join on newlines

isaacg

Posted 2016-08-09T23:29:18.710

Reputation: 39 268

Nice, wish I knew as much as you do about Pyth – Stan Strum – 2017-09-13T18:19:14.870

4

Brainfuck, 88 86 bytes

++[[+>]<+<++]+>-[[->+>+<<]>>-]++++++++[<[++++++++<+<]>[>]<-]<<++<[>+++[->.<<.>]<<++.<]

Requires an interpreter with 8-bit cells and a tape not bounded on the left. Try it online!

Sp3000

Posted 2016-08-09T23:29:18.710

Reputation: 58 729

3

Lua, 80 65 Bytes.

s = string c = s.char for i=1,26 do print(s.rep(c(64+i)..c((65+(i%26))),13)) end

With help from Leaky Nun

c=("").char for i=1,26 do print((c(64+i)..c(65+i%26)):rep(13))end

Lua is a pretty inefficent language in regards to handling of strings and such, so this is the best I can narrow it down.

ATaco

Posted 2016-08-09T23:29:18.710

Reputation: 7 898

Welcome to PPCG! Nice first post! You can save 5 bytes if you remove some unnecessary whitespace: s=string c=s.char for i=1,26 do print(s.rep(c(64+i)..c((65+(i%26))),13))end – GamrCorps – 2016-08-10T03:23:59.007

for i=1,26 do print(((64+i):char()..(65+(i%26)):char()):rep(13))end (not tested) – Leaky Nun – 2016-08-10T03:27:48.087

Because string.rep(x,13) is basically x:rep(13) – Leaky Nun – 2016-08-10T03:28:20.480

Right! I forgot the string metatable defaultly indexes to the string library. – ATaco – 2016-08-10T05:42:25.783

Although good, numbers such as 65+(i%26) don't count as strings unless stored as such. I'll work on a way to make that work for the hell of it. – ATaco – 2016-08-10T05:46:20.700

3

Brachylog, 30 24 20 bytes

@Ab:"a"c:@Arz:{:12jc:@Nc.}a:wa
@Ab:"a"c:@Arze:12jcw@Nw\
@A$(:@Arze:12jcw@Nw\

Try it online!

Leaky Nun

Posted 2016-08-09T23:29:18.710

Reputation: 45 011

3

05AB1E, 12 bytes

ADÀ)øvyJ5Ø×,

Explanation

AD            # push 2 copies of the alphabet
  À           # rotate the 2nd one left by 1
   )ø         # add to list and zip
     v        # for each
      yJ      # join the pair
        5Ø×   # repeat it 13 times
           ,  # print with newline

Try it online

Emigna

Posted 2016-08-09T23:29:18.710

Reputation: 50 798

I know this is an old question but i just can't help myself. ADÀ)ø13×» works as well with 9 bytes. – Datboi – 2017-06-14T20:09:25.973

@Datboi: That does indeed work now, but unfortunately it didn't work at the time this question was posted :( – Emigna – 2017-06-15T07:32:36.577

3

TSQL, 111 bytes

DECLARE @o varchar(702)='',@ int=1WHILE @<702SELECT @o+=CHAR(IIF(@%27=0,10,65+(@/27+1-@%27%2)%26)),@+=1PRINT @o

Fiddle

t-clausen.dk

Posted 2016-08-09T23:29:18.710

Reputation: 2 874

Golfed even further to 99 bytes http://codegolf.stackexchange.com/a/90659/58577

– S.Karras – 2016-08-29T07:53:06.903

3

Mathematica, 82 75 67 66 bytes

Print@FromCharacterCode@PadLeft[{},26,{i-1,i}~Mod~26+65]~Do~{i,26}

Technically shorter, although it prints in lowercase instead of uppercase:

Mathematica, 64 bytes

Print[""<>FromLetterNumber@Table[{i-1,i}~Mod~26+1,13]]~Do~{i,26}

Michael Lee

Posted 2016-08-09T23:29:18.710

Reputation: 221

1Nice trick using PadLeft. – Leaky Nun – 2016-08-11T02:43:42.607

1

Common Lisp, SBCL, 86 bytes

(dotimes(i 26)(format t"~13@{~a~:*~}~%"(subseq"ABCDEFGHIJKLMNOPQRSTUVWXYZA"i(+ i 2))))

Explanation

(dotimes(i 26);loop from i=0 to i=25
(format t"~13@{~a~:*~}~%"(subseq"ABCDEFGHIJKLMNOPQRSTUVWXYZA"i(+ i 2))))
;print 13 times pairs of "AB", "BC", ... , "ZA"

user65167

Posted 2016-08-09T23:29:18.710

Reputation:

1

c64 basic v2, 95 93 85 83 77 bytes

0fOy=65to90:l$="":a$=cH(y)+cH(y+1+(y=90)*26)
1fOx=0to12:l$=l$+a$:nE:?l$:nE

Screenshot:

enter image description here

Trial instructions are in my previous answer.

peterh - Reinstate Monica

Posted 2016-08-09T23:29:18.710

Reputation: 347

can you switch out 0..25 for 65..90 in the first line? e.g. 0fOy=65to90:l$="":a$=chr$(y):b$=chr$(1+y):ify=90tHb$="a" for -3 bytes? – streetster – 2017-09-13T21:25:10.333

1@streetster Thanks! And I switched to conditional operator to avoid the if-then! :-) It is already 85. Screenshot follows. – peterh - Reinstate Monica – 2017-09-13T21:34:05.733

1

SOGL V0.12, 8 bytes

Z«Z¹'⁰∙I

Try it Here!

Explanation:

Z         push the uppercase alphabet
 «        put its first letter at the end
  Z       push the alphabet once again
   ¹      wrap in array: ["BCDEFGHIJKLMNOPQRSTUVWXYZA", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
    '⁰∙   multiply vertically 13 times
       I  rotate clockwise

dzaima

Posted 2016-08-09T23:29:18.710

Reputation: 19 048

1

Bash, 64 bytes

f()(tr A-Z B-ZA|tee >(((i++<25))&&f);echo)
printf ZA%.s {a..m}|f

Credit to seshoumara's sed answer for the idea of translating A-Z to B-ZA.

Try it online!

Justin Mariner

Posted 2016-08-09T23:29:18.710

Reputation: 4 746

1

JavaScript (ES6), 88 83 bytes

_=>[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ"].map((c,i,a)=>(c+a[-~i%26]).repeat(13)).join`\n`

Where \n represents the literal newline character. Writing the alphabet out saved me three bytes today, but @LeakyNun saved me another five bytes.

Neil

Posted 2016-08-09T23:29:18.710

Reputation: 95 035

1Did it save you four bytes yesterday? – Leaky Nun – 2016-08-10T00:51:44.577

1_=>[...s="ABCDEFGHIJKLMNOPQRSTUVWXYZ"].map((c,i)=>(c+s[-~i%26]).repeat(13)).join\\n`` – Leaky Nun – 2016-08-10T00:52:32.203

@LeakyNun No, just two, I'm afraid: http://codegolf.stackexchange.com/a/89297/17602

– Neil – 2016-08-10T07:57:27.783

2The (c,i,a) is watching you. – gcampbell – 2016-08-10T08:18:22.970

1

J, 20 19 bytes

1 byte thanks to miles.

u:65+26|(+/2&|)i.26

Online interpreter

This is actually the program I used to generate the text in the challenge.

Leaky Nun

Posted 2016-08-09T23:29:18.710

Reputation: 45 011

You can remove the @ – miles – 2016-08-10T11:01:51.693

1

Oracle SQL 11.2, 141 138 bytes

SELECT LISTAGG(CHR(l+64)||CHR(MOD(l,26)+65))WITHIN GROUP(ORDER BY l)FROM(SELECT CEIL(LEVEL/13)l FROM DUAL CONNECT BY LEVEL<339)GROUP BY l;

Un-golfed

SELECT LISTAGG(CHR(l+64)||CHR(MOD(l,26)+65))WITHIN GROUP(ORDER BY l)
FROM   (
         SELECT CEIL(LEVEL/13)l 
         FROM   DUAL 
         CONNECT BY LEVEL<339  -- 26*13+1
       )
GROUP BY l                               

Jeto

Posted 2016-08-09T23:29:18.710

Reputation: 1 601

1

MATLAB, 47 38 bytes

a=(65:90)';char(repmat([a a([2:end 1])],1,13))

char(repmat([65:90;[66:90 65]]',1,13))

The first makes a column array of the alphabet in ASCII, appends a shifted copy as a column to its right, replicates the resulting 26*2 array 13 times columnwise, casts to a character array and prints by default.

The second makes a 2*26 array of alphabet and shifted alphabet, transposes it then continues as above.

user58384

Posted 2016-08-09T23:29:18.710

Reputation: 11

You can save one byte using [... ''] instead of char(...). – pajonk – 2016-08-10T15:56:58.990

And you can use simply [65:90;66:90 65] saving two bytes. – pajonk – 2016-08-10T16:02:56.227

1

Neoscript, 59 bytes

a=('A:[]:'Z)+'Aeach n=0:[]:25console:log((a[n]+a[n+1])*13);

TuxCrafting

Posted 2016-08-09T23:29:18.710

Reputation: 4 547

1

PHP, 102 bytes

<?php $a='ABCDEFGHIJKLMNOPQRSTUVWXYZA';$i=-1;while($i++<25){echo str_repeat(substr($a,$i,2),13)."\n";}

gabe3886

Posted 2016-08-09T23:29:18.710

Reputation: 221

You can remove the quotes from the Alphabet string. Replace \n with an actual enter instead of \n. Stole that idea from @insertusernamehere. So check his answer for what I mean. Edit: Also use the short-tag notation <?. You also do not need a space after <?. So <?$a='ABC' also works. – Jeroen – 2016-08-15T10:40:49.930

1

Ruby, 41 bytes

26.times{|i|puts [*?A..?Z,?A][i,2]*''*13}

daniero

Posted 2016-08-09T23:29:18.710

Reputation: 17 193

1

C (86 bytes):

for(int c=-11,n=-26;++n<1;){while(c++){printf("%c%c",90+n,n?91+n:65);}c=-11;puts("");}

My first attempt on a Code Golf challenge.

Some answers are really impressive!

IanC

Posted 2016-08-09T23:29:18.710

Reputation: 111

1

PHP, 65 bytes

Well, this is pretty straight forward:

for(;$i<26;)echo str_repeat(chr(65+$i).chr(65+(++$i%26)),13)."
";

insertusernamehere

Posted 2016-08-09T23:29:18.710

Reputation: 4 551

1

C#, 107 bytes

My first attempt at a submission to PPCG

Golfed:

var l="";int i=0,j=0;for(;i<26;i++){for(;j<26;j++)l+=(char)(((j%2)+i)%26+65);Console.WriteLine(l);l="";j=0;}

Ungolfed:

var l="";
int i=0,j=0;
for(;i<26;i++){
    for(;j<26;j++)l+=(char)(((j%2)+i)%26+65);
        Console.WriteLine(l);
    l="";j=0;
}

Pretty sure this adheres to standards! Would love to hear any potential improvements.

RobotZebra

Posted 2016-08-09T23:29:18.710

Reputation: 11

1

Java 7, 87 bytes

void c(){for(int i=0;i<703;)System.out.print((char)(i++%27>0?65+(i/27+i%27%2)%26:10));}

Based on @orlp's amazing answer.

Ungolfed & test code:

Try it here.

class Main {
  public static void main(String[]a){
    c();
  }

  static void c(){
    for(int i=0; i<703;){
        System.out.print((char)(i++%27 > 0
                                  ? 65 + (i/27+i%27%2)%26
                                  :10));
    }
  }
}

Kevin Cruijssen

Posted 2016-08-09T23:29:18.710

Reputation: 67 575

1

T-SQL 99 90 bytes

Saved 9 bytes thanks to @t-clausen.dk

DECLARE @ INT=65z:PRINT REPLICATE(CHAR(@)+CHAR(IIF(@=90,65,@+1)),13)SET @+=1IF @<=90GOTO z

Ungolfed:

DECLARE @CurrCharacter INT = 65; --ASCII decimal for 'A'
WHILE (@CurrCharacter <=90) --ASCII decimal for 'Z'
BEGIN 
   PRINT REPLICATE(
    REPLACE(CHAR(@CurrCharacter)+CHAR(@CurrCharacter+1),'[','A')
    ,13); --Replicate the current character and its neighbor 13 times. If the neighbor is '[' (ASCII code 91) then replace it with 'A'.
   SET @CurrCharacter+=1; --Go to the next letter
END

S.Karras

Posted 2016-08-09T23:29:18.710

Reputation: 241

That is very nice, you can save another 9 bytes like this

– t-clausen.dk – 2016-08-29T09:16:00.880

1

Python 2 53 bytes

i=0;exec'print(chr(i+65)+chr(-~i%26+65))*13;i+=1;'*26

ospahiu

Posted 2016-08-09T23:29:18.710

Reputation: 231

0

Javascript, 98 Bytes

for(var j=371,s="";j<1333;j+=37){for(i=0;i<13;i++)s+=j.toString(36).replace("100","za");s+="<br>"}

Try it here

Spydercrawler

Posted 2016-08-09T23:29:18.710

Reputation: 61

1Is that a typo? This doesn't look like 12 bytes to me. (I think it's 98 bytes.) – Mitchell Spector – 2017-02-17T04:02:36.320

0

tcl, 80

time {puts [string repe [format %c%c [expr [incr i]+64] [expr $i%26+65]] 13]} 26

demo


tcl, 86

while {[incr i]<27} {puts [string repe [format %c%c [expr $i+64] [expr $i%26+65]] 13]}

demo

sergiol

Posted 2016-08-09T23:29:18.710

Reputation: 3 055

0

Bash + Unix utilities, 53 52 bytes

dc "-e65[d257*1+16 52^65535/*POP1+d91>x]dsxx"|tr [ A

Try it online!

Test run:

dc "-e65[d257*1+16 52^65535/*POP1+d91>x]dsxx"|tr [ A
ABABABABABABABABABABABABAB
BCBCBCBCBCBCBCBCBCBCBCBCBC
CDCDCDCDCDCDCDCDCDCDCDCDCD
DEDEDEDEDEDEDEDEDEDEDEDEDE
EFEFEFEFEFEFEFEFEFEFEFEFEF
FGFGFGFGFGFGFGFGFGFGFGFGFG
GHGHGHGHGHGHGHGHGHGHGHGHGH
HIHIHIHIHIHIHIHIHIHIHIHIHI
IJIJIJIJIJIJIJIJIJIJIJIJIJ
JKJKJKJKJKJKJKJKJKJKJKJKJK
KLKLKLKLKLKLKLKLKLKLKLKLKL
LMLMLMLMLMLMLMLMLMLMLMLMLM
MNMNMNMNMNMNMNMNMNMNMNMNMN
NONONONONONONONONONONONONO
OPOPOPOPOPOPOPOPOPOPOPOPOP
PQPQPQPQPQPQPQPQPQPQPQPQPQ
QRQRQRQRQRQRQRQRQRQRQRQRQR
RSRSRSRSRSRSRSRSRSRSRSRSRS
STSTSTSTSTSTSTSTSTSTSTSTST
TUTUTUTUTUTUTUTUTUTUTUTUTU
UVUVUVUVUVUVUVUVUVUVUVUVUV
VWVWVWVWVWVWVWVWVWVWVWVWVW
WXWXWXWXWXWXWXWXWXWXWXWXWX
XYXYXYXYXYXYXYXYXYXYXYXYXY
YZYZYZYZYZYZYZYZYZYZYZYZYZ
ZAZAZAZAZAZAZAZAZAZAZAZAZA

Mitchell Spector

Posted 2016-08-09T23:29:18.710

Reputation: 3 392

0

Windows batch, 155 bytes

@set s=ABCDEFGHIJKLMNOPQRSTUVWXYZA
@set/ac=-1
:L
@set/ac+=1
@call set t=%%s:~%c%,2%%
@for /l %%i in (1,1,13) do @cd|set/p=%t%
@echo(
@if %t% neq ZA @goto l

stevefestl

Posted 2016-08-09T23:29:18.710

Reputation: 539

0

Excel VBA, 50 Bytes

Anonymous VBE immediate window function that takes no input and outputs a wave to the range [A1:Z26] on the ActiveSheet object

[A1:Z26]="=Char(Mod(Row()+IsEven(Column()),26)+64)

Taylor Scott

Posted 2016-08-09T23:29:18.710

Reputation: 6 709

0

Recursiva, 19 bytes

{B26'P*13Z~}+(C65;}

Try it online!

officialaimm

Posted 2016-08-09T23:29:18.710

Reputation: 2 739

0

Pyth, 12 bytes

I haven't been there

VG*13+N@G=hZ

Explanation:

VG       In the lowercase alphabet...
  *13     13 times...
  +N@G=hZ The current item concatenated with alphabet[++Z]

Try it online!

Stan Strum

Posted 2016-08-09T23:29:18.710

Reputation: 436

0

K (oK), 23 bytes

Solution:

`c$65+26#'a,'1_27#a:!26

Try it online!

Explanation:

`c$65+26#'a,'1_27#a:!26 / solution
                    !26 / range 0..25
                  a:    / save as 'a'
               27#      / 27 take, wraps to make ABC...XYZA
             1_         / 1 drop, take off leading A
          a,'           / concatenate each element with each of a (AB,BC,etc)
      26#'              / 26 take each, wraps to get ABABAB... BCBCBC... etc
   65+                  / add 65, vectorised (65=A in ASCII)
`c$                     / cast to characters

Bonus:

Here are a couple of other ways to get the result:

24 chars: Try it online!

`c$65++26#(!26;1_27#!26)

27 chars: Try it online!

26#'+0 1_'26 27#\:`c$65+!26

streetster

Posted 2016-08-09T23:29:18.710

Reputation: 3 635

0

q/kdb+, 19 bytes

Solution:

26#'.Q.A,'1_27#.Q.A

Explanation:

Shorter and different to my oK solutions as we have a shortcut to the uppercase alphabet by means of .Q.A. As always, interpreted right-to-left

26#'.Q.A,'1_27#.Q.A / solution
               .Q.A / shortcut to uppercase alphabet, ABC..XYZ
            27#     / 27 take, wraps to get ABC...XYZA
          1_        / 1 drop, drop first element to give BCD...XYZA
    .Q.A,'          / concatenate each left/right lists, so AB, BC, CD etc
26#'                / 26 take each, gives ABABA.. BCBCB... etc

streetster

Posted 2016-08-09T23:29:18.710

Reputation: 3 635

0

Mathematica, 52 bytes

Column[""<>#~Table~13&/@Partition[Alphabet[],2,1,1]]

-1 byte from Martin Ender

J42161217

Posted 2016-08-09T23:29:18.710

Reputation: 15 931

Infix notation for Table saves a byte. – Martin Ender – 2017-11-30T14:41:19.217

0

Yabasic, 69 bytes

For I=1To 26
For J=0To 12
?Chr$(I+64)+Chr$(Mod(I,26)+65);
Next
?
Next

Try it online!

Taylor Scott

Posted 2016-08-09T23:29:18.710

Reputation: 6 709

0

Visual Basic .NET (Mono), 140 bytes

Module M
Sub Main
Dim I,J,S
For I=1To 26
S=""
For J=0To 11
S+=Chr$(I+64)+Chr$(I Mod 26+65)
Next
Console.WriteLine(S)
Next
End Sub
End Module

Try it online!

Taylor Scott

Posted 2016-08-09T23:29:18.710

Reputation: 6 709

0

MY-BASIC, 77 bytes

For I=1 To 26
For J=0 To 12
Print Chr(I+64)+Chr(I Mod 26+65)
Next
Print;
Next

Try it online!

Taylor Scott

Posted 2016-08-09T23:29:18.710

Reputation: 6 709

0

uBASIC, 83 bytes

0ForI=1To26:ForJ=0To12:?Left$(Chr$(I+64),1)+Left$(Chr$(IMod26+65),1);:NextJ:?:NextI

Try it online!

Taylor Scott

Posted 2016-08-09T23:29:18.710

Reputation: 6 709

0

APL (Dyalog Unicode), 13 bytesSBCS

⍉(⎕a⌽⍨2|⊢)⌸⎕a

Try it online!

ngn

Posted 2016-08-09T23:29:18.710

Reputation: 11 449

0

Julia, 51 bytes

!()=join(["$x$(x+1-26(x>89))"^13for x='A':'Z'],"
")

Initial golfing.

Mama Fun Roll

Posted 2016-08-09T23:29:18.710

Reputation: 7 234

0

C, 77 74 71 bytes

Basically the same as the Python answer inspired by LeakyNun, Thanks to owacoder for puts :

f(i,j){for(i=0;++i<27;puts(""))for(j=13;--j;printf("%c%c",i+64,i%26+65));}

Usage:

f();

While mathematically (26-n)%26 == (-n)%26, this is not true for C, otherwise these two bytes can be shaved off. Using a count up loop for i resolves the problem

Karl Napf

Posted 2016-08-09T23:29:18.710

Reputation: 4 131

You can save two bytes by counting from 64: f(i,j){for(i=64;++i<91;printf("\n"))for(j=13;--j;printf("%c%c",i,i%91+65));} – None – 2016-08-10T08:33:51.680

Use puts("") instead of printf("\n") for printing a newline. – owacoder – 2016-08-10T12:30:56.487

@Advancid no you can't. that i%95 does not work – Karl Napf – 2016-08-10T15:39:37.047

@owacoder Ah, good old puts. Only had putchar in mind. – Karl Napf – 2016-08-10T15:40:40.513

0

Java 8, 139 137 bytes

()->{for(int i=65,j=1;;j++){if(j>25){j=++i<91?1:0;System.out.println();
if(j==0)break;}System.out.print((char)i+""+(char)(i>89?65:i+1));}}

CoderCroc

Posted 2016-08-09T23:29:18.710

Reputation: 337

1chaning j==26 to j>25 allow you to save 1 byte. using multiple print statements when you are golfing in java cost you badly, and you could refactor it to use single print statement – user902383 – 2016-08-10T15:25:22.813

0

Javascript(ES5), 107 99 bytes

for(var s="",i=-1;++i<676;)i&&!(i%26)&&(s+="\n"),s+=String.fromCharCode((i/26+i%2)%26+65);alert(s);

ajxs

Posted 2016-08-09T23:29:18.710

Reputation: 141

console.log => alert. – NoOneIsHere – 2016-08-10T21:27:40.747

Thanks for pointing that out! Made another small change as well. This is the part I'd really like to change "i&&!(i%26)", surely there's a better way of doing both checks here at once, or at least in a more concise way! I'd love any suggestions here! – ajxs – 2016-08-10T22:08:59.870

0

RETURN, 23 bytes

'A'[␊'B'[␊'A␈13␋␄'␊°␇␂,

Try it here.

NOTE: Use the "Insert String" button and paste the above code in.

Explanation

Basically generates A-Z and B-Z and A at the end on the stack. Then the stack is duplicated 13 times, transposed, joined with a newline, and outputted.

Due to a bug that I just can't fix, 'A'[␊${25@}13␋␄'␊°␇␂, does not work.

Mama Fun Roll

Posted 2016-08-09T23:29:18.710

Reputation: 7 234

A language using instead of a literal newline is weird... – Erik the Outgolfer – 2016-09-30T16:01:49.013

No, I'm just putting it there to avoid confusion; newlines are range commands, so having ␊ there emphasizes that. It's the same with the other unprintables. – Mama Fun Roll – 2016-10-01T13:57:12.010

0

C# - 159 138 bytes

var a="ABCDEFGHIJKLMNOPQRSTUVWXYZA";for(int i=0;i<26;i++){for(int j=0;j<14;j++){Console.Write("{0}{1}",a[i],a[i+1]);}Console.WriteLine();}

aphariel

Posted 2016-08-09T23:29:18.710

Reputation: 11

If you add A at the end of the alphabet you can change (i+1)%26 to i+1 – Emigna – 2016-08-10T14:49:06.720

The alphabet can also be var and you don't need the .ToCharArray() as a string is already just that. – Emigna – 2016-08-10T14:53:57.397

Oh, thank you! This was my first time code golfing, so I'm happy to learn more. – aphariel – 2016-08-10T14:56:24.687

Creating the row in a variable and replacing the inner for with a while saves at least 13 additional bytes. – Emigna – 2016-08-10T15:08:23.450

You can save a few bytes by using string interpolation like this: Console.Write($"{a[i]}{a[i+1]}") which makes it 135 bytes – Jamie Rees – 2016-08-10T15:42:19.567

0

Javascript (using external library Enumerable) (84 bytes)

    n=>(w=_.Range(0,26)).WriteLine(x=>w.Write("",y=>String.fromCharCode((x+y%2)%26+65)))

Link to lib: https://github.com/mvegh1/Enumerable/

Code explanation: Create a range of ints starting at 0 for count of 26. Store into global variable w. For each, write a new line according to predicate. Predicate states to take "w" and write a joined string based off the passed predicate to Write. Predicate to Write uses an empty string as the join delimiter, and uses the current integer value from WriteLine ("x") and the current integer value from Write ("y") to calculate the correct string at that position

Edit: Removed extra parens to save 2 bytes

enter image description here

applejacks01

Posted 2016-08-09T23:29:18.710

Reputation: 989

0

JAVA 9, 103 97 bytes

it works on JShell, provided by Java9 SDK.

for(int c=64,i;++c<91;)for(i=0;i<26;)System.out.print((char)((c-13+i%2)%26+65)+(i++<25?"":"\n"))

user902383

Posted 2016-08-09T23:29:18.710

Reputation: 1 360

0

Pyke, 13 bytes

GGt\a+]w-*,_X

Try it here!

Blue

Posted 2016-08-09T23:29:18.710

Reputation: 26 661

0

ListSharp, 236 bytes

ROWS x=ROWSPLIT "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,T,S,U,V,W,X,Y,Z,A" BY [","]
[FOREACH NUMB IN 1 TO 26 AS i]
{
STRG t =""
[FOREACH NUMB IN 1 TO 13 AS j]
{
STRG e=GETLINE x [i]
STRG r=GETLINE x [i+1]
STRG t=t+e+r
}
ROWS s=s+t
}
SHOW=s

Feel free to comment if you want anything to be explained to you

Execution screenshot: Execution screenshot

downrep_nation

Posted 2016-08-09T23:29:18.710

Reputation: 1 152

0

Perl 6, 50 bytes

say .join x 13 for flat('A'..'Z','A').rotor(2=>-1)

Joshua

Posted 2016-08-09T23:29:18.710

Reputation: 261

0

EXCEL: 53 bytes

=REPT(CHAR(ROW(A1)+64)&CHAR(MOD(ROW(A1),26)+65),13)

Place in A1 and drag to desired length of wave (in this case, 26, one cell for each letter).

user56309

Posted 2016-08-09T23:29:18.710

Reputation:

0

Improving on @gabe3886's answer (new account and not able to comment)

PHP 94 92 Bytes

<?php for($i=0;$i<26;)echo str_repeat(substr('ABCDEFGHIJKLMNOPQRSTUVWXYZA',$i++,2),13)."\n";

However if you suppress notices, it's 92 90 bytes

<?php for(;@$i<26;)echo str_repeat(substr('ABCDEFGHIJKLMNOPQRSTUVWXYZA',@$i++,2),13)."\n";

Wes

Posted 2016-08-09T23:29:18.710

Reputation: 1

Welcome to PPCG. You can golf this down to 79 bytes: for(;$i<26;)echo str_repeat(substr(ABCDEFGHIJKLMNOPQRSTUVWXYZA,$i++,2),13)."↵";. Replace with an actual line break. As an additional note: You don't need to include the PHP opening tag and you don't need to handle notices. – insertusernamehere – 2016-08-10T19:09:18.523

You can even save another 6 bytes, with a total of 73 bytes: for(;$i<26;)echo str_repeat(substr(implode(range(A,Z)).A,$i++,2),13)."↵"; – insertusernamehere – 2016-08-10T19:20:16.843

@insertusernamehere: Thanks! I wasn't too clear on the rules for this exchange (IE: does it include just functional code (no <?php tag) and/or would warnings be considered part of the output). I noticed in your second comment that range(A,Z) don't have the A and Z characters quoted. Is that abusing another PHP "feature"? – Wes – 2016-08-10T20:08:48.223

Yes, I've removed the quotes in both suggestions. When you run a string without quotes it should prompt something like Notice: Use of undefined constant which is fine here. But be careful, this won't work on strings with whitespaces or special characters etc. – insertusernamehere – 2016-08-10T20:21:48.627

Right. I remember now. PHP will assume it's the literal character "A"(or "Z" or whatever), which is the same reason "foo $bar[baz]" interpolation works without the curly braces. – Wes – 2016-08-10T20:25:03.903

0

Logo, 93 bytes

Here's a non-graphical Logo solution. Try it online with Calormen.com's interpreter.

to m:c type char 65+modulo:c 26end
to b:a repeat 13[m:a-1 m:a] pr" end
repeat 26[b repcount]

GuitarPicker

Posted 2016-08-09T23:29:18.710

Reputation: 1 101

0

JavaScript, Z (90) bytes

for(i=65,b=66;i<91;++i,b=b<90?++b:65)console.log(Array(14).join(String.fromCharCode(i,b)))

To learn:

var start = 65,
    end = 90;

for (var i = start, b = i+1; i <= end; ++i) {
    var chars = String.fromCharCode(i, b);
    /* repeat chars 14 times */
    console.log(Array(14).join(chars));
}

Hydroper

Posted 2016-08-09T23:29:18.710

Reputation: 101

What is that Z? – Erik the Outgolfer – 2016-09-30T16:03:01.383

@EriktheGolfer You know, Z in ASCII is 90 bytes (\x5a) – Hydroper – 2016-09-30T16:42:46.103

0

VIM, 42

:h<_↵↵↵YZZP:s/./&\r/g↵^25↑y↑pG2↑aa↓^ggy13P

where:

  • is return,
  • ^ is ctrl + v
  • ↑ is the up arrow
  • ↓ is escape

I'm sure this can be golfed more. I'm new to VIM so any suggestions are appreciated.

Riley

Posted 2016-08-09T23:29:18.710

Reputation: 11 345

0

python 3, 92 90 bytes

a=65
b=66
for i in range(312):
    if a>89:b=65
    print(chr(a)+chr(b),end="")
    if (i+1)%12<1:
        a+=1
        b+=1
        print()

python 2, 80 bytes

a=65
b=66
for i in range(312):
    if a>89:b=65
    print chr(a)+chr(b),
    if (i+1)%12<1:
        a+=1
        b+=1
        print

This program outputs AB AB AB AB... rather than ABABABAB... I'm not sure if this is allowed, but it's the best I can come up with.

EDIT:

Thanks @User902383 for you comment on @TAsk's post allowing me to shave off 2 bytes.

And thanks @NoOneIsHere for suggesting that I move to python 2 instead of 3, I've included a second program in python 2 with a new byte count.

sonrad10

Posted 2016-08-09T23:29:18.710

Reputation: 535

You can remove the soace before b=65. – NoOneIsHere – 2016-08-11T03:11:57.470

Thanks, I think I already had mentally omitted that when I counted it, just not taken it out of the code. Thanks anyway though. – sonrad10 – 2016-08-11T03:16:17.710

If you switch to python 2, you can replace print() with print, and print(...,end='') to print ..., (trailing comma). – NoOneIsHere – 2016-08-11T03:21:45.987

0

Scala, 64 bytes

Can anyone improve on this?

(('A'to'Z'):+'A').sliding(2).map(_.mkString*13).foreach(println)

Isvara

Posted 2016-08-09T23:29:18.710

Reputation: 101

0

Python 2.7, 65 bytes

Python 2 alternative using a recursive function

def l(a=0):
 print(chr(a+65)+chr(-~a%26+65))*13
 if a<25:l(-~a)

ElPedro

Posted 2016-08-09T23:29:18.710

Reputation: 5 301

0

Vitsy, 29 bytes

So, instead of doing the typical thing, I used my two-dimensional stacking to generate the alphabets and then offset them by one from each other, alternating back and forth between them.

9a*d5*Hd\[:{:}]Y?y\[y\[O?]aO]

9a*d5*H                        Push an alphabet to the stack.
9a*                                 Push 90 to the stack (character code 'Z')
   d5*                              Push 65 to the stack (character code 'A')
      H                             Pop a, b, push range (a, b)

       d\[:{:}]                Establish the other stacks, while alternating.
       d\[    ]                     Do the bracketed code 13 times.
          : :                       Clone the stack.
           {                        Put the top item of the stack on the bottom.
             }                      Put the bottom item of the stack on the top.
               Y                    Discard a stack. (13*2+1-1 = 26)
                ?                   Rotate right a stack (we start on 'A' now)
                 y\[y\[O?]aO]  Output.
                 y\[        ]       Repeat the code in brackets number of stacks times (26).
                    y\[  ]          Repeat the code in brackets number of stack times (26).
                       O            Pop a, print a as a character.
                        ?           Go right a stack.
                          aO        Output a newline.

Try it online!

Addison Crump

Posted 2016-08-09T23:29:18.710

Reputation: 10 763

0

PHP, 70 66 64 Bytes

<?$a=A;$b=B;while($a!=AA)echo str_repeat($a++.($b++)[0],13)."
";

3 bytes short (if I would remove the <? as well) from @insertusernamehere answer. So close!

EDIT: Actually got it to 66 bytes (64 without the <?)! Doing A and B without quotes actually seem to work. Seems to be the shortest PHP one as time of write :D

EDIT 2: Also removed " " from AA. Still seems to be working.

Jeroen

Posted 2016-08-09T23:29:18.710

Reputation: 210

0

Bash, 149, 115, 111, 106 bytes

for i in {0..25};{
printf $(printf %b%b \\`printf %o $[i+65]` \\`printf %o $[-~i%26+65]`)%.s {a..m};echo
}

(thanks @manatwork, saved 34, 4 more bytes)

Bash, 140 bytes

(thanks @steeldriver)

for i in {0..25}; do printf "$(printf '%b%b' \\$(printf '%03o' $((i+65))) \\$(printf '%03o' $((-~i%26+65))))%.0s" {1..13}; printf \\n; done

Save to <file> and run as: /bin/bash <file>

KM.

Posted 2016-08-09T23:29:18.710

Reputation: 121

1$((…))$[…], '%b%b'%b%b, printf \\necho, inner $(…)\…``, do … done{ … }, %.0s%.s, {1..13}{a..m}. (Some of those you may find in Tips for golfing in Bash.) – manatwork – 2016-08-22T12:30:10.990

Sorry, but { and } need separators around them. But there are still single quotes to remove around printf's format strings and what I forgot earlier, no need for the double quotes either. http://pastebin.com/s1h75e5i

– manatwork – 2016-08-22T14:42:48.817

1One more thing: 65..90 in octal is 101..132, so they take 3 digits anyway, so %03o%o. – manatwork – 2016-08-22T14:55:15.317

Sorry, seems I not explained the error well enough. As the code you posted failed with “line 1: syntax error near unexpected token `{printf'”, I edited it. Feel free to revert if you disagree. – manatwork – 2016-08-22T15:38:59.553

@manatwork copy-paste error on my part, thanks (-: – KM. – 2016-08-22T17:44:27.813

0

GNU sed, 95 bytes

s,^,@@@@@@@@@@@@@,;s,@,AB,g
:;p
y,ABCDEFGHIJKLMNOPQRSTUVWXYZ,BCDEFGHIJKLMNOPQRSTUVWXYZA,
/^Z/!b

I wish the 'y' command had this syntax: y,A-Z,B-ZA,.

seshoumara

Posted 2016-08-09T23:29:18.710

Reputation: 2 878

0

Python, 56

for k in range(26):print(chr(k+65)+chr((k+1)%26+65))*13

Lord Ratte

Posted 2016-08-09T23:29:18.710

Reputation: 111

Ah, I had a look at your answer, @Karl Napf. You used a sneaky method of golfing two bits away from my solution. Thank you for teaching me something new :] – Lord Ratte – 2016-11-11T13:42:36.670

0

PHP, 52 bytes

for($a=A;$a!=AA;)echo str_pad("\n",27,$a++.$a[0],0);

Can JavaScript beat this? Run with -r.

Titus

Posted 2016-08-09T23:29:18.710

Reputation: 13 814

-1

PHP, 78, 72, 67 bytes

<?php $s='A';while($s!='AA')echo str_repeat($s++.(--$s)[0],13)."
";

Try it online!

Link

Posted 2016-08-09T23:29:18.710

Reputation: 1

Instead of striking out old answers, just keep their bytecount in the header and strike those out. The revision history is sufficient in case you want to see older solutions. – Timtech – 2018-01-31T23:30:19.943

@Timtech good point, thank you, Sir :) – Link – 2018-01-31T23:32:08.307

Glad to help you out @Link, keep it up:) – Timtech – 2018-01-31T23:35:02.813