35
\$\begingroup\$

Output or display the following three lines of text, exactly as they are shown below. A trailing newline is accepted.

 bC#eF&hI)kL,nO/qR2tU5wX8z
A!cD$fG'iJ*lM-oP0rS3uV6xY9
aB"dE%gH(jK+mN.pQ1sT4vW7yZ

That block of text is the same as the one below, but where the n'th column is rotated n times downward:

 !"#$%&'()*+,-./0123456789
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz

Keep in mind that this is a challenge, so the output format is not flexible.

\$\endgroup\$
  • 1
    \$\begingroup\$ Does the text end on a newline ? In particular is it ok to end on '....z\n\n` ? \$\endgroup\$ – Ton Hospel Feb 14 '18 at 18:03
  • 2
    \$\begingroup\$ @Tom no, it should maximum be one trailing newline \$\endgroup\$ – Stewie Griffin Feb 14 '18 at 19:10
  • \$\begingroup\$ Is a leading newline acceptable? \$\endgroup\$ – Dom Hastings Feb 15 '18 at 8:42
  • \$\begingroup\$ @DomHastings No, sorry. \$\endgroup\$ – Stewie Griffin Feb 15 '18 at 8:43
  • \$\begingroup\$ (for many languages (HTML, ///, Text, Bubblegum) hardcoding those 80 characters would be (provably, except for Bubblegum) the shortest, that is boring, please don't do that) \$\endgroup\$ – user202729 Feb 23 '18 at 8:19

44 Answers 44

18
\$\begingroup\$

Java 8, 169 162 150 146 116 113 106 95 94 93 92 91 90 84 bytes

Yay, we finally did it! We've beat the 88-byte literal output that can be found at the bottom. Thanks to all those who participated in the golfing!

v->{for(int i=0,t=0;++i<81;System.out.printf("%c",i%27<1?10:(4-t++%3)*32%97+i%27));}

-7 bytes thanks to @StewieGriffin.
-42 bytes thanks to @Neil.
-11 bytes thanks to @PeterTaylor.
-3 bytes thanks to @OlivierGrégoire.
-6 bytes thanks to @OlivierGrégoire and @Neil (Olivier suggested a port of Neil's JavaScript answer).

Try it online.

Explanation:

v->{                          // Method with empty unused parameter and no return-type
  for(int i=0,t=0;++i<81;     //  Loop from 1 to 81 (exclusive)
     System.out.printf("%c",  //   Print the following character:
      i%27<1?                 //    If it's the last column
       10                     //     Print a new-line
      :                       //    Else:
       (4-t++%3)*32%97+i%27   //     Print the correct character based on the index

See here what each of the arithmetic parts do, and how it ends up at the correct characters.


Java 8, 88 bytes

v->" bC#eF&hI)kL,nO/qR2tU5wX8z\nA!cD$fG'iJ*lM-oP0rS3uV6xY9\naB\"dE%gH(jK+mN.pQ1sT4vW7yZ"

Boring, but utilizing the intended rotation of columns won't be any shorter in Java for sure.. I stand corrected! Will post a solution in a moment either way to see how much bytes it differs. Apparently the difference is just -4 bytes! :D

Try it online.


\$\endgroup\$
  • 1
    \$\begingroup\$ Based on my CJam approach, I'm pretty sure there should be a reasonably simple arithmetic formula for the code point at position (x, y), which will most likely beat your 169-byte approach and maybe even the literal string. \$\endgroup\$ – Martin Ender Feb 14 '18 at 11:20
  • 1
    \$\begingroup\$ 116 bytes: v->{String a="";for(int i=2,j,t;++i<6;){for(j=31;++j<58;a+=(char)(t<1?j+65:t>1?j:j+33))t=(j-i)%3;a+="\n";}return a;} \$\endgroup\$ – Neil Feb 14 '18 at 12:15
  • 1
    \$\begingroup\$ Ahem, 95: v->{for(int i=0,r,c;++i<81;System.out.printf("%c",c<1?10:32*++r+c-1/r))r=(i/27+28-(c=i%27))%3;} \$\endgroup\$ – Peter Taylor Feb 14 '18 at 14:55
  • 1
    \$\begingroup\$ 92 bytes (removed c entirely) \$\endgroup\$ – Olivier Grégoire Feb 15 '18 at 11:07
  • 3
    \$\begingroup\$ @OlivierGrégoire Java outgolfing JavaScript? What did I do wrong? \$\endgroup\$ – Neil Feb 15 '18 at 19:55
12
\$\begingroup\$

Husk, 13 bytes

Tzṙṫ26¡m→"Aa 

Note the trailing space. Try it online!

Explanation

Tzṙṫ26¡m→"Aa   No input.
         "Aa   The string "Aa ".
      ¡        Iterate
       m→      map successor: ["Aa ","Bb!","Cc\"","Dd#",..
 z             Zip with
   ṫ26         the reversed range [26,25,24,..,1]
  ṙ            using rotation: [" Aa","b!B",..,"z9Z"]
               This also truncates the list to length 26.
T              Transpose, implicitly print separated by newlines.
\$\endgroup\$
11
\$\begingroup\$

SPL (Shakespeare Programming Language), 1679 1618 1600 bytes

.
Ajax,.
Ford,.
Puck,.
Act I:.
Scene I:.
[Enter Ajax and Ford]
Ajax:
You are the remainder of the quotient between the sum of the remainder of the quotient between the product of me and a fat joy and the sum of the cube of a big red day and the difference between a red fat pig and a big old fat cow and the quotient between me and the sum of a day and the square of the sum of a joy and a big red day and the sum of a cat and a fat son.
[Exit Ajax]
[Enter Puck]
Ford:
Am I as good as nothing? If so, you are a bad big old red fat day. Am I as good as a joy? If so, you are the sum of a joy and a the cube of an old bad day. Am I as good as a big day? If so, you are the sum of the square of the sum of a big red fat cat and an old cow and the sum of an old war and a lie.
[Exit Ford]
[Enter Ajax]
Ajax:
You are the sum of thyself and the remainder of the quotient between me and the sum of a man and the square of the sum of a son and a big fat cow. Speak thy mind!
[Exit Puck]
[Enter Ford]
Ford:
You are the sum of yourself and a son.
Ajax:
You are the remainder of the quotient between me and the sum of a cat and the square of the sum of a cow and an old red sky.
Ford:
Am I as good as nothing? If so, let us proceed to scene III.
Scene II:.
Ajax:
You are the product of the sum of a fat man and a cow and the sum of a man and the square of the sum of a cat and a big red son. Are you not better than me? If so, let us return to act I. Let us proceed to scene IV.
Scene III:.
Ajax:
You are the sum of a big old fat cat and a red cow. Speak thy mind! Let us return to scene II.
Scene IV:.
[Exeunt]

I had some issues with the interpreter (https://github.com/drsam94/Spl), so it's not as small as I think it could have been. But at least this works :)


Here's the same logic in PHP, to make it a bit easier to see what's going on.

<?php

Act1Scene1:
$ford = ((2 * $ajax) % 52 + $ajax / 26) % 3;
if ($ford == 0) {
    $puck = 32;
}
if ($ford == 1) {
    $puck = 65;
}
if ($ford == 2) {
    $puck = 97;
}
$puck = $ajax % 26 + $puck;
echo chr($puck);

$ajax = $ajax + 1;

$ford = $ajax % 26;
if ($ford == 0) {
    goto Act1Scene3;
}

Act1Scene2:
if ($ajax < 78) {
    goto Act1Scene1;
}
goto Act1Scene4;

Act1Scene3:
$ford = 10;
echo chr($ford);
goto Act1Scene2;

Act1Scene4:
\$\endgroup\$
  • 4
    \$\begingroup\$ The speeches in this sound like a demented Dr. Seuss book. :^D \$\endgroup\$ – DLosc Feb 15 '18 at 18:25
10
\$\begingroup\$

JavaScript (ES6), 86 75 bytes

f=(i=k=0)=>i<80?String.fromCharCode(++i%27?(4-k++%3)*32%97+i%27:10)+f(i):''

Edit: Saved 11 bytes thanks to @Ryan. Now 10 bytes shorter than the literal!

JavaScript (Node.js), 64 bytes

f=(i=k=0)=>i<80?Buffer([++i%27?(4-k++%3)*32%97+i%27:10])+f(i):''

Try it online! Thanks to @Ryan.

\$\endgroup\$
  • 2
    \$\begingroup\$ You can save 11 bytes with recursion: f=(i=k=0)=>i-80?String.fromCharCode(++i%27?(4-k++%3)*32%97+i%27:10)+f(i):'' and 11 more in a Node environment as an aside: f=(i=k=0)=>i-80?Buffer([++i%27?(4-k++%3)*32%97+i%27:10])+f(i):'' \$\endgroup\$ – Ry- Feb 17 '18 at 10:45
8
\$\begingroup\$

CJam (18 bytes)

26{_" Aa"f+m>}%zN*

Online demo

Dissection

The obvious approach is to generate the original lines, zip, rotate with ee::m>, and zip back. But ee:: is quite long, and it's shorter to generate the columns directly.

26{         e# For i = 0 to 25...
  _" Aa"f+  e#   Generate the unrotated column by offsets from the starting chars
  m>        e#   Rotate the appropriate distance
}%
zN*         e# Zip and join the rows with newlines
\$\endgroup\$
8
\$\begingroup\$

Python 2, 72 bytes

x=98
exec"r='';exec'r+=chr(x/3);x+=291*(x<180)-94;'*26;print r;x-=78;"*3

Try it online!

This works by removing 31.333.. from the previous character, adding 97 when the previous codepoint is less than 60, and subtracting 26 at the end of each line.

\$\endgroup\$
7
\$\begingroup\$

05AB1E, 17 15 bytes

Saved 2 bytes thanks to Erik the Outgolfer

žQAuA)øε¼¾GÁ]ø»

Try it online!

Explanation

žQ                 # push the list of printable ascii characters
  Au               # push upper-case alphabet
    A              # push lower-case alphabet
     )ø            # zip
       ε           # apply to each
        ¼          # increment counter
         ¾G        # for N in [1 ... counter] do:
           Á       # rotate string right
            ]      # end loops
             ø     # zip
              »    # print list joined by newlines
\$\endgroup\$
  • \$\begingroup\$ @Emigna I feel like εN should be a thing. Combines the two ideas of vyNFÁ])ø» and yours. \$\endgroup\$ – Magic Octopus Urn Feb 14 '18 at 13:22
  • \$\begingroup\$ @MagicOctopusUrn: Yeah, I have often wanted N while using ε. It doesn't technically fit as ε isn't a loop, though as we sometimes use it as such, it would be nice to have it. \$\endgroup\$ – Emigna Feb 14 '18 at 13:34
7
+150
\$\begingroup\$

R, 64 63 bytes

cat(intToUtf8(c(32:57,10,65:90,10,97:122,10)[(0:80*55)%%81+1]))

Try it online!

-1 byte thanks to Giuseppe

I arrived at this through quite a bit of trial and error, so I'm struggling with a concise explanation. Essentially, instead of the character codes, I started off with a more simple sequence of 1:81 representing the original block of text (3*26 plus 3 newlines), and examined the indices of where these values end up in the rotated block. This follows a regular sequence that drops by 26 each time, modulo 81 (or equivalently, increases by 55 mod 81). It was then a matter of recreating that sequence (0:80*55)%%81+1]), mapping to the real unicode values c(32:57,10,65:90,10,97:122,10), converting to characters and printing.

\$\endgroup\$
  • \$\begingroup\$ well done! I'll be bounty-ing this, although I really expected another solution in the 80+ byte range, so I think I'll up the bounty to 100. \$\endgroup\$ – Giuseppe Feb 15 '18 at 13:33
  • \$\begingroup\$ @Giuseppe No worries! It's more about the challenge than the rep to be honest. \$\endgroup\$ – user2390246 Feb 15 '18 at 14:05
  • \$\begingroup\$ ah, you can save a byte using 55 instead of -26 since -26 == 55 (mod 81). \$\endgroup\$ – Giuseppe Feb 15 '18 at 14:25
  • \$\begingroup\$ @Giuseppe Thanks for the suggestion, and for the bounty! \$\endgroup\$ – user2390246 Feb 26 '18 at 15:01
6
\$\begingroup\$

Japt, 17 15 bytes

"@`"
;By@=cÄ é

Test it online!

Explanation

"@`"         The string "@`\x1F". The following newline sets U to this string.
;            Reset variables A-L to various values. B is set to
 B           the uppercase alphabet, which we only use to get a length of 26.
  y@         Map each column Z (initially just the letter itself) through this function:
     cÄ        Increment each char-code in U.
        é      Rotate by 1 character.
    =          Set U to the result to keep the chain going.
             This generates the 26 columns exactly how we needed them.
             Implicit: output result of last expression

7 other possible 15-byters:

;By@" Aa"c+Y éY
;ByÈpv)iSc+Y)éY
;ByÈ+v)iSc+Y)éY
;ByÈpv)iYd32)éY
;ByÈ+v)iYd32)éY
;ByÈpv)i32dY)éY
;ByÈ+v)i32dY)éY
\$\endgroup\$
5
\$\begingroup\$

