66
\$\begingroup\$

Inspired by George Gibson's Print a Tabula Recta.

You are to print/output this exact text:

ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ

(Yes, I typed that by hand)

You are allowed to use all lowercase instead of all uppercase.

However, your choice of case must be consistent throughout the whole text.

Rules/Requirements

  • Each submission should be either a full program or function. If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. Anything else (e.g. headers in C), must be included.
  • If it is possible, provide a link to a site where your program can be tested.
  • Your program must not write anything to STDERR.
  • Standard Loopholes are forbidden.
  • Your program can output in any case, but it must be printed (not an array or similar).

Scoring

Programs are scored according to bytes, in UTF-8 by default or a different character set of your choice.

Eventually, the answer with the least bytes will win.

Submissions

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

# Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

# Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:

# [><>](http://esolangs.org/wiki/Fish), 121 bytes

Leaderboard

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

/* Configuration */

var QUESTION_ID = 87064; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 48934; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];
  
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    if (/<a/.test(lang)) lang = jQuery(lang).text();
    
    languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang > b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">

    </tbody>
  </table>
</div>
<div id="language-list">
  <h2>Winners by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">

    </tbody>
  </table>
</div>
<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>

\$\endgroup\$
  • 1
    \$\begingroup\$ Related. \$\endgroup\$ – Leaky Nun Jul 31 '16 at 14:03
  • 5
    \$\begingroup\$ Can the output (as the return value from a function) be an array of lines? \$\endgroup\$ – Doorknob Jul 31 '16 at 14:55
  • \$\begingroup\$ @Doorknob I would say no. \$\endgroup\$ – Leaky Nun Jul 31 '16 at 14:56
  • \$\begingroup\$ @GeorgeGibson Yes. \$\endgroup\$ – Leaky Nun Jul 31 '16 at 17:36
  • \$\begingroup\$ @LeakyNun Is a trailing newline allowed? \$\endgroup\$ – Jakube Aug 1 '16 at 10:58

111 Answers 111

3
\$\begingroup\$

Perl, 31 bytes

-6 byte thanks to @Denis Ibaev

say$_ x$A++,$_..Z for A..Z

Needs -M5.010 to run. So run with :

perl -M5.010 -e 'say$_ x$A++,$_..Z for A..Z'  
\$\endgroup\$
  • \$\begingroup\$ Nice solution! You can save 1 byte though, using -65+ord instead of (ord)-65! \$\endgroup\$ – Dom Hastings Aug 1 '16 at 15:58
  • \$\begingroup\$ Right, I was looking for a way to get rid of all those parenthesis near ord, and you found it, thanks ! \$\endgroup\$ – Dada Aug 1 '16 at 16:58
  • \$\begingroup\$ Shorter: say$_ x$A++,$_..Z for A..Z. And use -E instead of -M5.010 -e. \$\endgroup\$ – Denis Ibaev Nov 3 '16 at 7:15
  • \$\begingroup\$ @DenisIbaev Nice one, thanks! The -M5.010 doesn't count in the bytecount, so it doesn't really matter whether I use it or -E. \$\endgroup\$ – Dada Nov 3 '16 at 9:59
3
\$\begingroup\$

PHP, 75 71 bytes

