Debe imprimir este texto exacto:
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
Especificaciones
- Puede imprimir todas las minúsculas en lugar de todas las mayúsculas. Sin embargo, el caso debe ser coherente en toda la salida.
- Puede imprimir un salto de línea adicional.
Tanteo
Dado que esta es una onda alfabética que fluctúa en pequeña medida, su código también debe ser pequeño en términos de conteo de bytes. De hecho, el código más pequeño en términos de conteo de bytes gana.
code-golf
kolmogorov-complexity
alphabet
Monja permeable
fuente
fuente
Respuestas:
C, 60 bytes
fuente
Brainfuck, 104 bytes
fuente
Convexo, 10 bytes
Pruébalo en línea!
fuente
Pyth,
1110 bytesPruébalo aquí
fuente
Vim,
8583 bytesSé que se puede jugar más al golf, pero me duele la cabeza, así que tengo que parar por ahora.
<cr>
es la tecla enter,<c+v>
es ctrl + v, y<esc>
es la tecla escape. Todos fueron contados como un byte.Grabé un gif de esto, pero se arruinó. Sin embargo, el video está bien: http://recordit.co/ldLKvho9Gi
fuente
Ruby,
42393837 bytes-3 bytes gracias a @ user81655
-1 byte gracias a @manatwork
-1 byte gracias a @NotthatCharles
Véalo en repl.it: https://repl.it/CmOJ
fuente
Cheddar, 48 bytes
Cheddar is good with strings :D
Try it online!
Explanation
What does
l>89?65:l+1
do? Well89
is the char code forY
. Basically,l>89
is checking if the letter isZ
, that means we should be returningA
. Ifl>89
is false. I'll returnl+1
, the next charfuente
@"
between them.Jelly, 10 bytes
Try it online!
How it works
fuente
Y
exist back then? Also congrats for 100k rep!!Y
was added two days after the challenge was posted.26ḶḂØAṙZY
. But, as it is right now, it's still good.Haskell,
6058 bytesStarting 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.fuente
unlines
is even shorter than(++"\n")=<<
.PowerShell,
4943 bytesTimmyD's remix:
was, 49 bytes:
fuente
Python 2,
706854 bytesList based solution:
But why create a list? Thanks LeakyNun:
fuente
R,
72676056 bytesThanks to @Giuseppe for the extra 4 bytes off!
Old
rep
-based solution at 60 bytes:See here on an online interpreter. Thanks to @user5957401 for the extra 7 bytes off!
Old matrix-based solution at 72 bytes:
See here on an online interpreter.
fuente
i in 1:26
and then the letter selection toLETTERS[c(i,i%%26+1)]
you can drop like 6 or 7 bytes(i+1)%%26
that it didn't occur to me to do the opposite! Thanks!MATL, 13 bytes
Try it online!
fuente
Jellyfish, 26 bytes
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:
'
s are character literals; they are followed by unprintables with ASCII code 26, and stand for those characters.r
computes the character range from 0 to 25.,
forms a pair from the two unprintable chars.r
is given argument2
, and forms the range[0 1]
.$
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 rows0 1 0 1 0 1 ...
+
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.~|
is modulus with flipped arguments: the south argument (the above char matrix) is reduced modulo the east argument (theS
turns the argument-seeking process south, so this is the unprintable literal 26).+
adds the literalA
to every coordinate of the resulting matrix.P
prints the result in matrix format, that is, each row on its own line without quotes.fuente
Vim, 31 bytes
Where
↵
is the Return key.fuente
Perl, 26 bytes
Solution from @Dom Hastings. (12 bytes shorter than mine!)
-1 byte thanks to @Ton Hospel
Run with
-M5.010
or-E
:fuente
say+($_++,$_--=~/^./g)x13for A..Z
, but I'm sure there's a way to get a shorter one from:say+($_++,$_--)x13for A..Z
...--
in there, it's not needed! O_o. 27:say+($_++,/^./g)x13for A..Z
say+($_,$_++)x13for A..Z
at first which didn't work, but it seems I should have push further into that direction!say+($_++,chop)x13for A..Z
saves one more byteT-SQL 133 Bytes (Golfed by : @t-clausen.dk)
T-SQL , 151 Bytes
Using CTE to generate sequence of number
T-SQL, 155 Bytes
fuente
Julia, 46 bytes
Try it online!
fuente
Pyth, 10 bytes
Demonstration
Explanation:
fuente
Brainfuck,
8886 bytesRequires an interpreter with 8-bit cells and a tape not bounded on the left. Try it online!
fuente
Lua,
8065 Bytes.With help from Leaky Nun
Lua is a pretty inefficent language in regards to handling of strings and such, so this is the best I can narrow it down.
fuente
s=string c=s.char for i=1,26 do print(s.rep(c(64+i)..c((65+(i%26))),13))end
for i=1,26 do print(((64+i):char()..(65+(i%26)):char()):rep(13))end
(not tested)string.rep(x,13)
is basicallyx:rep(13)
Brachylog,
302420 bytesTry it online!
fuente
05AB1E, 12 bytes
Explanation
Try it online
fuente
ADÀ)ø13×»
works as well with 9 bytes.Mathematica,
82756766 bytesTechnically shorter, although it prints in lowercase instead of uppercase:
Mathematica, 64 bytes
fuente
PadLeft
.TSQL, 111 bytes
Fiddle
fuente
MATLAB,
4738 bytesThe 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.
fuente
[... '']
instead ofchar(...)
.[65:90;66:90 65]
saving two bytes.J,
2019 bytes1 byte thanks to miles.
Online interpreter
This is actually the program I used to generate the text in the challenge.
fuente
@
Neoscript, 59 bytes
fuente
PHP, 102 bytes
fuente
<?$a='ABC'
also works.Ruby, 41 bytes
fuente