CJam, 23 21 bytes

3{26{_I-" aA"=+}/N}fI

Try it online!

Explanation

3{         e# For I from 0 to 2...
  26{      e#   For i 0 to 25...
    _I-    e#     Duplicate i and subtract I. This shifts the starting
           e#     character of each line left in the following string.
    " aA"= e#     Pick the character at the start of the unrotated line
           e#     of the current character. We basically just cycle
           e#     through non-letters, lower-case, upper-case, which is
           e#     the cycle throughout the result. Due to the I-, when
           e#     We get to the second line we start from A, and on the
           e#     third line we start from a.
    +      e#     Add i to the starting character to get the correct
           e#     column.
  }/
  N        e#   Push a linefeed.
}fI
\$\endgroup\$
  • 3
    \$\begingroup\$ Very nice explanation. I especially like: "Push this random-looking string." :P \$\endgroup\$ – Stewie Griffin Feb 14 '18 at 11:07
  • 2
    \$\begingroup\$ @StewieGriffin sorry, that string had to go. \$\endgroup\$ – Martin Ender Feb 14 '18 at 11:28
5
\$\begingroup\$

MATL, 16 bytes

1Y2tk9V:v26:l&YS

Try it online!

Explanation

1Y2     % Push 'AB...Z' (predefined literal)
t       % Duplicate
k       % Maker lowercase
9V      % Push 9, convert to string representation: gives char '9'
:       % Range. For chars, gives string from space to that
v       % Concatenate vertically. Gives a 3×26 char matrix
26      % Push 26
:       % Range. For numbers, gives numeric vector from 1 to that
l&YS    % Circularly shift each column of the first input (char matrix)
        % by the amount specified by the second input (numeric vector).
        % Implicitly display