for($a=join(range(A,Z));$i<26;)printf("%'$a[$i]26s
",substr($a,$i++));
\$\endgroup\$
  • 1
    \$\begingroup\$ "A" and "Z" need no quotes. (Notices are not output with the default config.) \$\endgroup\$ – Titus Nov 11 '16 at 11:13
2
\$\begingroup\$

CJam, 13 bytes

'[,65>_ffe>N*

Test it here!

Explanation

'[,   e# Get character range from null-byte to 'Z'.
65>   e# Discard everything up to 'A', so we've got the upper case alphabet.
_     e# Duplicate.
ffe>  e# Nested map: for every pair of letters, computes the maximum and arranges the
      e# results in a grid.
N*    e# Join with linefeeds.
\$\endgroup\$
2
\$\begingroup\$

Python 2, 61 bytes

a=range(65,91)
for c in a:print bytearray(max(c,i)for i in a)

Inspired by (xsot’s improvement to) this answer.

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

Bash + coreutils, 55 51 bytes

Thanks to H Walters for 4 bytes.

for i in {A..Z};{ printf %c {A..Z} '
'|tr A-$i $i;}

We output the string ABCDEFGHIJKLMNOPQRSTUVWXYZ (+newline) 26 times, and replace the first $i characters with the $ith on each iteration. We take advantage of tr repeating the last character of the replacement set to extend it as necessary.

\$\endgroup\$
  • \$\begingroup\$ Save 4 more bytes; replace do and done with { and } \$\endgroup\$ – H Walters Aug 13 '16 at 14:17
2
\$\begingroup\$

C, 65 63 bytes

i,k;a(j){for(;i++^702;j+=putchar(k?(j>k?j:k)+64:10)<11)k=i%27;}

Wandbox

\$\endgroup\$
  • \$\begingroup\$ From the challenge: "Each submission should be either a full program or function. If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. Anything else (e.g. headers in C), must be included." I don't know C: does this answer follow that rule? \$\endgroup\$ – msh210 Aug 1 '16 at 19:27
2
\$\begingroup\$

PHP, 65 62 52 bytes

for($s=Z;$s++<ZZ;)echo"
"[$s[1]>A],max($s[0],$s[1]);

Why use chr when I can increment letters? Try it online.


old solution, 62 bytes:

for(;26>$b+=1/27;)echo chr(($a=++$a%27)?$a>$b?$a+64:$b+65:10);

similar approach as in my Tabula Recta answer

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

x86 assembly (32-bit), 50 bytes

fd 57 c8 00 01 00 89 ef 4f 31 c0 aa b0 5a aa 48
e0 fc b0 41 fd 31 c9 b1 1b 89 ef 4f f2 ae f3 aa
50 47 57 e8 .. .. .. .. 58 58 40 3c 5a 7e e5 c9
5f c3

Might be optimizable further, but I'm tired.

Source:

/* output the l-phabet (???) - 32 bit */
.globl main
main:
std
push %edi
enter $256, $0
/* we're actually going to have to be careful with the stack on this one, since that's where the data is going */
/* first write our initial string */
mov %ebp, %edi
dec %edi
xor %eax, %eax
stosb
mov $'Z', %al
str:
stosb
dec %eax
loopnz str

/* now start back at the end */
mov $'A', %al
replace:
std
xor %ecx, %ecx
mov $27, %cl
mov %ebp, %edi
dec %edi
repne scasb
rep stosb
/* print */
push %eax
inc %edi
push %edi
call puts
pop %eax    /* caller cleanup */
pop %eax    /* old eax */
inc %eax
cmp $'Z', %al
jle replace
leave
pop %edi
ret
\$\endgroup\$
2
\$\begingroup\$

VBA, 60 Bytes

an Anonymous VBE immediate window function that outputs the L-phabet the the VBE immediate window.

For I=65To 90:For J=65To 90:?Chr(IIf(J>I,J,I));:Next:?:Next

 

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

Pascal (FPC), 106 bytes

uses math;var c,d:word;begin for c:=65to 90do begin for d:=65to 90do write(chr(Max(c,d)));writeln;end;end.

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Javascript (using external library) (141 bytes)

w=>_.Range(65,26).WriteLine(x=>(_.Range(0,x-65).Write("",y=>String.fromCharCode(x))||"")+_.Range(x,91-x).Write("",z=>String.fromCharCode(z)))

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

Code explanation: Create char code range of integers, for each write complex predicate to new line. Predicate will create a range of (currentValue-65) values, which is the part that goes A,BB,CCC,...etc...for the case of A the Write may return null so we coerce that to an empty string. Concatenate that with the remaining sequence of the alphabet. So many bytes are coming from the String.fromCharCode lol... oh well!!!

enter image description here

\$\endgroup\$
1
\$\begingroup\$

ListSharp, 233 bytes

ROWS s=ROWSPLIT "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z" BY [","]
[FOREACH NUMB IN 1 TO 26 AS k]
{
STRG t=GETLINE s [k]
[FOREACH NUMB IN 1 TO k AS o]
STRG p=p+t
ROWS x=GETLINES s [k+1 TO 27]
STRG p=p+x+<newline>
}
SHOW=p

There are actually some tricks to get this shorter like directly accessing indexes or using c# queries since you can embed c# code in listsharp with some tricks.

But i kept it as in vanilla as possible

\$\endgroup\$
  • \$\begingroup\$ Can't you split by empty string? Can't you use Egyptian bracket? \$\endgroup\$ – Leaky Nun Jul 31 '16 at 18:08
  • \$\begingroup\$ for egyptian brackets i would need to write {"a","b",..."z"}, which is longer and it uses the c# method String.Split which doesnt work with an empty string, i should probably use Regex.Split for that because that does work. but too late for this challenge.. \$\endgroup\$ – downrep_nation Jul 31 '16 at 18:12
  • \$\begingroup\$ Eh, by "Egyptian brackets" I meant [FOREACH NUMB IN 1 TO 26 AS k]{ \$\endgroup\$ – Leaky Nun Jul 31 '16 at 18:14
  • \$\begingroup\$ ah no you cant do that ;) each line can only perform one function for readability. only few things can be embedded in listsharp but for eaxmple STRG p=p+t cannot be put in line 6 to save the temporary variable t due to the single action per line reason \$\endgroup\$ – downrep_nation Jul 31 '16 at 18:18
  • \$\begingroup\$ I see, thanks for teaching. \$\endgroup\$ – Leaky Nun Jul 31 '16 at 18:23
1
\$\begingroup\$

Perl 6,  67  64 bytes

my @a;@a[.[0]][.[1]]=('A'..'Z')[.max]for ^26 X ^26;.join.put for @a
my @a;@a[.[0];.[1]]=('A'..*)[.max]for ^26 X ^26;.join.put for @a

Explanation:

my @a;

# @a[ $_.[0] ][ $_.[1] ]
@a[ $_.[0] ; $_.[1] ] = (

    # infinite Range that produces:
    #   'A',  'B',  'C' ...  'Y',  'Z',
    #  'AA', 'AB', 'AC' ... 'AY', 'AZ',
    #  'BA', 'BB', 'BC' ... 'BY', 'ZZ',
    # 'AAA','AAB','AAC' ... *」
    'A' .. *

)[
    # index the Range with the max value in the "Tuple" ( 2 element List )
    $_.max
]

    for # do the above with each of the following "Tuples"

        # 「(0,0),(0,1),(0,2)...(0,25),(1,0)...(25,25)」
        ^26 X ^26;

$_.join.put for @a
  • .method where a term is expected is an implicit method call on $_ the "default" scalar.
  • ^26 is short for 0 ..^ 26 which in this case is effectively the same as 0 .. 25
  • The meta infix operator X creates the cross product of two lists
    ( accepts an optional infix operator which it applies between the elements )
\$\endgroup\$
  • \$\begingroup\$ Do you need my $@? \$\endgroup\$ – User112638726 Aug 1 '16 at 13:52
  • \$\begingroup\$ @User112638726 Perl 6 requires you to declare your variables. \$\endgroup\$ – Brad Gilbert b2gills Aug 1 '16 at 18:10
1
\$\begingroup\$

K, 32 35 Bytes

3 more bytes to print the result without double quotes!

{-1,/[y#x@y-1;y _x]}[b]'1+!#b:.Q.A;
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ

Explanation;

.Q.A                 --> uppercase alphabet
1+!#b:.Q.A           --> Indexes from 0 til (!) count (#) .Q.A (alphabet), and add 1 to them all. Also assign .Q.A to the variable b, so we don't have to type .Q.A again!
{}[b]'1 2 3 4 5....  --> we apply the function to b (alphabet) to each (') number i.e. 1 then 2 then 3 then 4
{,/[y#x@y-1;y _x]}   --> First time, y is 1;
    y#x@y-1              --> Use y-1 (0) to index (@) into x (alphabet), then take (#) y (1) of them i.e 1#"A" returns "A", 2#"A" returns "AA" etc.
    y _x                 --> drop (_) y many elements from x
,/[y#x@y-1;y _x]     --> flatten the result
-1 res;              --> Print the result
\$\endgroup\$
1
\$\begingroup\$

Haskell, 43 41 bytes

l=['A'..'Z']
m=mapM(putStrLn.(<$>l).max)l

This defines a function that needs no imports and can just be run in a complete program by adding

main=m

Of course, we could also just name it main itself, but that is three more bytes.

Saved 2 bytes thanks to @wchargin. Depending on the interpretation of the task, we can save 2 more by deleting m= and saying that the remaining part is the function that you can put into main=...

\$\endgroup\$
  • \$\begingroup\$ In GHC 7.10, you can replace (`map`l) with (<$>l). \$\endgroup\$ – wchargin Jul 31 '16 at 18:44
  • \$\begingroup\$ Oh I see, thanks. \$\endgroup\$ – Christian Sievers Jul 31 '16 at 19:52
1
\$\begingroup\$

Brainfuck, 126 bytes

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

Still couldn't outgolf Dennis. Try it online!

Explanation

(The random plusses are to offset hyphens/minuses used in the explanation)

+++++ +++++[<+++++ ++++<+>>-]
 Set the first cell to 10 (for the newline)
 Set the seccond cell to 90 (char code of Z to match the end result of the main loop

>+++++[<+++++>-]<+
 Set the third cell to 26 (the number of lines to make)
 Tape:
  10 90 26
        ^^

[- Main loop: runs 26 times (represented by n)

  >>+++++[-<+++++<<----->>>]<+
   Bring the second cell back to 65 (char code of A)
   Set the fourth cell to 26 (the number of letters per line)
   Tape on first time through loop:
    10 65 26-n 26  0  n
+              ^^

  >>[-<+<<<+>>>>]<
   The sixth cell contains a counter n of the number of lines we've done (initially zero)
   Add n to 65 (cell 2) to skip over the letters covered by the repeated letter
   Move the counter to cell 5
    10 65+n 26-n 26  n  0
                     ^
  [->+<<-<<.>>>]>+<<
    Move the counter back to cell 6
    Output the repeated character n times
    Subtract the n from cell 4 to leave room for only the non-repeated characters
    Increment n for next time
     10 65+n 26-n 26-n  0  n
++                ^^^^

  [-<<.+>>]
   Fill the remaining spots in the line with the rest of the alphabet by outputting cell 2 and incrementing
    10 91 26-n  0  0  n
+               ^

  <<<.>-
   Put a newline (cell 1)
   Change 91 to 90 because it's easier to subtract 25 than 26 to reset it
    10 90 26-n  0  0  n
+      ^^
>]
\$\endgroup\$
1
\$\begingroup\$

VBA, 88 bytes

Function L:For i=0To 701:m=i Mod 27:d=m-i\27:L=L &IIf(26=m,vbLf,Chr(65+m+d*(d<0))):Next

An extension of my Tabula Recta answer. Again the last byte counted is the enter which generates the End Function statement. Invoke in the VBA editor Immediate window with ?L.

\$\endgroup\$
  • 1
    \$\begingroup\$ You don't need the space between 0 and To in For i=0 To 701 \$\endgroup\$ – Jerry Jeremiah Jul 31 '16 at 23:52
  • \$\begingroup\$ @JerryJeremiah - Unexpected... thanks! And I don't need the () after L either, which I usually remember... \$\endgroup\$ – Joffan Aug 1 '16 at 0:50
1
\$\begingroup\$

><>, 77 bytes

v:1->:    ?!v!
>d2*^   v&:~<&o<
v!?&-1:&<o+'@':a!
>&~&>&:1+&d2*=?^&:&'@'+o43.

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Matricks, 37 bytes

m:26:26;Fs::[m90-Q:26-Q:26-Q;];:1:26;

Simple enough. Sets it to a blank 26x26 matrix, then consecutively overwrites the top left square with the correct ascii value.

Run with python matricks.py lphabet.txt [[]] 0 --asciiprint

\$\endgroup\$
1
\$\begingroup\$

Actually, 13 bytes

5Pτú;∙♂M╪k♂Σi

Try it online!

-4 bytes from Leaky Nun, and the inspiration for 4 more, then 4 more from him, and 1 more from me

Explanation:

5Pτú;∙♂M╪k♂Σi
5Pτ            push 26
   ú;∙         Cartesian product of lowercase alphabet with itself
      ♂M       maximum of each pair
        ╪k     list of length-26 sublists
          ♂Σ   concatenate each sublist
            i  flatten and implicitly print
\$\endgroup\$
1
\$\begingroup\$

Pyth, 9 bytes

V._GXGNeN

Try it online: Demonstration

Explanation:

V._GXGNeN   implicit: G = "abc...xyz"
 ._G        all prefixes of G: ["a", "ab", "abc", ...]
V           for each prefix N:
    XGNeN      replace the letters of N in G by the last letter of N 

Another pretty interesting solution (12 bytes):

j.uXN.*<{N2G

First time that .* is useful!

\$\endgroup\$
1
\$\begingroup\$

Sprects, 316 bytes

:ABCDlBBCDlCCCDlDDDDlEEEElFFFFFFGcGGGGGGGcHHHHHHHcIIIIIIIIIJq00q11qttttMauuuuMavvvvNarrrrrPQknnnnQkooooQkppppRkmmmmmmSTbiiiiibjjjjjbgggggggVs
hhhhhhhWs
ffffffYZ
dddddZ
eeeeeZ:1KKKKK:0JJJJJ:dYYYYY:eZZZZZ:fXXXX:gVVV:hWWW:iTTTT:jUUUU:lEFGc:cHIJq:mSSS:nPPPP:oQQQQ:pRRRR:qKLMa:aNOPQk:kRSTb:bUVs
:rOOO:sWXYZ:tLLL:uMMM:vNNN

Basically Martin Ender's /// answer ported to Sprects and then golfed. \ns appear as spaces, this is the interpreter's error.

\$\endgroup\$
1
\$\begingroup\$

QB64, 75 bytes

Not a winner, but not bad for BASIC. Too bad it doesn't have a built-in MAX function.

FOR y=65 TO 90
FOR x=65 TO 90
IF x>y THEN?CHR$(x);ELSE?CHR$(y);
NEXT
?
NEXT
\$\endgroup\$
1
\$\begingroup\$

Lua, 81 80 bytes

Saved 1 byte thanks to manatwork

w=io.write for i=65,90 do for j=65,90 do w(('').char(math.max(i,j)))end w'\n'end
\$\endgroup\$
  • \$\begingroup\$ Why not iterate 65 to 90? \$\endgroup\$ – manatwork Aug 1 '16 at 11:58
1
\$\begingroup\$

Pyth - 12 bytes

WG.[hG26G=tG

Explanation:

                    #G is autoinitialized to the lowercase alphabet
WG                  #while G is not empty
  .[                #left pad
        G           #G
    hG              #with the first letter of G
      26            #to a length of 26
                    #implicitly print that
         =tG        #remove the first letter of G
\$\endgroup\$
  • \$\begingroup\$ Nice approach. =tG does not only perform the assignment, it will also return the new value. So you can use this expression during the .[ statement and save one byte: WG.[hG26=tG \$\endgroup\$ – Jakube Aug 2 '16 at 9:11
1
\$\begingroup\$

Ruby, 60 bytes

a=("A".."Z").to_a.join;(0..25).map{|i|puts(a[i]*i+a[i..-1])}
\$\endgroup\$
  • 1
    \$\begingroup\$ Save a few bytes by doing [*a..b] instead of (a..b).to_a \$\endgroup\$ – Fund Monica's Lawsuit Aug 2 '16 at 6:48
  • 1
    \$\begingroup\$ Also, you can use 25.times instead of (0..25).each \$\endgroup\$ – Fund Monica's Lawsuit Aug 2 '16 at 6:49
  • 1
    \$\begingroup\$ Lastly, I think you can get rid of the parens around the arguments to puts if you have a space before them \$\endgroup\$ – Fund Monica's Lawsuit Aug 2 '16 at 6:50
1
\$\begingroup\$

F#, 70 bytes

for i in 'A'..'Z'do(for j in 'A'..'Z'do printf"%c"(max i j));printfn""

Pretty straightforward.

\$\endgroup\$
  • \$\begingroup\$ Can you use their codepoints to replace 'A' and 'Z'? \$\endgroup\$ – Leaky Nun Aug 2 '16 at 5:20
  • \$\begingroup\$ @LeakyNun I would need to cast to char so the net is 74 bytes : for i in 65..90 do(for j in 65..90 do printf"%c"(char<|max i j));printfn"" \$\endgroup\$ – asibahi Aug 2 '16 at 5:32
  • \$\begingroup\$ What does printf"%c"65 do? \$\endgroup\$ – Leaky Nun Aug 2 '16 at 5:35
  • \$\begingroup\$ throw an error. \$\endgroup\$ – asibahi Aug 2 '16 at 5:36
  • \$\begingroup\$ Alright, thanks for teaching. \$\endgroup\$ – Leaky Nun Aug 2 '16 at 5:36
1
\$\begingroup\$

Sesos, 24 bytes

0000000: 28eb92 02fcfe 8cabb2 36def7 f59933 37e09d 3976c7  (........6....37..9v.
0000015: 867307                                            .s.

Try it online! Check Debug to see the generated SBIN code.

Sesos assembly

The binary file above has been generated by assembling the following SASM code.

add 10
rwd 1
add 26
jmp
    jmp
        rwd 3, add 1, fwd 3, sub 1
    jnz
    rwd 1, add 64, rwd 2
    jmp
        fwd 1, add 1, fwd 1, add 1, fwd 1, add 1, rwd 3, sub 1
    jnz
    fwd 1, sub 1
jnz
fwd 2
jmp
    jmp
        rwd 1, put, fwd 1, sub 1
    jnz
    fwd 1
    jmp
        put, fwd 2
    jnz
    rwd 2
    jmp
        rwd 1
    jnz
    fwd 2
jnz

How it works

We start by placing 10 (linefeed) and 26 on the tape, leaving it as follows.

 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
                                                                            v
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 26 10  0

We're going to count down from 26 to 1, creating two copies of the counter: an unaltered one and one incremented by 64. We do this because we have to print the letter with character code 64 + n exactly n times before printing the remainder of the alphabet.

To count down as outlined above, we repeat the following process until the cell under the data head has a value of 0.

First, we move the content of the counter cell three units to the right.

 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
                                                                            v
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 26  0  0  0 10  0

Now, we retrocede three cells, increment the first one by 64.

 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
                                                                   v
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 26  0 64  0 10  0

Then, we (destructively) copy the content of the cell under the data head to the three closest cells to the right.

 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
                                                                   v
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 26 90 26 10  0

Finally, we take a step to the right, decrement the counter, and repeat the process unless 0 is reached.

 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
                                                                      v
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 25 90 26 10  0

We repeat this process 25 more times, then take two steps forward, leaving the tape as follows.

 0  0 65  1 66  2 67  3 68  4 69  5 70  6 71  7 72  8 73  9 74 10 75 11 76 12 77 13
          ^
78 14 79 15 80 16 81 17 82 18 83 19 84 20 85 21 86 22 87 23 88 24 89 25 90 26 10  0

Now we're ready to generate the output. We do so by repeating the following process until the cell under the data head has a value of 0.

First we decrement the counter until it reaches 0, printing the content of the cell to the left each time we decrement. After printing A and taking one step to the right, the tape looks as follows.

 0  0 65  0 66  2 67  3 68  4 69  5 70  6 71  7 72  8 73  9 74 10 75 11 76 12 77 13
             ^
78 14 79 15 80 16 81 17 82 18 83 19 84 20 85 21 86 22 87 23 88 24 89 25 90 26 10  0

We now print the content of the cell under the data head, take two steps to the right, and repeat until a 0 cell is reached. After printing BCDEFGHIJKLMNOPQRSTUVWXYZ\n and taking two steps to the left, the tape looks as follows.

 0  0 65  0 66  2 67  3 68  4 69  5 70  6 71  7 72  8 73  9 74 10 75 11 76 12 77 13
                                                                               v
78 14 79 15 80 16 81 17 82 18 83 19 84 20 85 21 86 22 87 23 88 24 89 25 90 26 10  0

We now go left until we find the next 0 cell, then take two steps to the right.

 0  0 65  0 66  2 67  3 68  4 69  5 70  6 71  7 72  8 73  9 74 10 75 11 76 12 77 13
                ^
78 14 79 15 80 16 81 17 82 18 83 19 84 20 85 21 86 22 87 23 88 24 89 25 90 26 10  0

In the next iteration, we'll print BB, then CDEFGHIJKLMNOPQRSTUVWXYZ\n and leave the tape as follows.

 0  0 65  0 66  0 67  3 68  4 69  5 70  6 71  7 72  8 73  9 74 10 75 11 76 12 77 13
                      ^
78 14 79 15 80 16 81 17 82 18 83 19 84 20 85 21 86 22 87 23 88 24 89 25 90 26 10  0

This process continues until all 26 lines are printed. After the last iteration, the data head is positioned on a 0 (see below), and the programs terminates.

 0  0 65  0 66  0 67  0 68  0 69  0 70  0 71  0 72  0 73  0 74  0 75  0 76  0 77  0
                                                                                  v
78  0 79  0 80  0 81  0 82  0 83  0 84  0 85  0 86  0 87  0 88  0 89  0 90  0 10  0
\$\endgroup\$
1
\$\begingroup\$

Java 1.8, 96 91 bytes

I managed to flatten everything into one for-loop with a single print statement. Nothing Java 1.8 specific - just happens to be the version I compiled the code with.

void f(){for(int i=-1,j=0,k=i;++i<702;k=(i+1)%27)System.out.write(k>25?++j-j+10:65+(k>j?k:j));}

Surprisingly, removing variable k and introducing Math.max() skimmed off 5 bytes:

void f(){for(int i=-1,j=0;++i<702;)System.out.write(i%27>25?++j-j+10:65+Math.max(i%27,j));}

Or ungolf'ed:

interface C {
    static void main(String[] a) {
        f();
    }

    static void f() {
        for (int i = -1, j = 0; ++i < 702;) {
            System.out.write(i%27 > 25 ? ++j - j + 10 : 65 + Math.max(i%27,j));
        }
    }
}

Try it here.

Approach is based on my Tabula Recta answer. This leverages the fact that the System.out stream is line-buffered, causing an auto-flush whenever a line feed character (10) is written.

I have a feeling this can be golf'ed down further, mainly because of the way the values of certain variable are juggled with (i.e. j). Note to self: I was right!.

\$\endgroup\$
1
\$\begingroup\$

Python 2.7, 79 bytes

x=[chr(y) for y in range(65,91)]
for y in range(26):print x[y]*y+''.join(x[y:])
  1. Generate a list of the characters.
  2. Loop through each showing the beginning character a certain amount of times.
  3. Then show the rest after that.
\$\endgroup\$
  • \$\begingroup\$ Nice answer, and welcome to the site! You can do map(chr,range(65,91)) to take a couple bytes off. \$\endgroup\$ – DJMcMayhem Aug 2 '16 at 16:24
  • \$\begingroup\$ You could also take one byte off with y=0;exec"print x[y]*y+''.join(x[y:]);y+=1"*26 \$\endgroup\$ – DJMcMayhem Aug 2 '16 at 16:26

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.