9 shells, 3 Rubies, some 2D (and 1D!) languages and many languages I learned just for this challenge. I really enjoyed this challenge and learned some new languages and features. I enjoyed finding a shorter way than just the raw string in some languages (in some languages generating the string seemed longer) and trying to re-use the s
variable as many times as possible was fun too. I've also tried to keep the byte-count as low as possible. If I find the time and the inclination, I wonder if I could start adding the letters of the alphabet to the end instead... Crazy talk...
' # "194940711909711999999999999940391270919999999999994039127zaeeeawawawawavaeeaaaaamvawvusb"' #165#1#1;.040;"ZYXWVTSRQPONMLKJIHGFEDCBA"8 3*k,q"ABCDEFGIJKLMNOPQRSTUVWXYZ"o¡72"8:é9:é8++:90+1®;65µ
'\&p"A""K"R"M""Z"R&o;';# x%"ABDEFGHIJKLMNOPQRSTUVWXYZ"x.-$"BCDEFGHIJKLMNOPQRSTUVWXYZ" 0 65 65 if pop dup dup 83 sub if pop outputascii 0 fi pop 1 add dup 91 sub fi "ZYXVUTSRQPONMLKJIHGFEDCBA"#25&o @"ABCDEFGHIJKLMNOPQRSUVWXYZ"
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";0#'
0//1;
try:echo -n;print(s[0:23]+"YZ");
except:print(s[0:15]+s[16:]);"""/.__id__;begin ~:*;puts s.gsub ?J,"";rescue;begin A;puts s.gsub ?G,"";rescue;puts s.gsub ?R,"";end;end;'
[ -z $s ]&&echo ABCDEGHIJKLMNOPQRSTUVWXYZ&&exit;echo `[ $status = 1 ]&&echo \${s/Z/}&&exit;[ \e =~ e ]&&echo \${s/Y/}&&exit;\[ -z \$- \]&&echo ABC\${s#ABCD}&&exit;[ -z \$BASHPID ]&&echo \${s/K/}&&exit;[ -z $_OVM_PATH ]||echo $s|tr -d O;[ -z $_OVM_PATH ]||exit;[[ -n $USER_ID ]]&&echo \${s/M/}||echo \${s/B/}`;';/
('Q'⎕R'')⎕A⋄'\} #<esc>ggdG¬AZ:s/#\|V//"""#\'⍵
The relevant code is:
.-$"BCDEFGHIJKLMNOPQRSTUVWXYZ"
This needs to be wrapped in [
...]
to avoid [Extended Brainfuck Type I] from outputting rubbish before the desired string because of the .
.
Try it online!
The relevant code is:
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";0#'...'
[ -z $s ]&&echo ABCDEGHIJKLMNOPQRSTUVWXYZ&&exit;echo `[ $status = 1 ]&&echo \${s/Z/}&&exit;[ \e =~ e ]&&echo \${s/Y/}&&exit;\[ -z \$- \]&&echo ABC\${s#ABCD}&&exit;[ -z \$BASHPID ]&&echo \${s/K/}&&exit;[ -z $_OVM_PATH ]||echo $s|tr -d O;[ -z $_OVM_PATH ]||exit;[[ -n $USER_ID ]]&&echo \${s/M/}||echo \${s/B/}`;'...' #
This first line sets $s
to be the full alphabet in uppercase, so -z $s
is false and skipped over. $status
is unset, \e
is treated as an escape, not a \
and e
, $BASHPID
is set, $_OVM_PATH
is not and $USER_ID
isn't set so B
is replaced with the empty string in $s
(${s/B/}
) and echo
ed it out.
Try it online!
The relevant code is:
x%"ABDEFGHIJKLMNOPQRSTUVWXYZ"x
The cursors spawn from the %
and are terminated by the x
s. This needed to be moved slightly to prevent additional output.
Try it online!
The relevant code is:
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";0#'...'
[ -z $s ]&&echo ABCDEGHIJKLMNOPQRSTUVWXYZ&&exit;echo `[ $status = 1 ]&&echo \${s/Z/}&&exit;[ \e =~ e ]&&echo \${s/Y/}&&exit;\[ -z \$- \]&&echo ABC\${s#ABCD}&&exit;[ -z \$BASHPID ]&&echo \${s/K/}&&exit;[ -z $_OVM_PATH ]||echo $s|tr -d O;[ -z $_OVM_PATH ]||exit;[[ -n $USER_ID ]]&&echo \${s/M/}||echo \${s/B/}`;'...' #
As per Bash, this first sets $s
to be the full alphabet in uppercase. so -z $s
is false. $status
is empty, \e
is an escape sequence and doesn't match e
, but $-
is empty in Dash so that conditional is met and we echo
out ABC
followed by $s
with the prefix ABCD
removed (${s#ABCD}
).
Try it online!
The relevant code is:
zaeeeawawawawavaeeaaaaamvawvusb
Try it online!
The relevant code is:
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";0#'...'
[ -z $s ]&&echo ABCDEGHIJKLMNOPQRSTUVWXYZ&&exit;echo `[ $status = 1 ]&&echo \${s/Z/}&&exit;[ \e =~ e ]&&echo \${s/Y/}&&exit;\[ -z \$- \]&&echo ABC\${s#ABCD}&&exit;[ -z \$BASHPID ]&&echo \${s/K/}&&exit;[ -z $_OVM_PATH ]||echo $s|tr -d O;[ -z $_OVM_PATH ]||exit;[[ -n $USER_ID ]]&&echo \${s/M/}||echo \${s/B/}`;'...' #
In fish, variables aren't assigned via the s=...
syntax so $s
is empty meaning the first conditional is hit, the required string is echo
ed out and then exit
is called.
Try it online!
goruby + --disable=gems
This isn't available on TIO, but is distributed with the official Ruby source and can be compiled (after the normal autoconf
and ./configure
steps) with make goruby
. Tested on version ruby 2.8.0dev (2020-08-24T10:24:07Z master 1eb1add68a) [x86_64-linux]
. The relevant code is:
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";0
0//.../.__id__;begin ~:*&?,;puts s.gsub ?J,"";rescue;begin A;puts s.gsub ?G,"";rescue;puts s.gsub ?R,"";end;end
The relevant code is:
"ABCDEFGIJKLMNOPQRSTUVWXYZ"o
which o
utputs the required string.
Try it online!
The relevant code is:
¡72"8:é9:é8++:90+1®;65µ
This pushes the range of 1
..72
and joins the last 8 items on the stack to a string, duplicates the top the stack, increments all codepoints by 9, duplicates the stack again, increments all codepoints in the string by 8, pushes 90
to the stack and concatenates all, reverses the stack, pop off the top 65 elements then prints the stack.
Try it online!
The relevant code is:
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";0
0//.../.__id__;begin ~:*&?,;puts s.gsub ?J,"";rescue;begin A;puts s.gsub ?G,"";rescue;puts s.gsub ?R,"";end;end
This shares the declaration of s
with the shells and other Ruby implementations and and .gsub
s J
from the string before puts
ing it as long as ~:*&?,
doesn't cause an error.
Try it online!
The relevant code is:
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";0#'...'
[ -z $s ]&&echo ABCDEGHIJKLMNOPQRSTUVWXYZ&&exit;echo `[ $status = 1 ]&&echo \${s/Z/}&&exit;[ \e =~ e ]&&echo \${s/Y/}&&exit;\[ -z \$- \]&&echo ABC\${s#ABCD}&&exit;[ -z \$BASHPID ]&&echo \${s/K/}&&exit;[ -z $_OVM_PATH ]||echo $s|tr -d O;[ -z $_OVM_PATH ]||exit;[[ -n $USER_ID ]]&&echo \${s/M/}||echo \${s/B/}`;'...' #
$s
is set as the other shells and $status
is empty, \e
doesn't match e
, $-
is not empty, but $BASHPID
is so $s
is echo
ed removing K
(${s/K/}
).
Try it online!
The relevant code is:
&p"A""K"R"M""Z"R&o;
which first clears the stack then pushes the R
anges from A
-K
and M
-Z
, before &o
utputting the stack contents and terminating (;
).
Try it online!
The relevant code is:
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";0#'...'
[ -z $s ]&&echo ABCDEGHIJKLMNOPQRSTUVWXYZ&&exit;echo `[ $status = 1 ]&&echo \${s/Z/}&&exit;[ \e =~ e ]&&echo \${s/Y/}&&exit;\[ -z \$- \]&&echo ABC\${s#ABCD}&&exit;[ -z \$BASHPID ]&&echo \${s/K/}&&exit;[ -z $_OVM_PATH ]||echo $s|tr -d O;[ -z $_OVM_PATH ]||exit;[[ -n $USER_ID ]]&&echo \${s/M/}||echo \${s/B/}`;'...' #
As per the previous shells, the first line sets $s
to be the full alphabet in uppercase, so -z $s
is false and skipped over. $status
is unset, \e
is treated as an escape, not a \
and e
, $BASHPID
is set, $_OVM_PATH
is not and $USER_ID
is set so M
is replaced with the empty string in $s
(${s/M/}
) and echoed it out. Tested on version 58-1
.
The relevant code is the big number as Numberwang is just a transliteration of brainfuck:
194940711909711999999999999940391270919999999999994039127
>+[+[<]>>+<+]>>+++++++++++++[<.+>-]<+>++++++++++++[<.+>-]
There's a minor amount of work to balance 4
s and 7
s throughout the rest of the code, alongside making sure things appear in the right order, but nothing major. Might be able to save some bytes by moving stuff around here...
Try it online!
Oh look, another shell! As per the others the relevant code is:
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";0#'...'
[ -z $s ]&&echo ABCDEGHIJKLMNOPQRSTUVWXYZ&&exit;echo `[ $status = 1 ]&&echo \${s/Z/}&&exit;[ \e =~ e ]&&echo \${s/Y/}&&exit;\[ -z \$- \]&&echo ABC\${s#ABCD}&&exit;[ -z \$BASHPID ]&&echo \${s/K/}&&exit;[ -z $_OVM_PATH ]||echo $s|tr -d O;[ -z $_OVM_PATH ]||exit;[[ -n $USER_ID ]]&&echo \${s/M/}||echo \${s/B/}`;'...' #
The main difference here is that $_OVM_PATH
is set in OSH, but not in Bash, so the correct string is echo
ed using tr
to remove the O
.
Try it online!
The relevant code is:
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";0
0//1;
try:echo -n;print(s[0:23]+"YZ");
except:print(s[0:15]+s[16:]);"""..."""
This shares the declaration of s
with the shells and Rubies and is also shared with xonsh. The code in the try
will fail in Python (echo -n
), but works in xonsh so the code in the except
is called, printing slices of s
.
Try it online!
The relevant code is:
('Q'⎕R'')⎕A⋄'...'⍵
In QuadR, when the final line contains ⍵
all the preceding lines are patterns to match and the final line is a transformation function. This particular transformation function just takes the alphabet ⎕A
and ⎕R
eplaces 'Q'
with ''
, the rest of the function after the statement separator (⋄
) is just to close off all the other strings/comments/regex literals and comment out the end of the function.
Try it online!
The relevant code is shared with J-uby and goruby:
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";0
0//.../.__id__;begin ~:*&?,;puts s.gsub ?J,"";rescue;begin A;puts s.gsub ?G,"";rescue;puts s.gsub ?R,"";end;end
Like the other Rubies, s
is shared from the shells but in Ruby here, both the other clauses ~:*&?,
and A
will raise exceptions so the final statement is executed which replaces R
in s
with the empty string.
Try it online!
The relevant code is:
0 65 65 if pop dup dup 83 sub if pop outputascii 0 fi pop 1 add dup 91 sub fi
This pushes 0
and 65
(twice) to the stack, then if
(which is "while top of stack is truthy" - non-zero), pop
s the top element, dup
licates the new top element twice, pushes 83
and sub
tracts it from the next stack item down. Then if
top of stack is truthy (e.g. it's not 83 - S
), pop
it, outputascii
, push 0
and terminate with fi
(since top of stack is now 0
). Finally, pop
, push 1
, add
the two top elements together (increment), dup
licate, push 91
and sub
tract, terminate the loop, which will happen if the last output char was 90
(Z
).
Try it online!
The relevant code is:
@"ABCDEFGHIJKLMNOPQRSUVWXYZ"
Try it online!
The relevant code is:
"ZYXWVTSRQPONMLKJIHGFEDCBA"8 3*k,q
There are a few commands before this that are executed and push things to the stack, but basically this just pushes the required chars in reverse, then pushes 8
and 3
and multiplies them. The k
command repeats the next command TOS (24
) + 1
times, outputting the required string and q
uits.
Try it online!
The relevant code is:
<esc>ggdG¬AZ:s/V//"...
Which first leaves insert mode (<esc>
), goes to the first line of text (gg
), deletes to the last line (dG
), inserts the letters from A
to Z
(¬AZ
), then finally replaces V
with the empty string (:s/V//
). The rest of the line is commented out ("
).
Try it online!
The relevant code is:
...#220#1#1;.
..."ZYXVUTSRQPONMLKJIHGFEDCBA"#25&o @
The #220#1#1
pushes 220
, 1
, 1
to the stack, then ;
pops off the last item then calls .
which jumps the IP to line 1, char 220 and executes. We need to just because TacO mandates only one @
in the code.
Try it online!
The relevant code is:
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";0
0//1;
try:echo -n;print(s[0:23]+"YZ");
except:print(s[0:15]+s[16:]);"""..."""
xonsh is a Python based shell so the code is shared with Python 3 and uses the same s
var as the shells and Rubies. I've used a technique I've used in many polyglots with Ruby to get this code in. 0//1
is integer division and the echo -n
works fine since xonsh is a shell so the execution of printing the required substring portion of s
with the literal string YZ
concatenated, then the rest of the program is a """
string.
The relevant code is:
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";0#'...'
[ -z $s ]&&echo ABCDEGHIJKLMNOPQRSTUVWXYZ&&exit;echo `[ $status = 1 ]&&echo \${s/Z/}&&exit;[ \e =~ e ]&&echo \${s/Y/}&&exit;\[ -z \$- \]&&echo ABC\${s#ABCD}&&exit;[ -z \$BASHPID ]&&echo \${s/K/}&&exit;[ -z $_OVM_PATH ]||echo $s|tr -d O;[ -z $_OVM_PATH ]||exit;[[ -n $USER_ID ]]&&echo \${s/M/}||echo \${s/B/}`;'...' #
Like the other shells, but in yash, the sequence \e
is not an escape sequence and so is just the string \e
which matches e
so $s
is printed substituting Y
for the empty string (${s/Y/}
).
Try it online!
Zsh + --continueonerror
The relevant code is:
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";0#'...'
[ -z $s ]&&echo ABCDEGHIJKLMNOPQRSTUVWXYZ&&exit;echo `[ $status = 1 ]&&echo \${s/Z/}&&exit;[ \e =~ e ]&&echo \${s/Y/}&&exit;\[ -z \$- \]&&echo ABC\${s#ABCD}&&exit;[ -z \$BASHPID ]&&echo \${s/K/}&&exit;[ -z $_OVM_PATH ]||echo $s|tr -d O;[ -z $_OVM_PATH ]||exit;[[ -n $USER_ID ]]&&echo \${s/M/}||echo \${s/B/}`;'...' #
Zsh is less tolerant of errors in a script than the other shells and so necessitates the --continueonerror
flag. In Zsh $status
is also set (in fish too) when a command fails, so if $status
is 1
, then $s
is echo
ed out, substituting Z
for the empty string (${s/Z/}
).
Try it online!
Validation suite.