\$\endgroup\$
  • 2
    \$\begingroup\$ Nice :) I still struggle when I must change the default I/O formats of functions... :( \$\endgroup\$ – Stewie Griffin Feb 14 '18 at 12:41
  • 1
    \$\begingroup\$ oohh very nice with the order of the strings to use 1:26 as the shift. I should try that in my R answer... \$\endgroup\$ – Giuseppe Feb 14 '18 at 13:42
  • 1
    \$\begingroup\$ @StewieGriffin Meta-function & was a great addition, from Suever's idea :-) \$\endgroup\$ – Luis Mendo Feb 14 '18 at 14:58
  • \$\begingroup\$ @Giuseppe Yes, that saved a byte :-) \$\endgroup\$ – Luis Mendo Feb 14 '18 at 14:58
5
\$\begingroup\$

Stax, 14 bytes

ü┬ⁿîΓ░│\ñ▲\å╜ø

Run and debug it online

Here's the corresponding ascii representation of the same program.

3m26{[-" Aa"@i+m

3m                  For [1, 2, 3], execute the rest of the program and output
  26{          m    Map [1 .. 26] into an array
     [-             Subtract the inner value from the outer. (e.g. 3 - 26)
       " Aa"@       Get the character in " Aa" at the specified modular index.
                        This produces the codepoint.  i.e. 32, 65, or 97.
             i+     Add the iteration index.
                    The result is an array of integers.  It's treated character
                        codepoints for output.
\$\endgroup\$
5
\$\begingroup\$

Perl 5, 46 bytes

print map{chr$n+++ord,$/x!($n%=26)}($",A,a)x26

Saved 13 bytes thanks to @TonHospel's arcane wizardry!

Try it online!

\$\endgroup\$
  • \$\begingroup\$ Your $i++ is just $_ and you can use say instead of print so this is really 50 \$\endgroup\$ – Ton Hospel Feb 14 '18 at 14:26
  • \$\begingroup\$ Mmm, and it's easy to get rid of the {} in the map too for 49: say map$/x/26|52/.chr$_%26+(32,65,97)[$_%3],0..77 \$\endgroup\$ – Ton Hospel Feb 14 '18 at 14:57
  • \$\begingroup\$ @TonHospel Yes, of course! Thanks! \$\endgroup\$ – Dom Hastings Feb 14 '18 at 15:37
  • \$\begingroup\$ Redesigning the loop gives 47: print map{chr$n+++$_,$/x!($n%=26)}(32,97,65)x26. Unfortunately say gives one newline too many. \$\endgroup\$ – Ton Hospel Feb 14 '18 at 18:20
  • \$\begingroup\$ And a fun 48: say map$/x/.A/.chr$n++%26+(65,32,97)[$n%3],A..BZ \$\endgroup\$ – Ton Hospel Feb 14 '18 at 19:32
5
\$\begingroup\$

R, 88 86 bytes

cat(intToUtf8(rbind(diffinv(matrix(c(66,-32,-31),25,5,T)[,1:3],,,t(c(32,65,97))),10)))

Try it online!

R is terrible at string manipulation and although it has some neat matrix builtins, rotations are another thing it doesn't do very easily. I will happily give a bounty to anyone who can out-golf me in R.

Despite my having found a shorter answer, I'll still award a 50 rep bounty to the first other R answer shorter than 88 bytes.

I suppose I'd award myself the bounty if I could, but this is a whole two bytes shorter than the "boring" answer! I avoid rotations by just using R's penchant for recycling.

EDIT: user2390246's answer completely outgolfed me and I will be awarding a 100 point bounty since that solution is far superior.

To get here, I deconstructed the desired output to their ASCII code points with utf8ToInt (removing the newlines), built a matrix, and ran a diff on themm getting the columnwise differences. Noting the periodicity there, I set out to construct the matrix in a golfy fashion, hoping to use diffinv to recreate the original.

Thanks to the periodicity, we can recreate the diffed matrix by forcing R to recycle with a non-multiple length, and extract the columns we actually wanted:

matrix(c(66,-32,-31),25,5,T)[,1:3]

Then we invert this process, with diffinv to recreate the code points, append a row of 10 (newlines) to the bottom, reconvert to ASCII with intToUtf8, and cat the result.

\$\endgroup\$
  • 3
    \$\begingroup\$ You can sort of give yourself a bounty. The bounty would cost you x rep, and you'd gain x rep from it... So, consider it done! \$\endgroup\$ – Stewie Griffin Feb 14 '18 at 15:21
  • 2
    \$\begingroup\$ Challenge accepted! \$\endgroup\$ – user2390246 Feb 15 '18 at 13:13
4
\$\begingroup\$

PowerShell, 53 bytes

0..2|%{-join(32..57|%{[char]($_+(0,65,33)[$j++%3])})}

Try it online!

I see this is similar to Dom's Perl answer, but I arrived at it independently.

This exploits the fact that the pattern goes Symbol - Lowercase - Capital, even when wrapping newlines (8 - z - A, for example), and thus just adds the appropriate offset (chosen via $j++%3) to the current number $_ before -joining those together into a single string. That's done three times to come up with the three lines (preserving $j between iterations). Those three lines are left on the pipeline, and the implicit Write-Output gives us the newlines for free.

\$\endgroup\$
4
\$\begingroup\$

Julia 0.6, 79 bytes

println.([prod([' ':'9' 'A':'Z' 'a':'z'][n,mod1(i-n,3)] for n=1:26) for i=2:4])

[' ':'9' 'A':'Z' 'a':'z'] is the unrotated 2d array of characters, [n,mod1(i-n,3)] indexes into that array with appropriate rotation. prod takes a Vector of Characters to a String (since multiplication is used for string join). There are two nested Vector comprehensions resulting in a Vector containing 3 strings, then println. prints the each string in the Vector followed by a newline.

TIO lacks the appropriate method to multiply (with prod) two characters to get a String. I know that method was added somewhat recently, but the TIO version appears to be the same as the version on my PC where this code works, so I can't fully explain why it doesn't work on TIO.

Copy paste example (the ; isn't necessary, it just supresses extra output in the REPL):

julia> println.([prod([' ':'9' 'A':'Z' 'a':'z'][n,mod1(i-n,3)] for n=1:26) for i=2:4]);
 bC#eF&hI)kL,nO/qR2tU5wX8z
A!cD$fG'iJ*lM-oP0rS3uV6xY9
aB"dE%gH(jK+mN.pQ1sT4vW7yZ
\$\endgroup\$
4
\$\begingroup\$

Charcoal, 26 21 15 bytes

E³⭆⧧⟦γαβ⟧⁻κμμ

Try it online! Link is to verbose version of code. Explanation:

 ³              Literal 3
E               Map over implicit range
   β            Lowercase letters
  ⭆             Map over characters and concatenate
            κ   Outer index
             μ  Inner index
           ⁻    Subtract
       γ        Printable characters
        α       Uppercase letters
         β      Lowercase letters
     §⟦   ⟧     Circularly index into list (selects one of the three strings)
              μ Inner index
    §           (Circularly) index into string
                Implicitly print each inner map result on a separate line
\$\endgroup\$
4
\$\begingroup\$

J, 29, 27 25 bytes

-2 bytes thanks to FrownyFrog -2 bytes thanks to miles

 |:u:(<26)2&(|.>:)32 65 97

Try it online!

Initial approach: J, 29 bytes

u:(-|."_1&.|:32 65 97+/])i.26

Explanation: i.26 - range 0-26

   i.26
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

32 65 97+/] - create a 3-row table for the characters

   32 65 97+/i.26
32 33 34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57
65 66 67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122

&.|: transpose then do the next verb (|.) and transpose again

-|."_1 rotate each row n times

     (-i.26)|."_1|:32 65 97+/i.26
 32  65  97
 98  33  66
 67  99  34
 35  68 100
101  36  69
 70 102  37
 38  71 103
104  39  72
 73 105  40
 41  74 106
107  42  75
 76 108  43
 44  77 109
110  45  78
 79 111  46
 47  80 112
113  48  81
 82 114  49
 50  83 115
116  51  84
 85 117  52
 53  86 118
119  54  87
 88 120  55
 56  89 121
122  57  90

u: convert to unicode

    u:(-i.26)|."_1&.|:32 65 97+/i.26
 bC#eF&hI)kL,nO/qR2tU5wX8z
A!cD$fG'iJ*lM-oP0rS3uV6xY9
aB"dE%gH(jK+mN.pQ1sT4vW7yZ

Try it online!

\$\endgroup\$
  • \$\begingroup\$ @FrownyFrog Thank you! Apparently I didn't check the possibility to create the matrix column-wise. \$\endgroup\$ – Galen Ivanov Feb 14 '18 at 19:16
  • 2
    \$\begingroup\$ |:u:(<26)2&(|.>:)32 65 97 saves 2 bytes. \$\endgroup\$ – miles Feb 14 '18 at 23:54
  • \$\begingroup\$ @miles Thanks for the great code! \$\endgroup\$ – Galen Ivanov Feb 15 '18 at 0:05
4
\$\begingroup\$

Jelly, 13 bytes

26“ aA‘ẋs+ḶỌY

Try it online!

How it works

26“ aA‘ẋs+ḶỌY  Main link. No arguments.

26             Set the argument and the return value to 26.
  “ aA‘ẋ       Repeat [32, 97, 65] (code points of ' ', 'a', and 'A') 26 times.
        s      Split the result into chunks of length 26.
          Ḷ    Unlength; yield [0, ..., 25].
         +     Add [0, ..., 25] to each of the chunks.
           Ọ   Unordinal; cast all integers to characters.
            Y  Jojn, separating by linefeeds.
\$\endgroup\$
4
\$\begingroup\$

C, 70 69 67 60 64 bytes

i;f(t){for(i=t=0;++i<81;putchar(i%27?(4-t++%3)*32%97+i%27:10));}

+4 bytes to make the function reusable.

Invalid 60-bytes answer that isn't reusable:

i,t;f(){for(;++i<81;putchar(i%27?(4-t++%3)*32%97+i%27:10));}

Port of my Java 8 answer @Neil's JavaScript answer.

Try it online.

\$\endgroup\$
  • \$\begingroup\$ Since functions have to be reusable and this function does not exit cleanly, it leaves the global variables behind. You need an i=t=0. \$\endgroup\$ – Jonathan Frech Feb 28 '18 at 1:07
  • \$\begingroup\$ @JonathanFrech Fixed \$\endgroup\$ – Kevin Cruijssen Feb 28 '18 at 7:47
3
\$\begingroup\$

APL+WIN, 26 bytes

Index origin 0

⎕av[(-⍳26)⊖32 65 97∘.+⍳26]

Generate a matrix of integer index values of the characters in the APL atomic vector.

Rotate each column downwards by its number value.

Use the resulting indices to display the characters from the atomic vector.

\$\endgroup\$
3
\$\begingroup\$

C, 72 bytes

f(k,x,n){for(n=81;n;putchar(x?k*32+59-x-!k:10))x=--n%27,k=(3+x-n/27)%3;}
\$\endgroup\$
3
\$\begingroup\$

Python 2, 65 bytes

for x in 2,99,196:s='';exec"s+=chr(32+x%291/3);x-=94;"*26;print s

Try it online!

\$\endgroup\$
3
\$\begingroup\$

brainfuck, 121 115 bytes

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

Thanks to @JoKing for saving 6 bytes!

Try it online!

\$\endgroup\$
  • \$\begingroup\$ 115 bytes by fiddling about with the number generation \$\endgroup\$ – Jo King Feb 21 '18 at 1:24
  • 2
    \$\begingroup\$ +++[[<+>>++<-]>] really is the start of everything, huh? Thanks! \$\endgroup\$ – Dennis Feb 21 '18 at 1:38
3
\$\begingroup\$

Japt, 17 bytes

26Æ" Aa"c+X éX÷y

Test it


Explanation

26Æ           Ã       :Create the range [0,26) and pass each X through a function
   " Aa"              :  String literal
        c+X           :  Add X to the codepoint of each character
            éX        :  Rotate right X times
               ·      :Join with newlines
                y     :Transpose
\$\endgroup\$
  • \$\begingroup\$ Oooh, I had a different solution that may or may not be enough to warrant a separate answer: ;Bå_cÄ é}"@`" ·y \$\endgroup\$ – ETHproductions Feb 14 '18 at 13:07
  • \$\begingroup\$ Well now that we're the same length I feel better about it ;-) \$\endgroup\$ – ETHproductions Feb 14 '18 at 13:13
  • \$\begingroup\$ @ETHproductions: looks different enough to me :) Was going to see if I could come up with a shorter solution by mapping over C after lunch. Don't know how y and · ended up the wrong way 'round; I must have Ctrl+Zed too many times before Ctrl+Aing! \$\endgroup\$ – Shaggy Feb 14 '18 at 13:18
2
\$\begingroup\$

APL (Dyalog Unicode), 23 bytes (Adám's SBCS)

(⎕UCS-⊖∘↑32 65 97+⊂)⍳26

Try it online!

-1 thanks to Adám.

Runs in an interactive environment.

Assumes ⎕IO←0.

\$\endgroup\$
2
\$\begingroup\$

Vim, 81 79 bytes

a !"#$%&'()*+,-./0123456789␛:h<_␍jjYZZpPgU$klqq"aDjlma"bD"ap`ajD"bpkkp`akl@qq@q

Explanation (simplified)

a !"#$%&'()*+,-./0123456789␛    Insert the first line
:h<_␍jjYZZpPgU$                  Insert the alphabet twice by copying it from the help page
klqq                             Define the loop `q`:
"aDjl                             Cut the rest of the line to `a`
ma"bD"ap                          Replace the rest of the second line (cut `b`, paste `a`)
`ajD"bp                           Replace the rest of the third line (cut `c`, paste `b`)
kkp                               Paste `c`
`akl@qq@q                        Run the loop, each time one more step to the right
\$\endgroup\$
2
\$\begingroup\$

K4, 38 bytes

Solution:

-1"c"$+(-t).q.rotate'32 65 97+/:t:!26;

Example:

q)k)-1"c"$+(-t).q.rotate'32 65 97+/:t:!26;
 bC#eF&hI)kL,nO/qR2tU5wX8z
A!cD$fG'iJ*lM-oP0rS3uV6xY9
aB"dE%gH(jK+mN.pQ1sT4vW7yZ

Explanation:

9 characters to perform the rotation...

-1"c"$+(-t).q.rotate'32 65 97+/:t:!26;
-1                                   ; / print to stdout, swallow return
                                  !26  / til 26, 0..25
                                t:     / save as variable t
                             +/:       / add each right item to...
                     32 65 97          / the list 32, 65, 97 (ASCII offsets)
           .q.rotate'                  / rotate each-both
       (-t)                            / negate, 0..-25
      +                                / flip rows and columns
  "c"$                                 / cast to characters
\$\endgroup\$
2
\$\begingroup\$

Perl, 49 46 bytes

perl -E 'say map chr($_*55%81)=~y// -:A-Z             
a-z       
/cr,0..79'

or

perl -E 'say grep{$_=chr$_*55%81;y// -:A-Z             
a-z       
/c}0..79'
\$\endgroup\$
  • \$\begingroup\$ +1! I can't help you save any bytes back, but I wondered about using $^x8, but can't think of another var with enough length, perhaps "@INC" but it's too long, and using "@-" instead of $n++, but still, same length. Unless that helps you shrink this further? Unless you add -p flag and have implicit output? \$\endgroup\$ – Dom Hastings Feb 14 '18 at 15:39
  • 1
    \$\begingroup\$ @DomHastings Ah, found a way to loop without needing so much preparation \$\endgroup\$ – Ton Hospel Feb 14 '18 at 22:27
2
\$\begingroup\$

Jelly, 16 bytes

“ Aa‘ṙ2‘$25СỌZY

Try it online!

-4 thanks to miles.

\$\endgroup\$
  • \$\begingroup\$ 19 bytes \$\endgroup\$ – dylnan Feb 14 '18 at 16:55
  • \$\begingroup\$ (I used LÐṀ instead of ḣ26 but there was no reason as it didn't save any bytes) \$\endgroup\$ – dylnan Feb 14 '18 at 16:57
  • \$\begingroup\$ @dylnan thanks, I'll update later \$\endgroup\$ – Erik the Outgolfer Feb 14 '18 at 16:57
  • \$\begingroup\$ 18 bytes \$\endgroup\$ – dylnan Feb 14 '18 at 17:09
  • \$\begingroup\$ 17 bytes sorry for the barrage \$\endgroup\$ – dylnan Feb 14 '18 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.