In a programming language of your choice, write 95 programs, each of which outputs a different one of the 95 printable ASCII characters without that character occurring anywhere in the program.
For example, if your language was Python, your program that outputs the character P
might be
print(chr(80))
because P
has ASCII code 80. This program is valid because P
never appears in the source code. However, for the program that outputs lowercase p
, something like
print(chr(112))
would be invalid because, while it does print p
, p
is present in the code. A valid program could be
exec(chr(112)+'rint(chr(112))')
which prints p
but does not contain p
.
Your goal is to make each of your 95 programs as short as possible. Your score is the sum of the character lengths of all your programs.
If for any reason you are unable to write valid programs for some characters, you may mark those characters as "Did Not Program" or DNP, and omit programs for them entirely. This way syntactically strict languages will be able to compete.
The winning answer is the answer that has the lowest score of the set of answers that have the fewest DNP's.
Rules
The source code of all of your programs may only contain printable ASCII plus tabs and newlines, all of which are counted as one character. (Because in a different encoding it would be easy to omit characters that don't exist!)
- Note: This rule seems necessary but there are many languages with different encodings and I'm sure it'd be cool to see the answers for them. Therefore you can break this rule, you can use whatever characters you want, but then your answer becomes non-competitive, it cannot win.
The programs must be actual, full programs, according to your language's standard conventions. Functions and REPL snippets are not allowed.
Each program's output should go to stdout or your language's accepted alternative.
Programs should not prompt for or require input. (If prompting for input is inherent to your language, that's ok.)
Programs should be deterministic, finite in run time, and independent. e.g. it shouldn't matter if one is run in a folder separate from the other programs.
A program's output should be the precise printable ASCII character it corresponds to, optionally followed by a single trailing newline, nothing more, nothing less.
Be sure to include information on all 95 (ideally) programs in your answer, as well as your score and any DNP's. You don't have to list all programs that follow a simple pattern like "print(chr(80))
, print(chr(81))
, print(chr(82))
..." but make sure you're sure they all would work and that your score is added correctly.
For reference, here are the 95 printable ASCII your programs must output:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
-
\$\begingroup\$ If in my encoding 0x30 codes for, say, 日 rather than 0, then can I assume that the printable ASCII are the regular 95, minus 0, add 日? \$\endgroup\$Leaky Nun– Leaky Nun2016年08月21日 13:08:10 +00:00Commented Aug 21, 2016 at 13:08
-
4\$\begingroup\$ What? You need to use printable ASCII. That's just a rule. \$\endgroup\$Calvin's Hobbies– Calvin's Hobbies2016年08月21日 13:10:47 +00:00Commented Aug 21, 2016 at 13:10
-
3\$\begingroup\$ @Tim No. Doesn't follow the independence rule. \$\endgroup\$Calvin's Hobbies– Calvin's Hobbies2016年08月22日 02:21:29 +00:00Commented Aug 22, 2016 at 2:21
-
1\$\begingroup\$ Am I required to use ASCII-1967, or is ASCII-1963 okay? \$\endgroup\$Mark– Mark2016年08月22日 23:16:46 +00:00Commented Aug 22, 2016 at 23:16
-
1\$\begingroup\$ @Mark Use the modern '67 version. \$\endgroup\$Calvin's Hobbies– Calvin's Hobbies2016年08月27日 03:28:55 +00:00Commented Aug 27, 2016 at 3:28
62 Answers 62
Python 2, (削除) 1075 (削除ここまで) (削除) 1065 (削除ここまで) (削除) 1043 (削除ここまで) (削除) 1040 (削除ここまで) 1039 bytes
Each program has the form print'\<octal char code>'
, except:
'
→print"47円"
0
through8
→print~-<N+1>
9
→print-~8
\
→print'%c'%92
i
→exec'pr151円nt"151円"'
n
→exec'pri156円t"156円"'
p
→exec'160円rint"160円"'
r
→exec'p162円int"162円"'
t
→exec'prin164円"164円"'
For reference and ease of testing, here's the full list of programs, newline-separated.
print'40円'
print'41円'
print'42円'
print'43円'
print'44円'
print'45円'
print'46円'
print"47円"
print'50円'
print'51円'
print'52円'
print'53円'
print'54円'
print'55円'
print'56円'
print'57円'
print~-1
print~-2
print~-3
print~-4
print~-5
print~-6
print~-7
print~-8
print~-9
print-~8
print'72円'
print'73円'
print'74円'
print'75円'
print'76円'
print'77円'
print'100円'
print'101円'
print'102円'
print'103円'
print'104円'
print'105円'
print'106円'
print'107円'
print'110円'
print'111円'
print'112円'
print'113円'
print'114円'
print'115円'
print'116円'
print'117円'
print'120円'
print'121円'
print'122円'
print'123円'
print'124円'
print'125円'
print'126円'
print'127円'
print'130円'
print'131円'
print'132円'
print'133円'
print'%c'%92
print'135円'
print'136円'
print'137円'
print'140円'
print'141円'
print'142円'
print'143円'
print'144円'
print'145円'
print'146円'
print'147円'
print'150円'
exec'pr151円nt"151円"'
print'152円'
print'153円'
print'154円'
print'155円'
exec'pri156円t"156円"'
print'157円'
exec'160円rint"160円"'
print'161円'
exec'p162円int"162円"'
print'163円'
exec'prin164円"164円"'
print'165円'
print'166円'
print'167円'
print'170円'
print'171円'
print'172円'
print'173円'
print'174円'
print'175円'
print'176円'
To test:
$ python printables.py | sed ':a;N;$!ba;s/\n//g'
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
-1 bytes thanks to @Sp3000!
-
\$\begingroup\$
print~-<N+1>
doesn't work for1
. You said it works for0
to8
. \$\endgroup\$bb216b3acfd8f72cbc8f899d4d6963– bb216b3acfd8f72cbc8f899d4d69632016年08月21日 20:36:06 +00:00Commented Aug 21, 2016 at 20:36 -
8\$\begingroup\$ @Peanut It does. The code in
<angle brackets>
isn't literal code. Substitute<N+1>
with the literal value ofN+1
; in this case, the program for1
would beprint~-2
. See the full list of programs. \$\endgroup\$Copper– Copper2016年08月21日 20:48:14 +00:00Commented Aug 21, 2016 at 20:48
CJam, 269 bytes
Each of the programs are in the form '<char - 1>)
except for:
- Space =>
S
, 1 byte '
=>39c
, 3 bytes)
=>'*(
, 3 bytes0
=>T
, 1 byte1
=>X
, 1 byte2
=>Y
, 1 byte3
=>Z
, 1 byte4
-9
=><num-1>)
, 2 bytes
Score is: 3 * 82 + 1 + 3 + 3 + 4 * 1 + 6 * 2 = 269
-
\$\begingroup\$
39c
for'
? Also, you're forgetting that single digits can just be that number \$\endgroup\$Sp3000– Sp30002016年08月21日 13:38:23 +00:00Commented Aug 21, 2016 at 13:38 -
1\$\begingroup\$ @Sp3000 they can't because that would include the char you're producing in the input \$\endgroup\$Blue– Blue2016年08月21日 13:39:11 +00:00Commented Aug 21, 2016 at 13:39
-
\$\begingroup\$ But then use
1)
for2
etc to save one byte there \$\endgroup\$Luis Mendo– Luis Mendo2016年08月21日 13:39:50 +00:00Commented Aug 21, 2016 at 13:39 -
\$\begingroup\$ Sorry,
1)
was what I meant yeah \$\endgroup\$Sp3000– Sp30002016年08月21日 13:40:14 +00:00Commented Aug 21, 2016 at 13:40 -
\$\begingroup\$ Also, there's
TXYZ
\$\endgroup\$Sp3000– Sp30002016年08月21日 13:43:07 +00:00Commented Aug 21, 2016 at 13:43
Brainfuck, (削除) 1770 (削除ここまで) (削除) 1710 (削除ここまで) (削除) 1703 (削除ここまで) 1686 bytes
60 bytes saved by Dennis
17 bytes saved by Sp3000
DNP: 46 (.
)
>-[-[-<]>>+<]>-.
>-[-[-<]>>+<]>.
>-[-[-<]>>+<]>+.
>-[++>+[<]>+]>.
+[->-[---<]>-]>.
>-[+<[-<]>>++]<.
>+[-->+[<]>-]>-.
>+[-->+[<]>-]>.
>+[-->+[<]>-]>+.
--[>+<++++++]>--.
--[>+<++++++]>-.
-----[[----<]>>-]<.
--[>+<++++++]>+.
+[+[+>]<<++++]>.
+[-[--<]>>--]<.
-[>+<-----]>---.
-[>+<-----]>--.
-[>+<-----]>-.
-[>+<-----]>.
-[>+<-----]>+.
-[>+<-----]>++.
-[>+<-----]>+++.
>-[++>+[+<]>]>-.
>-[++>+[+<]>]>.
>-[++>+[+<]>]>+.
>-[++[+<]>>+<]>.
>+[+[<]>->++]<.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
+[-[>+<<]>-]>--.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
+[-[>+<<]>-]>.
-[+[>+<<]>+]>.
>+[+[<]>>+<+]>.
--[++>+[<]>+]>.
+[->-[--<]>-]>.
+[->-[--<]>-]>+.
+[->-[--<]>-]>++.
-[+[>---<<]>+]>.
-[>+<-------]>--.
-[>+<-------]>-.
-[>+<-------]>.
-[>+<-------]>+.
-[>+<-------]>++.
>+[+<[-<]>>++]<.
>+++[[-<]>>--]<.
+[+[>>+<+<-]>]>.
-[+>++[++<]>]>-.
-[+>++[++<]>]>.
-[>+<---]>----.
-[>+<---]>---.
-[>+<---]>--.
-[>+<---]>-.
-[>+<---]>.
-[>+<---]>+.
-[>+<---]>++.
-[+[+<]>>+]<.
-[+[+<]>>+]<+.
-[+[+<]>>+]<++.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
+[->---[-<]>-]>.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
>-->+[+[+<]>>+]<.
>+[+[>+<+<]>]>-.
>+[+[>+<+<]>]>.
+[-[---<]>>-]<-.
+[-[---<]>>-]<.
>-[--[<]>+>-]<.
-[>++<-----]>--.
-[>++<-----]>-.
-[>++<-----]>.
-[>++<-----]>+.
+[->-[<]>--]>-.
+[->-[<]>--]>.
+[->-[<]>--]>+.
>+[++[++>]<<+]>.
>+[++[++>]<<+]>+.
+[->-[<]>+>--]>.
-[>--<-------]>.
>+[+>+[<]>->]<.
>+[+>+[<]>->]<+.
-[+>+++++[<]>+]>.
>+[-->++[<]>-]>.
+[->->-[<]>--]>.
+[->->-[-<]>-]>.
+[->>-[-<+<]>]>.
----[>+++++<--]>.
------[>+++<--]>.
>+[>+[<]>->+]<-.
>+[>+[<]>->+]<.
----[>+++<--]>.
--[>+<--]>----.
--[>+<--]>---.
--[>+<--]>--.
--[>+<--]>-.
All except 43, 45, 60, 62, 91 and 93 are shamelessly stolen from Esolangs.org
-
3\$\begingroup\$ @βετѧΛєҫαγ Probably since it was mostly copied. \$\endgroup\$Calvin's Hobbies– Calvin's Hobbies2016年08月21日 14:27:10 +00:00Commented Aug 21, 2016 at 14:27
-
8\$\begingroup\$ @HelkaHomba I mean, BF constants are basically the shortest from what I know. Trying to do it yourself on already established constants is pointless. \$\endgroup\$Insane– Insane2016年08月22日 06:25:51 +00:00Commented Aug 22, 2016 at 6:25
-
3\$\begingroup\$
--[>-<---]>[<->--]<[->-<]>.
works for output+
. \$\endgroup\$Dennis– Dennis2016年08月27日 23:31:25 +00:00Commented Aug 27, 2016 at 23:31 -
3\$\begingroup\$ @Dennis A bit of bashing later:
-----[[----<]>>-]<.
\$\endgroup\$Sp3000– Sp30002016年08月28日 06:03:34 +00:00Commented Aug 28, 2016 at 6:03 -
2\$\begingroup\$ Also
+[+[+>]<<++++]>.
\$\endgroup\$Sp3000– Sp30002016年08月28日 06:08:36 +00:00Commented Aug 28, 2016 at 6:08
ASCII constrained x86 Machine Code for DOS, (削除) 3104 (削除ここまで) (削除) 3101 (削除ここまで) 2913 bytes
Well... It's shorter than Java, I guess...
(削除) 32 (削除ここまで) 30 bytes for almost all characters, for exceptions see below.
Most of the time it just follows the pattern:
- Do some
xor
to get a pointer to the end. sub
from the last 2 words because the opcode forint
is not in ASCII.- Get 2 into
AH
and the character intoDL
. Both arexor
ed because the character itself can't appear in the program and 2 is not a printable ASCII character. - Print the character with
int 21h
- Exit with
int 20h
Most of the time, if a character is disallowed, it can be replaced by either twiddling with the data a bit or switching to a different register.
It gets a bit more interesting when you suddenly find yourself unable to subtract or unable to push or pop the only register usable for calculations...
char code
hX'X5B&P[hT!^)7CC)7VX5t#PZ!C!B
! hX'X5B&P[hS ^)7CC)7VX5r"PZ B A
" hX'X5B&P[hS!^)7CC)7VX5q#PZ C B
# hX'X5B&P[hS ^)7CC)7VX5p"PZ B A
$ hX'X5B&P[hS ^)7CC)7VX5w"PZ B A
% hX'X5B&P[hS ^)7CC)7VX5v"PZ B A
& hX#X5B"P[hS ^)7CC)7VX5u"PZ B A
' hX#X5B"P[hS ^)7CC)7VX5t"PZ B A
( hX'X5B&P[hS ^)7CC)7VX5{"PZ B A
) hi'X5B&P[h!!X%BBHP^$!P_17C!?C17C!?hiBX5@@PZ2@2A
* hX'X5B&P[hS ^)7CC)7VX5y"PZ B A
+ hX'X5B&P[hS ^)7CC)7VX5x"PZ B A
, hX'X5B&P[hT ^)7CC)7VX5x"PZ!B!A
- hX'X5B&P[hS ^)7CC)7VX5~"PZ B A
. hX'X5B&P[hS ^)7CC)7VX5}"PZ B A
/ hX'X5B&P[hS ^)7CC)7VX5|"PZ B A
0 hX'X5B&P[hS ^)7CC)7VX5c"PZ B A
1 hX'X5B&P[hS ^)7CC)7VX5b"PZ B A
2 hX'X5B&P[hS ^)7CC)7VX5a"PZ B A
3 hX'X5B&P[hS ^)7CC)7VX5`"PZ B A
4 hX'X5B&P[hS ^)7CC)7VX5g"PZ B A
5 h;'X%[AP[h=S^)7CC)7VX%7"PZ _ ^
6 hX'X5B&P[hS ^)7CC)7VX5e"PZ B A
7 hX'X5B&P[hS _)?CC)?WX5d"PZ B A
8 hX'X5B&P[hS ^)7CC)7VX5k"PZ B A
9 hX'X5B&P[hS ^)7CC)7VX5j"PZ B A
: hX'X5B&P[hS ^)7CC)7VX5i"PZ B A
; hX'X5B&P[hS ^)7CC)7VX5h"PZ B A
< hX'X5B&P[hS ^)7CC)7VX5o"PZ B A
= hX'X5B&P[hS ^)7CC)7VX5n"PZ B A
> hX'X5B&P[hS ^)7CC)7VX5m"PZ B A
? hX'X5B&P[hS ^)7CC)7VX5l"PZ B A
@ hX'X5B&P[h` ^)7CC)7VX5 "PZ-B-A
A hX'X5B&P[h`!^)7CC)7VX5!#PZ-C-B
B h['X5A&P[h`"^)7CC)7VX5" PZ-D-C
C hX'X5B&P_h` ^)5GG)5VX5#"PZ-B-A
D hX'X5B&P[h` ^)7CC)7VX5$"PZ-B-A
E hX'X5B&P[h` ^)7CC)7VX5%"PZ-B-A
F hX'X5B&P[h` ^)7CC)7VX5&"PZ-B-A
G hX'X5B&P[h` ^)7CC)7VX5'"PZ-B-A
H hX'X5B&P[h` ^)7CC)7VX5("PZ-B-A
I hX'X5B&P[h` ^)7CC)7VX5)"PZ-B-A
J hX'X5B&P[h` ^)7CC)7VX5*"PZ-B-A
K hX'X5B&P[h` ^)7CC)7VX5+"PZ-B-A
L hX'X5B&P[h` ^)7CC)7VX5,"PZ-B-A
M hX'X5B&P[h` ^)7CC)7VX5-"PZ-B-A
N hX'X5B&P[h` ^)7CC)7VX5."PZ-B-A
O hX'X5B&P[h` ^)7CC)7VX5/"PZ-B-A
P hj'X5B&`[[[[[[[[h` ^)7CC)7VX50"`ZZZZZZZZ-B-A
Q hX'X5B&P[h` ^)7CC)7VX51"PZ-B-A
R hX'X5B&P[h` ^)7CC)7VX52"PZ-B-A
S hX'X5B&P[h` ^)7CC)7VX53"PZ-B-A
T hX'X5B&P[h` ^)7CC)7VX54"PZ-B-A
U hX'X5B&P[h` ^)7CC)7VX55"PZ-B-A
V hX'X5B&P[h` _)?CC)?WX56"PZ B A
W hX'X5B&P[h` ^)7CC)7VX57"PZ-B-A
X _TYhe'WWWQWWWa5B&P[hSS^)7CC)7CC5_C5 @PZ u t
Y hX'X5B&P[h` ^)7CC)7VX59"PZ-B-A
Z _WTYhzBX5 @Phe'WPWQWWWa5B&P[hSS^)7CC)7X u t
[ hX'X5B&P_h` ^)5GG)5VX5;"PZ-B-A
\ hX'X5B&P[h` ^)7CC)7VX5<"PZ-B-A
] hX'X5B&P[h` ^)7CC)7VX5="PZ-B-A
^ hX'X5B&P[h` _)?CC)?WX5>"PZ-B-A
_ hX'X5B&P[h` ^)7CC)7VX5?"PZ-B-A
` hX'X5B&P[hS ^)7CC)7VX53"PZ B A
a hX'X5B&P[hS ^)7CC)7VX52"PZ B A
b hX'X5B&P[hS ^)7CC)7VX51"PZ B A
c hX'X5B&P[hS ^)7CC)7VX50"PZ B A
d hX'X5B&P[hS ^)7CC)7VX57"PZ B A
e hX'X5B&P[hS ^)7CC)7VX56"PZ B A
f hX'X5B&P[hS ^)7CC)7VX55"PZ B A
g hX'X5B&P[hS ^)7CC)7VX54"PZ B A
h _WWX5b'5B&P[WX5S P^)7CC)7VX5;"PZ B A
i hX'X5B&P[hS ^)7CC)7VX5:"PZ B A
j hX'X5B&P[hS ^)7CC)7VX59"PZ B A
k hX'X5B&P[hS ^)7CC)7VX58"PZ B A
l hX'X5B&P[hS ^)7CC)7VX5?"PZ B A
m hX'X5B&P[hS ^)7CC)7VX5>"PZ B A
n hX'X5B&P[hS ^)7CC)7VX5="PZ B A
o hX'X5B&P[hS ^)7CC)7VX5<"PZ B A
p hX'X5B&P[hS ^)7CC)7VX5#"PZ B A
q hX'X5B&P[hS ^)7CC)7VX5""PZ B A
r hX'X5B&P[hS ^)7CC)7VX5!"PZ B A
s hX'X5B&P[hS ^)7CC)7VX5 "PZ B A
t hX'X5B&P[hS ^)7CC)7VX5'"PZ B A
u hX'X5B&P[hS ^)7CC)7VX5&"PZ B A
v hX'X5B&P[hS ^)7CC)7VX5%"PZ B A
w hX'X5B&P[hS ^)7CC)7VX5$"PZ B A
x hX'X5B&P[hS ^)7CC)7VX5+"PZ B A
y hX'X5B&P[hS ^)7CC)7VX5*"PZ B A
z hX'X5B&P[hS ^)7CC)7VX5)"PZ B A
{ hX'X5B&P[hS ^)7CC)7VX5("PZ B A
| hX'X5B&P[hS ^)7CC)7VX5/"PZ B A
} hX'X5B&P[hS ^)7CC)7VX5."PZ B A
~ hX'X5B&P[hS ^)7CC)7VX5-"PZ B A
Java 8, (削除) 6798 (削除ここまで) (削除) 6582 (削除ここまで) 6577 bytes
sigh
This is basically a port of my Python 2 answer, but with all the boilerplate that comes with writing a full program in Java.
Now without any DNPs at all! Thanks, Kevin Cruijssen!
Most of the programs have the form interface A{static void main(String[]a){System.out.print("\<octal char code>");}}
, except:
- space →
interface\tA{static\tvoid\tmain(String[]a){System.out.print("40円");}}
(but with the\t
s replaced by raw tabs) "
→interface A{static void main(String[]a){System.out.print('42円');}}
(
→interface A{static void main\u0028String[]a){System.out.print\u0028"50円");}}
)
→interface A{static void main(String[]a\u0029{System.out.print("51円"\u0029;}}
.
→interface A{static void main(String[]a){System\u002Eout\u002Eprint("56円");}}
0
→interface A{static void main(String[]a){System.out.print(1-1);}}
1
→interface A{static void main(String[]a){System.out.print(3-2);}}
2
→interface A{static void main(String[]a){System.out.print(3-1);}}
3
→interface A{static void main(String[]a){System.out.print(4-1);}}
4
→interface A{static void main(String[]a){System.out.print(5-1);}}
5
→interface A{static void main(String[]a){System.out.print(6-1);}}
6
→interface A{static void main(String[]a){System.out.print(7-1);}}
7
→interface A{static void main(String[]a){System.out.print(8-1);}}
8
→interface A{static void main(String[]a){System.out.print(9-1);}}
9
→interface A{static void main(String[]a){System.out.print(8+1);}}
;
→interface A{static void main(String[]a){System.out.print("73円")\u003B}}
A
→interface B{static void main(String[]a){System.out.print("101円");}}
S
→interface A{static void main(\u0053tring[]a){\u0053ystem.out.print("123円");}}
[
→interface A{static void main(String...a){System.out.print("133円");}}
\
→interface A{static void main(String[]a){System.out.print((char)92);}}
]
→interface A{static void main(String...a){System.out.print("135円");}}
a
→interf\u0061ce A{st\u0061tic void m\u0061in(String[]b){System.out.print("141円");}}
c
→interfa\u0063e A{stati\u0063 void main(String[]a){System.out.print("143円");}}
d
→interface A{static voi\u0064 main(String[]a){System.out.print("144円");}}
e
→class A{public static void main(String[]a){Syst\u0065m.out.print("145円");}}
f
→class A{public static void main(String[]a){System.out.print("146円");}}
g
→interface A{static void main(Strin\u0067[]a){System.out.print("147円");}}// \u0067
i
→\u0069nterface A{stat\u0069c vo\u0069d ma\u0069n(Str\u0069ng[]a){System.out.pr\u0069nt("151円");}}
m
→interface A{static void \u006Dain(String[]a){Syste\u006D.out.print("155円");}}
n
→class A{public static void mai\u006E(Stri\u006Eg[]a){System.out.pri\u006Et("156円");}}
o
→interface A{static v\u006Fid main(String[]a){System.\u006Fut.print("157円");}}
p
→interface A{static void main(String[]a){System.out.\u0070rint("160円");}}
r
→class A{public static void main(St\u0072ing[]a){System.out.p\u0072int("162円");}}
s
→interface A{\u0073tatic void main(String[]a){Sy\u0073tem.out.print("163円");}}
t
→class A{public s\u0074a\u0074ic void main(S\u0074ring[]a){Sys\u0074em.ou\u0074.prin\u0074("164円");}}
u
→interface A{static void main(String[]a){System.console().printf("%c",117);}}
v
→interface A{static \u0076oid main(String[]a){System.out.print("166円");}}
y
→interface A{static void main(String[]a){S\u0079stem.out.print("171円");}}
{
→interface A\u007Bstatic void main(String[]a)\u007BSystem.out.print("173円");}}
}
→interface A{static void main(String[]a){System.out.print("175円");\u007D\u007D
Phew
The Java compiler processes Unicode escapes like \u007B
before doing any other processing, which makes it possible to write code which uses unicode escapes in identifiers and even keywords. So, to write a program that doesn't use a character present in the boilerplate, we simply substitute it with it unicode escape.
For reference and ease of testing, here's the full list of programs, newline-separated and with the raw tabs replaced by four spaces:
interface A{static void main(String[]a){System.out.print("40円");}}
interface A{static void main(String[]a){System.out.print("41円");}}
interface A{static void main(String[]a){System.out.print('42円');}}
interface A{static void main(String[]a){System.out.print("43円");}}
interface A{static void main(String[]a){System.out.print("44円");}}
interface A{static void main(String[]a){System.out.print("45円");}}
interface A{static void main(String[]a){System.out.print("46円");}}
interface A{static void main(String[]a){System.out.print("47円");}}
interface A{static void main\u0028String[]a){System.out.print\u0028"50円");}}
interface A{static void main(String[]a\u0029{System.out.print("51円"\u0029;}}
interface A{static void main(String[]a){System.out.print("52円");}}
interface A{static void main(String[]a){System.out.print("53円");}}
interface A{static void main(String[]a){System.out.print("54円");}}
interface A{static void main(String[]a){System.out.print("55円");}}
interface A{static void main(String[]a){System\u002Eout\u002Eprint("56円");}}
interface A{static void main(String[]a){System.out.print("57円");}}
interface A{static void main(String[]a){System.out.print(1-1);}}
interface A{static void main(String[]a){System.out.print(3-2);}}
interface A{static void main(String[]a){System.out.print(3-1);}}
interface A{static void main(String[]a){System.out.print(4-1);}}
interface A{static void main(String[]a){System.out.print(5-1);}}
interface A{static void main(String[]a){System.out.print(6-1);}}
interface A{static void main(String[]a){System.out.print(7-1);}}
interface A{static void main(String[]a){System.out.print(8-1);}}
interface A{static void main(String[]a){System.out.print(9-1);}}
interface A{static void main(String[]a){System.out.print(8+1);}}
interface A{static void main(String[]a){System.out.print("72円");}}
interface A{static void main(String[]a){System.out.print("73円")\u003B}}
interface A{static void main(String[]a){System.out.print("74円");}}
interface A{static void main(String[]a){System.out.print("75円");}}
interface A{static void main(String[]a){System.out.print("76円");}}
interface A{static void main(String[]a){System.out.print("77円");}}
interface A{static void main(String[]a){System.out.print("100円");}}
interface B{static void main(String[]a){System.out.print("101円");}}
interface A{static void main(String[]a){System.out.print("102円");}}
interface A{static void main(String[]a){System.out.print("103円");}}
interface A{static void main(String[]a){System.out.print("104円");}}
interface A{static void main(String[]a){System.out.print("105円");}}
interface A{static void main(String[]a){System.out.print("106円");}}
interface A{static void main(String[]a){System.out.print("107円");}}
interface A{static void main(String[]a){System.out.print("110円");}}
interface A{static void main(String[]a){System.out.print("111円");}}
interface A{static void main(String[]a){System.out.print("112円");}}
interface A{static void main(String[]a){System.out.print("113円");}}
interface A{static void main(String[]a){System.out.print("114円");}}
interface A{static void main(String[]a){System.out.print("115円");}}
interface A{static void main(String[]a){System.out.print("116円");}}
interface A{static void main(String[]a){System.out.print("117円");}}
interface A{static void main(String[]a){System.out.print("120円");}}
interface A{static void main(String[]a){System.out.print("121円");}}
interface A{static void main(String[]a){System.out.print("122円");}}
interface A{static void main(\u0053tring[]a){\u0053ystem.out.print("123円");}}
interface A{static void main(String[]a){System.out.print("124円");}}
interface A{static void main(String[]a){System.out.print("125円");}}
interface A{static void main(String[]a){System.out.print("126円");}}
interface A{static void main(String[]a){System.out.print("127円");}}
interface A{static void main(String[]a){System.out.print("130円");}}
interface A{static void main(String[]a){System.out.print("131円");}}
interface A{static void main(String[]a){System.out.print("132円");}}
interface A{static void main(String...a){System.out.print("133円");}}
interface A{static void main(String[]a){System.out.print((char)92);}}
interface A{static void main(String...a){System.out.print("135円");}}
interface A{static void main(String[]a){System.out.print("136円");}}
interface A{static void main(String[]a){System.out.print("137円");}}
interface A{static void main(String[]a){System.out.print("140円");}}
interf\u0061ce A{st\u0061tic void m\u0061in(String[]b){System.out.print("141円");}}
interface A{static void main(String[]a){System.out.print("142円");}}
interfa\u0063e A{stati\u0063 void main(String[]a){System.out.print("143円");}}
interface A{static voi\u0064 main(String[]a){System.out.print("144円");}}
class A{public static void main(String[]a){Syst\u0065m.out.print("145円");}}
class A{public static void main(String[]a){System.out.print("146円");}}
interface A{static void main(Strin\u0067[]a){System.out.print("147円");}}
interface A{static void main(String[]a){System.out.print("150円");}}
\u0069nterface A{stat\u0069c vo\u0069d ma\u0069n(Str\u0069ng[]a){System.out.pr\u0069nt("151円");}}
interface A{static void main(String[]a){System.out.print("152円");}}
interface A{static void main(String[]a){System.out.print("153円");}}
interface A{static void main(String[]a){System.out.print("154円");}}
interface A{static void \u006Dain(String[]a){Syste\u006D.out.print("155円");}}
class A{public static void mai\u006E(Stri\u006Eg[]a){System.out.print("156円");}}
interface A{static v\u006Fid main(String[]a){System.\u006Fut.print("157円");}}
interface A{static void main(String[]a){System.out.\u0070rint("160円");}}
interface A{static void main(String[]a){System.out.print("161円");}}
class A{public static void main(St\u0072ing[]a){System.out.p\u0072int("162円");}}
interface A{\u0073tatic void main(String[]a){Sy\u0073tem.out.print("163円");}}
class A{public s\u0074a\u0074ic void main(S\u0074ring[]a){Sys\u0074em.ou\u0074.prin\u0074("164円");}}
interface A{static void main(String[]a){System.console().printf("%c",117);}}
interface A{static \u0076oid main(String[]a){System.out.print("166円");}}
interface A{static void main(String[]a){System.out.print("167円");}}
interface A{static void main(String[]a){System.out.print("170円");}}
interface A{static void main(String[]a){S\u0079stem.out.print("171円");}}
interface A{static void main(String[]a){System.out.print("172円");}}
interface A\u007Bstatic void main(String[]a)\u007BSystem.out.print("173円");}}
interface A{static void main(String[]a){System.out.print("174円");}}
interface A{static void main(String[]a){System.out.print("175円");\u007D\u007D
interface A{static void main(String[]a){System.out.print("176円");}}
Note that the program for u
makes use of System.console()
, which will return null (and thus cause the code to throw a NullPointerException
) if you call it from anything other than your OS' native terminal (cmd
on Windows, and, I assume, bash
on Linux/OSX).
To test, make a new directory and put the above code in a file named printables
in that directory. Then, run the following Bash script:
#!/bin/bash
split -l 1 printables
for i in x*; do
mkdir z$i
mv $i z$i/A.java
done
mv zxbh/A.java zxbh/B.java
for i in zx*; do
javac $i/[AB].java
if ! java -cp $i A 2> /dev/null; then
java -cp $i B
fi
done
rm -r zx*
The above script will put each line of printables
into its own directory, name them all A.java
(except for the file which prints A
, which is renamed to B.java
), compile each file, run them, then delete the evidence. It should take about ten seconds for the printable ASCII characters to start appearing in your shell.
If you're on Windows, instead run the following Batch file:
@echo off
setlocal enabledelayedexpansion
set i=0
for /F "tokens=*" %%L in (printables) do (
set file=A.java
if "%i%" == "33" (set file=B.java)
echo %%L>"%file%"
javac "%file%"
java -cp . A
if not errorlevel 0 (java -cp . B)
set /A i=%i% + 1
)
del *.java
del *.class
This batch file takes a slightly different approach; instead of pre-splitting the lines, it processes the file line-by-line and compiles and runs each program in turn. Again, it deletes the evidence after it finishes.
Saved countless bytes + the 1 DNP thanks to Kevin Cruijssen!
-
4\$\begingroup\$ I love the random
class B
for printingA
\$\endgroup\$Tas– Tas2016年08月23日 05:43:52 +00:00Commented Aug 23, 2016 at 5:43 -
\$\begingroup\$ You beat me to it. Yesterday at the end of the day I was writing an answer for Java using unicode escapes as well.. Ah well, +1, well-written answer and only 1 DNP isn't as bad as I thought beforehand for Java. ;) \$\endgroup\$Kevin Cruijssen– Kevin Cruijssen2016年08月23日 06:51:00 +00:00Commented Aug 23, 2016 at 6:51
-
2\$\begingroup\$ Btw, there is a possibility to remove the DNP for u if you use Java 8+ (
interface
instead of class so you can remove thepublic
) and if your OS has a Console built in, so you don't have to useSystem.out.print
:interface A{static void main(String[]a){System.console().printf("%1",(char)117);}}
Eclipse, IntelliJ and online compilers don't have this Console though, resulting in aNullPointerException
. \$\endgroup\$Kevin Cruijssen– Kevin Cruijssen2016年08月23日 07:13:02 +00:00Commented Aug 23, 2016 at 7:13 -
\$\begingroup\$ @KevinCruijssen Thanks! I'm working on reworking it now. \$\endgroup\$Copper– Copper2016年08月23日 13:30:18 +00:00Commented Aug 23, 2016 at 13:30
-
\$\begingroup\$ n: Forgot to escape
print
\$\endgroup\$WeaponsGrade– WeaponsGrade2016年08月23日 21:31:15 +00:00Commented Aug 23, 2016 at 21:31
MATL, (削除) 305, 302, 300 (削除ここまで) 297 bytes
Every single program looks like this:
33c
34c
35c
....
Except for
Digits. Here are the programs for 0-9:
O l H I K 4Q 5Q 6Q 7Q 8Q
'c'. This program is
'C'k
space. This is
0c
Since today I learned, that MATL treats character 0 as space. Thanks @LuisMendo!
You can use matl.tio to verify any of them.
For reference, here is all of them:
0c
33c
34c
35c
36c
37c
38c
39c
40c
41c
42c
43c
44c
45c
46c
47c
O
l
H
I
K
4Q
5Q
6Q
7Q
8Q
58c
59c
60c
61c
62c
63c
64c
65c
66c
67c
68c
69c
70c
71c
72c
73c
74c
75c
76c
77c
78c
79c
80c
81c
82c
83c
84c
85c
86c
87c
88c
89c
90c
91c
92c
93c
94c
95c
96c
97c
98c
'C'k
100c
101c
102c
103c
104c
105c
106c
107c
108c
109c
110c
111c
112c
113c
114c
115c
116c
117c
118c
119c
120c
121c
122c
123c
124c
125c
126c
-
\$\begingroup\$ @LuisMendo I'm still counting 297 \$\endgroup\$DJMcMayhem– DJMcMayhem2016年08月21日 15:13:28 +00:00Commented Aug 21, 2016 at 15:13
-
\$\begingroup\$ @LuisMendo I count 297 also. \$\endgroup\$Leaky Nun– Leaky Nun2016年08月21日 15:15:33 +00:00Commented Aug 21, 2016 at 15:15
-
\$\begingroup\$ Sorry, my mistake \$\endgroup\$Luis Mendo– Luis Mendo2016年08月21日 16:35:03 +00:00Commented Aug 21, 2016 at 16:35
><>, (削除) 443 (削除ここまで) 437 bytes
TIO interpreter link. There's a lot of patterns here:
[num][num]*o;
: Multiplication of two numbers, then output the result as a char witho
and halt with;
.><> digits go up to 15, i.e.0123456789abcdef
.- Similarly
[num][num]-n;
, which takes the difference of two numbers and outputs as a number withn
instead.
- Similarly
'-o[invalid char]
:><> is toroidal, so when the instruction pointer reaches the end of a line it moves back to the beginning. In this case, this causes the code to be executed twice, i.e.'-o[char]'-o[char]
. The first'-o[char]'
part pushes three chars to the stack,-
calculates'o' - [char]
theno
outputs the result as a character.><> then errors out when it reaches[char]
, either due to an unrecognised command or from popping an empty stack.- Similarly
'-n[invalid char]
, which outputs as a number. - Similarly
'[num][op]o[invalid char]
, which applies[op]
with[num]
on[char]
, erroring out on char. For example,'2+oJ
outputsL
, which is two more thanJ
. '
's code is"-oH
, using"
instead.-
's code is'%oB
, using%
instead.
- Similarly
ln;
: Push length of stack, output as num then halt, giving0
. Similarlylln;
for1
and'ln;
for3
.4|n+
: Push 4, bounce off the|
and push another 4, add, then output8
as num. Bounce off the|
again, and error out trying to executen
again on an empty stack.- Similarly
3|n*
for9
. - Similarly
[num]|o*
for@Qdy
.
- Similarly
'1-:00p
: The most interesting one, for theo
case. To avoid usingo
in our code, we need to usep
to place ano
in the codebox, then run it. The initial'1-:00p'
sets the stack up to have ap
on top, and1-
decrements it into ano
.:
duplicates thiso
, and00p
places oneo
at (0, 0), turning the codebox intoo1-:00p
. The instruction pointer wraps again, outputting the othero
. The (0, 0) char is then replaced a few more times before the program finally errors out.
'-oO
! '-oN
" '-oM
# '-oL
$ '-oK
% '-oJ
& '-oI
' "-oH
( '-oG
) '-oF
* '-oE
+ '-oD
, '-oC
- '%oB
. '-oA
/ '-o@
0 ln;
1 lln;
2 '-o=
3 'ln;
4 '-o;
5 61-n;
6 '-nh
7 '-ng
8 4|n+
9 3|n*
: '1-o;
; '6-oA
< 6a*o;
= '2+o;
> '3+o;
? 79*o;
@ 8|o*
A '-o.
B '-o-
C '-o,
D '-o+
E '-o*
F '-o)
G '-o(
H 89*o;
I '1-oJ
J '-o%
K '-o$
L '2+oJ
M 7b*o;
N '-o!
O '5+oJ
P 8a*o;
Q 9|o*
R '8+oJ
S '9+oJ
T 7c*o;
U 'b+oJ
V 'c+oJ
W 'd+oJ
X 8b*o;
Y 'f+oJ
Z 9a*o;
[ 7d*o;
\ 'c-oh
] 'b-oh
^ 'a-oh
_ '9-oh
` 8c*o;
a '7-oh
b 7e*o;
c 9b*o;
d a|o*
e '3-oh
f '2-oh
g '1-oh
h '2-oj
i 8d*o;
j '2+oh
k '3+oh
l 9c*o;
m '5+oh
n ab*o;
o '1-:00p
p 8e*o;
q '3-ot
r '2-ot
s '1-ot
t '1+os
u 9d*o;
v '2+ot
w '3+ot
x ac*o;
y b|o*
z '6+ot
{ '7+ot
| '8+ot
} '9+ot
~ 9e*o;
Ruby, 869 bytes
For the 63 characters @
through ~
, we have a 10-byte solution:
$><<"\xxx" (3 digit octal code)
$><<92.chr (special case for \)
For most (21) characters from space
through ?
, we have a 9-byte solution:
puts"\xx" (2 digit octal code)
There are eleven special cases left:
$><<34.chr (10 bytes for ")
p$. (3 bytes for 0)
p~-2 \
p~-3 \ (4 bytes for 1-8)
... /
p~-9 /
p 1+8 (5 bytes for 9)
In total, the score is 10×ばつかける63 +たす 9×ばつかける21 +たす 10 +たす 3 +たす 8×ばつかける4 +たす 5 =わ 869.
-
\$\begingroup\$ For the octal escapes you can use
?\xxx
instead of"\xxx"
for 1 byte each. \$\endgroup\$Jordan– Jordan2016年08月21日 15:15:45 +00:00Commented Aug 21, 2016 at 15:15 -
\$\begingroup\$ Why
p 1+8
and notp-~8
? \$\endgroup\$Cyoce– Cyoce2016年08月21日 18:03:45 +00:00Commented Aug 21, 2016 at 18:03 -
\$\begingroup\$ @Cyoce Ruby interprets that as binary
-
, or something. :( \$\endgroup\$lynn– lynn2016年08月21日 18:19:15 +00:00Commented Aug 21, 2016 at 18:19 -
\$\begingroup\$ @Jordan Noted, but I’m lazy... feel free to make the edit/recount n_n \$\endgroup\$lynn– lynn2016年08月21日 18:19:44 +00:00Commented Aug 21, 2016 at 18:19
-
3\$\begingroup\$ You can do most of these shorter with
putc 65
=>A
\$\endgroup\$histocrat– histocrat2016年08月28日 02:59:01 +00:00Commented Aug 28, 2016 at 2:59
Dyalog APL, (削除) 527 (削除ここまで) 522 bytes
(non-competing because APL cannot really be written using ASCII only)
Most are in the format nn⊃⎕AV
or nnn⊃⎕AV
, the exceptions being:
⊃'' ⍝ space: extract one char from an empty string
⎕THIS ⍝ hash: this namespace
⊃1↓⍕÷2 ⍝ period: the first char after stripping one char from 1÷2, i.e. 0.5
⊃⍬ ⍝ zero: extract one number from an empty numeric list
≢# ⍝ one: tally the root namespace
⍴⍬⍬ ⍝ two: count two empty lists
⎕WX ⍝ three: default "Window Expose" setting×ばつ⍨2 ⍝ four: ×ばつ2
6-1 ⍝ five: 6-1
!3 ⍝ six: 3!
6+1 ⍝ seven: 6+1
2*3 ⍝ eight: 23
3*2 ⍝ nine: 32
⊃⎕a ⍝ A: first character (Dyalog system names are case insensitive)
2⊃⎕A ⍝
⋮ ⍝ B-Y: n'th character
25⊃⎕A ⍝
⊃⌽⎕A ⍝ Z: last character
Here is the entire list:
⊃''
205⊃⎕AV
216⊃⎕AV
⎕THIS
62⊃⎕AV
13⊃⎕AV
219⊃⎕AV
14⊃⎕AV
186⊃⎕AV
249⊃⎕AV
181⊃⎕AV
170⊃⎕AV
195⊃⎕AV
169⊃⎕AV
⊃1↓⍕÷2
157⊃⎕AV
⊃⍬
≢#
⍴⍬ ×ばつ⍨2
6-1
!3
6+1
2*3
3*2
241⊃⎕AV
194⊃⎕AV
161⊃⎕AV
163⊃⎕AV
165⊃⎕AV
173⊃⎕AV
232⊃⎕AV
⊃⎕a
2⊃⎕A
3⊃⎕A
4⊃⎕A
5⊃⎕A
6⊃⎕A
7⊃⎕A
8⊃⎕A
9⊃⎕A
10⊃⎕A
11⊃⎕A
12⊃⎕A
13⊃⎕A
14⊃⎕A
15⊃⎕A
16⊃⎕A
17⊃⎕A
18⊃⎕A
19⊃⎕A
20⊃⎕A
21⊃⎕A
22⊃⎕A
23⊃⎕A
24⊃⎕A
25⊃⎕A
26⊃⎕A
156⊃⎕AV
159⊃⎕AV
250⊃⎕AV
236⊃⎕AV
17⊃⎕AV
238⊃⎕AV
18⊃⎕AV
19⊃⎕AV
20⊃⎕AV
21⊃⎕AV
22⊃⎕AV
23⊃⎕AV
24⊃⎕AV
25⊃⎕AV
26⊃⎕AV
27⊃⎕AV
28⊃⎕AV
29⊃⎕AV
30⊃⎕AV
31⊃⎕AV
32⊃⎕AV
33⊃⎕AV
34⊃⎕AV
35⊃⎕AV
36⊃⎕AV
37⊃⎕AV
38⊃⎕AV
39⊃⎕AV
40⊃⎕AV
41⊃⎕AV
42⊃⎕AV
43⊃⎕AV
124⊃⎕AV
193⊃⎕AV
126⊃⎕AV
176⊃⎕AV
-
1\$\begingroup\$ This format is less helpful than the other answers' format, in my opinion \$\endgroup\$Leaky Nun– Leaky Nun2016年08月21日 13:56:50 +00:00Commented Aug 21, 2016 at 13:56
-
\$\begingroup\$ @LeakyNun Do you mean to group them by method? There are quite a few exceptions. \$\endgroup\$Adám– Adám2016年08月21日 13:58:15 +00:00Commented Aug 21, 2016 at 13:58
-
2\$\begingroup\$ These are not all printable ASCII so technically invalid. But I'm going to add a note that non-printable ASCII is allowed for non-competitive submissions. \$\endgroup\$Calvin's Hobbies– Calvin's Hobbies2016年08月21日 13:59:54 +00:00Commented Aug 21, 2016 at 13:59
-
\$\begingroup\$ @HelkaHomba Oops, I didn't notice that requirement. \$\endgroup\$Adám– Adám2016年08月21日 14:09:31 +00:00Commented Aug 21, 2016 at 14:09
-
1\$\begingroup\$
⍨
is my new favorite smiley \$\endgroup\$Lucas Trzesniewski– Lucas Trzesniewski2016年08月21日 20:10:09 +00:00Commented Aug 21, 2016 at 20:10
PHP -r
((削除) 891 (削除ここまで) (削除) 680 (削除ここまで) 674 bytes, (削除) 2 (削除ここまで) 0 DNP)
Edit: saved 203 bytes thanks to jimmy23013 and implemented the 2 DNP thanks to Mego
This answer heavily abuses PHP's generous nature. Most of the cases take one of these forms (7 bytes each):
<?=Y^x;
<?=Z&e;
<?=V|Z;
PHP converts the letters on either side of the operator to strings, then performs the appropriate bitwise operation by converting each string to its ASCII character value, and finally converts the result back to a character.
In the first example above, Y^x
becomes 89^78
. The result of this is 33
, which is then sent to STDOUT as the character !
.
A script was written to bruteforce all possible combinations: the results can be found here.
Exceptions:
;
is <?=Z^a?>
(8 bytes)
|
is <?='9'^E;
(9 bytes)
<
and ?
would normally be DNP due to the required start tag, but by using the -r
flag, code can be executed without them:
<
is echo Z^f;
(9 bytes)
?
is echo Z^e;
(9 bytes)
=
is echo Z^g;
(9 bytes)
Score:
(7 * 90) + 8 +たす 9 +たす 9 +たす 9 +たす 9 =わ 674 bytes
-
\$\begingroup\$ @jimmy23013 Whoops, I misread the documentation. \$\endgroup\$user45941– user459412016年08月23日 09:54:51 +00:00Commented Aug 23, 2016 at 9:54
-
\$\begingroup\$ You can use
&
|
^
between two letters to generate all printable ascii characters except<?=|;
. \$\endgroup\$jimmy23013– jimmy230132016年08月23日 10:01:07 +00:00Commented Aug 23, 2016 at 10:01 -
\$\begingroup\$ @jimmy23013 That's bonkers. Just when I thought I'd learnt all the quirks of PHP! \$\endgroup\$Clamburger– Clamburger2016年08月23日 14:50:30 +00:00Commented Aug 23, 2016 at 14:50
-
1\$\begingroup\$ many of the standard form solutions could be optimized to save a byte with binary NOT
~
instead of XOR, AND or OR. PHP can use more printable characters as constants, than just letters. \$\endgroup\$Fabian Schmengler– Fabian Schmengler2016年08月23日 21:35:21 +00:00Commented Aug 23, 2016 at 21:35 -
1\$\begingroup\$ @fschmengler Unfortunately, as far as I can see, that would require the use of extended ASCII (or increasingly exotic unicode characters) which I believe is not valid for this challenge. \$\endgroup\$Clamburger– Clamburger2016年08月24日 00:21:22 +00:00Commented Aug 24, 2016 at 0:21
Brachylog, (削除) 546 (削除ここまで) 477 bytes
Credits to Fatalize for the code for @
.
In the list below, the first character is the character to be printed (for easy reference).
@S ! @Ht " @P:2m # @P:3m $ @P:4m % @P:5m & @P:6m ' @P:7m ( @P:8m ) @P:9m * @P:10m + @P:11m , @H:5m - @P:13m . @P:14m / @P:15m 0 1- 1 0+ 2 1+ 3 2+ 4 3+ 5 4+ 6 5+ 7 6+ 8 7+ 9 8+ : @P@4bhbbbh ; @P:27m < @P:28m = @P:29m > @P:30m ? @P:31m @ "?":"A"ybh A @Zt@u B @Ch@u C @P:35m D @P:36m E @P:37m F @P:38m G @P:39m H @P:40m I @P:41m J @P:42m K @P:43m L @P:44m M @P:45m N @P:46m O @P:47m P @A:15m@u Q @P:49m R @P:50m S @P:51m T @P:52m U @Vt@u V @P:54m W @Qt@u X @P:56m Y @Wt@u Z @At@u [ @P:59m \ @P:60m ] @P:61m ^ @P:62m _ @P:63m ` @P:64m a @Vh b @Ch c @Dbh d @A:3m e @Vbh f @A:5m g @A:6m h @A:7m i @A:8m j @A:9m k @C:7m l @C:8m m @D@2ht n @A:13m o @H:4m p @A:15m q @Z:9m r @Z:8m s @Z:7m t @Z:6m u @Vt v @Z:4m w @Qt x @Z:2m y @Wt z @At { @P:91m | @P:92m } @Prbh ~ @Pt
They are all predicates, so Z
needs to be the argument to receive the output: Try it online!
Explanation
@P
is this string:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
which contains every printable ASCII.
-
\$\begingroup\$ You can obtain
"@"
this way \$\endgroup\$Fatalize– Fatalize2016年08月21日 17:22:01 +00:00Commented Aug 21, 2016 at 17:22 -
\$\begingroup\$ @Fatalize Thanks, updated. \$\endgroup\$Leaky Nun– Leaky Nun2016年08月21日 17:24:18 +00:00Commented Aug 21, 2016 at 17:24
><>, 531 bytes
The programs take two main forms:
##*o;
"chr-1"1+o;
The first is for characters with character codes with two factors both less than 16, the other is for the other cases. Most numbers that I use the second form for have many equal length solutions, but I chose that one for readability.
Exceptions:
" b3*1+o; Would be "!"1+o; normally
0 11-n; n outputs as a number
1 22/n;
2-9 #1+n;
; ":"1+o* Ends in an error
Full list:
! b3*o;
" b3*1+o;
# 57*o;
$ 66*o;
% "$"1+o;
& "%"1+o;
' d3*o;
( a4*o;
) "("1+o;
* ")"1+o;
+ ","1-o;
, b4*o;
- 95*o;
. "-"1+o;
/ "."1+o;
0 11-n;
1 22/n;
2 11+n;
3 21+n;
4 31+n;
5 41+n;
6 51+n;
7 61+n;
8 71+n;
9 81+n;
: "9"1+o;
; ":"1+o*
< a6*o;
= "<"1+o;
> "="1+o;
? 97*o;
@ 88*o;
A d5*o;
B b6*o;
C "B"1+o;
D "C"1+o;
E "D"1+o;
F a7*o;
G "F"1+o;
H 98*o;
I "H"1+o;
J "D"1+o;
K e5*o;
L "K"1+o;
M b7*o;
N d6*o;
O "D"1+o;
P a8*o;
Q 99*o;
R "Q"1+o;
S "R"1+o;
T c7*o;
U "T"1+o;
V "U"1+o;
W "V"1+o;
X b8*o;
Y "X"1+o;
Z a9*o;
[ c7*o;
\ "["1+o;
] "\"1+o;
^ "]"1+o;
_ "^"1+o;
` c8*o;
a "`"1+o;
b e7*o;
c b9*o;
d aa*o;
e "d"1+o;
f "e"1+o;
g "g"1+o;
h d8*o;
i e7*o;
j "i"1+o;
k "j"1+o;
l c9*o;
m "l"1+o;
n ba*o;
o DNP
p e8*o;
q "p"1+o;
r "q"1+o;
s "r"1+o;
t "s"1+o;
u c9*o;
v "u"1+o;
w "v"1+o;
x ca*o;
y bb*o;
z "y"1+o;
~ e9*o;
-
\$\begingroup\$ Your
;
uses;
. Also, I'm fairly sure most of these can be golfed by erroring out, ando
is definitely possible. \$\endgroup\$Sp3000– Sp30002016年08月21日 17:52:21 +00:00Commented Aug 21, 2016 at 17:52 -
\$\begingroup\$ @Sp3000 Unless there is an interpreter that accepts both
o
andO
, I don't see howo
is possible. And how would ending in an error be shorter? \$\endgroup\$DanTheMan– DanTheMan2016年08月21日 18:05:08 +00:00Commented Aug 21, 2016 at 18:05 -
\$\begingroup\$
o
can be done by making using ofp
. I might post separately for erroring out though, because there'll probably a lot of different patterns involved. \$\endgroup\$Sp3000– Sp30002016年08月21日 18:08:59 +00:00Commented Aug 21, 2016 at 18:08 -
\$\begingroup\$ @Sp3000 I fixed the
;
program though. Thanks for pointing that out! \$\endgroup\$DanTheMan– DanTheMan2016年08月21日 18:09:37 +00:00Commented Aug 21, 2016 at 18:09
Malbolge, 618 bytes.
This answer is pretty much obvious, and it's trivial to outgolf, but it may be worth to give a shot.
Jokes aside, I highly doubt you can golf it, just the (
and '<' ones.
:7 - (&<`M^\
!:7 - (C<;_"K
":7 - (&&$_L]
#:8 - (&<;_L\J
$:7 - D'<A:^K
%:8 - (=&;_L]J
&:7 - D'%`M#o
':6 - (&%`M^
(:16 - DCBA@?>~<;{98xUB
):8 - (&<%:^KJ
*:7 - (&<`M]>
+:7 - (&&;_L]
,:7 - (=&;_L>
-:6 - D'%%_L
.:7 - ('%`M9o
/:6 - (=B;_L
0:6 - ('%$_L
1:7 - (&a%M"o
2:8 - (=&;:^"J
3:7 - ('<;_L"
4:7 - ('%;_L]
5:6 - D'%`#L
6:6 - (=<`:L
7:7 - (&<;:^K
8:8 - ('&;9ドル]J
9:7 - ('<;:^K
::6 - (&%`M?
;:8 - (C<A:^"J
<:10 - ('&%#^"J~Z
=:7 - DC&$_#K
>:6 - (&%`#L
?:6 - (=<`@L
@:7 - (&B%:^K
A:7 - (&<`M^8
B:5 - (&a%M
C:6 - D'%`M#
D:6 - (&%`M"
E:7 - ('&$_L\
F:7 - (&%$:^K
G:6 - (&%;_L
H:7 - ('&;:^K
I:6 - (C<;_L
J:6 - D'<;_L
K:7 - (&a%M^!
L:7 - (=<;_#K
M:7 - ('%$#^K
N:7 - (&&;_#K
O:7 - DC&$:^K
P:5 - (&a;M
Q:8 - ('%A9ドル]J
R:6 - (&<`M?
S:7 - (&a%M]\
T:5 - (=a;M
U:6 - D'<%_L
V:5 - (&aAM
W:5 - (=aNM
X:6 - (=aN_#
Y:7 - (&&$:^K
Z:7 - DC&$_"K
[:7 - (&%$_"K
\:1 - Q
]:5 - ('<`M
^:6 - ('B;_L
_:6 - (&<`M#
`:7 - DC&;_L"
a:6 - ('%`M#
b:7 - ('%;_9K
c:5 - (&aN_
d:6 - (&<`:L
e:7 - (&%;_"K
f:6 - (=<;_L
g:7 - ('%;_#K
h:7 - (&a%M^"
i:7 - ('%`M^"
j:8 - (=B;:^"J
k:5 - ('%`M
l:5 - (&&`M
m:6 - (&%`:L
n:7 - D'%;_Lo
o:6 - (=aN_9
p:6 - (CB;_L
q:7 - D'%A:^K
r:4 - (=aN
s:5 - (C<`M
t:7 - (&%;_L]
u:5 - (&aN:
v:6 - D'%`:L
w:7 - (&B;:^K
x:5 - (=a$M
y:5 - D'<`M
z:7 - (&%%:^K
{:5 - (=aN_
|:5 - (&a$M
}:5 - (&aN#
~:7 - (&%$_L"
WolframAlpha, 368 bytes
General format:
u+<character code in hexadecimal>
Exceptions:
Character Code
+ plus
0 1-1
1 0!
2 1+1
3 1+2
4 2+2
5 2+3
6 3!
7 3+4
8 4+4
9 4+5
u U+75
Here is the full list:
u+20
u+21
u+22
u+23
u+24
u+25
u+26
u+27
u+28
u+29
u+2A
plus
u+2C
u+2D
u+2E
u+2F
1-1
0!
1+1
1+2
2+2
2+3
3!
3+4
4+4
4+5
u+3A
u+3B
u+3C
u+3D
u+3E
u+3F
u+40
u+41
u+42
u+43
u+44
u+45
u+46
u+47
u+48
u+49
u+4A
u+4B
u+4C
u+4D
u+4E
u+4F
u+50
u+51
u+52
u+53
u+54
u+55
u+56
u+57
u+58
u+59
u+5A
u+5B
u+5C
u+5D
u+5E
u+5F
u+60
u+61
u+62
u+63
u+64
u+65
u+66
u+67
u+68
u+69
u+6A
u+6B
u+6C
u+6D
u+6E
u+6F
u+70
u+71
u+72
u+73
u+74
U+75
u+76
u+77
u+78
u+79
u+7A
u+7B
u+7C
u+7D
u+7E
Hexagony, (削除) 376 (削除ここまで) 373 bytes, 1 DNP
Thanks to FryAmTheEggman for saving 3 bytes.
Almost all programs have the same form:
P0;@
! P1;@
" P2;@
...
| Y2;@
} Y3;@
~ Y4;@
There are a few exceptions though:
- It's impossible to print
;
without using;
, hence 1 DNP. - To print
@
, we cannot use@
to terminate the program. Instead we use eitherS2;:
orS3;%
. This terminates with a division-by-zero error, but that error is not visible on STDOUT. So this is still four bytes. - There is one clash for
U
which would requireU3;@
. There are several ways to fix this, including switching to lower-case, i.e.n9;@
, or using increment or decrement, i.e.T);@
orV(;@
. In any case it's still four bytes. - Memory edges are initialised to
0
, and!
prints an integer value, so we can get0
and1
with!@
and)!@
, respectively, saving 3 bytes.
As for how the <letter><digit>;@
programs work: the hexagonal layout of a program of the form 1234
is always
1 2
3 4 .
. .
Since none of the programs contain any commands that redirect control flow, these are simply linear programs that are executed in order.
In every case, the letter at the beginning of the code sets the current memory edge to its character code. E.g. in the program P1;@
, the P
sets the value 80
. Then the digit multiplies this value by 10 and adds itself (i.e. the digit is appended to the current value). That gives 801
in the example above. Finally, ;
prints this value by taking it modulo 256 and using it as a byte value. In this case 801 % 256 = 33
and a !
is printed.
Marbelous, 220 bytes
For a character that is not a digit, it is just the two uppercase hex digits of the character code. For example, the following program outputs A
:
41
For a digit that is not 3
, replace 2F
in the following code by the uppercase hex digits of the character code - 1:
2F
++
For 3
:
66
>>
Total score: 2*85 + 5*10 = 220.
My first try was Bubblegum and it didn't work for characters before ?
...
Whitespace, 1643 bytes, 1 DNP
17 bytes for the characters [33-63] and 18 bytes for characters [64-126]
In Whitespace this is straight forward, because printable characters (except space) don't have any meaning anyway:
[SPACE][SPACE][SPACE][TAB][SPACE][SPACE][SPACE][SPACE][TAB][LF]
[TAB][LF]
[SPACE][SPACE][LF]
[LF]
[LF]
The program above prints a '!' (100001b).
Change [TAB][SPACE][SPACE][SPACE][SPACE][TAB]
in the first line to whichever character you like.
It's not possible to print a space without using a space, because printing anything always starts with [TAB][LF][SPACE]
-
2\$\begingroup\$ The space is a printable ASCII character ("printable ASCII" refers to the range 0x20 to 0x7E, inclusive), so you'll have to include that as 1 DNP unless you can find a way to print it without using any spaces. Apart from that, please include the score of the program. \$\endgroup\$Martin Ender– Martin Ender2016年08月22日 12:01:42 +00:00Commented Aug 22, 2016 at 12:01
Retina, 712 bytes, 2 DNPs
This was a collaborative effort with FryAmTheEggman.
There are several classes of solutions. For most characters from space to ^
, we use a program of the following form:
_
T`w`p
The character on the second line iterates through the ranges _0-9A-Za-z
while the rest remains unchanged. This turns the empty input into that character and then replaces it with the printable ASCII character (represented by p
) at the corresponding position. Each of these programs is 8 bytes long.
Within this range, there are only a few exceptions. Most importantly the digits can be shortened:
- 0:
x
(counts the number ofx
s in the empty input) - 1: (weehoo, empty program; counts the number of empty matches in the empty input)
2: now we turn the input into a single character, before counting empty strings:
1
3: same thing but we turn the input into two characters:
11
4: you get the idea...
111
5 - 9: plot twist... we use character repetition to avoid the second line getting any longer:
4$*
...
8$*
The other exception is that T
is a DNP: we don't think it's possible to generate a non-digit character without it appearing in the source code if transliteration stages can't be used.
On to the remaining characters. To print _
we use a similar program as the general solution above:
0
T`0`w
Making use of the fact that w
starts with _
.
Next, `
is the second DNP, because transliteration stages require those as well.
Then most of the lower-case letters are printed with something like this (which prints a
):
_
T`w`l
Again, the character on the second line increments through _0-9A-O
. Here, we just need to watch out for l
and w
, which we can print with the following programs, respectively:
P
T`p`w
6
T`p`l
Finally, only {|}~
are left, which require 9 bytes each. Here, we use the transliteration stage to increment the character that precedes them. E.g. ~
can be printed with:
}
T`_p`p
-
\$\begingroup\$ With the new version of Retina it's possible to print all letters (even T) with four bytes using $L and $u... I still couldn't find a way to print the backtick without using it, do you think it's possible? \$\endgroup\$Leo– Leo2018年03月01日 22:38:57 +00:00Commented Mar 1, 2018 at 22:38
-
\$\begingroup\$ @Leo No, I don't think so. I've been meaning to add another binary operator to substitution syntax which would be range expansion, which would solve the problem. I need to figure out how exactly I want to implement it though. Another option would be some substitution syntax feature to work with code points. \$\endgroup\$Martin Ender– Martin Ender2018年03月01日 23:15:36 +00:00Commented Mar 1, 2018 at 23:15
Haskell, (削除) 1874 1864 1856 1855 1795 1791 (削除ここまで) 1589 bytes, 7 DNPs
Most programs are main=putChar '\xx'
or main=putChar '\xxx'
where xx
/xxx
is the ascii code of the char to be printed.
This works for all but 14 chars:
!"#$%& ()*+,-./0123456789:;< >?@AB DEFGHIJKLMNOPQRSTUVWXYZ[ ]^_` bcdefg jkl o q s vwxyz{|}~
' = C \ a hi mn p r tu
However, for the digits (削除) 1 7 (削除ここまで) 4 bytes can be saved (thanks to Christian Sievers!):
0 main=print1ドル-1
1 main=print3ドル-2
2 main=print1ドル+1
3 main=print1ドル+2
...
The 52 programs up to c
(code 99) take 18 bytes, the remaining 19 take 19 bytes each.
Partial score: 10*14 + 52*18 + 19*19 = 1437
For 7 of the remaining chars, the following programs work:
main=putChar$'32円'
' main=putStr$pred<$>"("
C main=putStr['67円']
\ main=putChar$pred ']'
h main=putStr['104円']
p main=interact(\_->['112円'])
u main=interact(\_->['117円'])
Partial score: 18 +たす 22 +たす 18 +たす 21 +たす 19 +たす 27 +たす 27 =わ 152
This leaves 7 DNPs: =aimnrt
Each Haskell program needs to define a main (main=
), so that's 5 DNPs. To print to stdOut, putChar
, putStr
or interact
can be used, yielding t
and r
as further DNPs. (There is also print
, however print 'a'
prints 'a'
and not a
- and also contains t
and r
anyway.)
Haskell also has a chr
function which returns the corresponding char given a number, however in order to use it import Data.Char
is needed.
Total score: 1437 +たす 152 =わ 1589
, 7 DNPs
-
1\$\begingroup\$ With optional newlines allowed, we can get digits like this:
main=print1ドル-1
etc. \$\endgroup\$Christian Sievers– Christian Sievers2016年08月28日 02:56:56 +00:00Commented Aug 28, 2016 at 2:56 -
\$\begingroup\$ Your p program uses p (but can easily be fixed with
succ
) \$\endgroup\$Christian Sievers– Christian Sievers2016年08月28日 03:07:37 +00:00Commented Aug 28, 2016 at 3:07
Pyke, (削除) 364 (削除ここまで) (削除) 362 (削除ここまで) 355 bytes
2*1 + 3*2 + 14*3 + 2*4 + 5 + 73*4
All in the form w<chr(charcode+32)>.C
(4 bytes) except for:
- ->
d
1 byte 0
->Z
1 byte1
->~W
2 bytesa
->Gh
2 bytesz
->Ge
2 bytes- First 10 lowercase alphabet letters (except
a
) in formG<number>@
(3 bytes) k
->GT@
3 bytes>
->~Bh
3 bytes]
->~Be
3 bytesZ
->~le
3 bytes9
->~ue
3 bytesw
->G22@
4 bytes.
->~B4@
4 bytesC
->~K38@
5 bytes
JavaScript (ES6), (削除) 1083 (削除ここまで) 1068 bytes
General form:
alert`\xhex`
Exceptions:
0 alert(9-9)
...
8 alert(9-1)
9 alert(8+1)
\ alert(atob`XA`)
` alert('\x60')
a \u0061lert`\x61`
e al\u0065rt`\x65`
l a\u006cert`\x6c`
r ale\u0072t`\x72`
t aler\u0074`\x74`
x alert`\u0078`
Edit: Saved 15 bytes thanks to @GOTO0.
-
\$\begingroup\$ "x" needs special handling, too. Also, use
alert(atob`XA`)
for "\" to save a few bytes. \$\endgroup\$GOTO 0– GOTO 02016年08月21日 17:11:12 +00:00Commented Aug 21, 2016 at 17:11 -
\$\begingroup\$ @GOTO0 Ugh, I can't believe I forgot
x
. \$\endgroup\$Neil– Neil2016年08月21日 17:56:26 +00:00Commented Aug 21, 2016 at 17:56 -
1\$\begingroup\$ Javascript allows
\u
escapes in source code? Cool \$\endgroup\$Cyoce– Cyoce2016年08月21日 18:54:11 +00:00Commented Aug 21, 2016 at 18:54 -
\$\begingroup\$ @Cyoce: In identifiers, yes, in general, no. \$\endgroup\$Bergi– Bergi2016年08月21日 23:02:28 +00:00Commented Aug 21, 2016 at 23:02
-
\$\begingroup\$ @Bergi Unicode escapes are processed first, so you can write your entire source in terms of unicode escapes if you like, while hex escapes only work inside strings. \$\endgroup\$Neil– Neil2016年08月21日 23:12:01 +00:00Commented Aug 21, 2016 at 23:12
05AB1E, 417 bytes
! 62D>B
" 63D>B
# 64D>B
$ 65D>B
% 66D>B
& 67D>B
' 68D>B
( 69D>B
) 70D>B
* 71D>B
+ 72D>B
, 73D>B
- 74D>B
. 75D>B
/ 76D>B
0 1<
1 X
2 Y
3 Z
4 3>
5 4>
6 5>
7 6>
8 7>
9 8>
: 77D>B
; 78D>B
< 79D>B
= 80D>B
> 81D1+B
? 82D>B
@ 83D>B
A Th
B T>h
C T>>h
D T3+h
E T4+h
F T5+h
G 16D>B
H 17D>B
I 18D>B
J 19D>B
K 20D>B
L 21D>B
M 22D>B
N 23D>B
O 24D>B
P 25D>B
Q 26D>B
R 27D>B
S 28D>B
T 29D>B
U 30D>B
V 31D>B
W 33D>B
X 33D>B
Y A`\u
Z A`u
[ 84D>B
\ 85D>B
] 86D>B
^ 87D>B
_ 88D>B
` 89D>B
a A`r
b A`r\
c 38D>B
d 39D>B
e 40D>B
f 41D>B
g 42D>B
h 43D>B
i 44D>B
j 45D>B
k 46D>B
l 47D>B
m 48D>B
n 49D>B
o 50D>B
p 51D>B
q 52D>B
r 53D>B
s 54D>B
t 55D>B
u 56D>B
v 57D>B
w 58D>B
x A`\\
y A`\
z A`
{ 90D>B
| 91D>B
} 92D>B
~ 93D>B
Explanation
Most are 5 bytes long of the form: convert nr to base nr+1
.
>
needs an extra byte since we can't use increment for that.
a,b,x,y,z,Y,Z
are extracted from A
which contains the alphabet in lower case.
A,B,C,D,E,F
are numbers converted to hex.
0-9
are simple increment/decrements as well as predefined variables.
Perl 6: 921 bytes
Translation of the Python solution.
Each program has the form say "\x<hex escape code>"
, except:
s
→put "\x73"
a
→put "\x61"
y
→put "\x79"
→
"\x20".say
"
→say chr 34
\
→say chr 92
x
→say chr 120
0
→say 1-1
1
→say 3-2
2
to9
→say <n minus one>+1
For reference and ease of testing, here's the full list of programs, newline-separated.
"\x20".say
say "\x21"
say chr 34
say "\x23"
say "\x24"
say "\x25"
say "\x26"
say "\x27"
say "\x28"
say "\x29"
say "\x2A"
say "\x2B"
say "\x2C"
say "\x2D"
say "\x2E"
say "\x2F"
say 1-1
say 3-2
say 1+1
say 2+1
say 3+1
say 4+1
say 5+1
say 6+1
say 7+1
say 8+1
say "\x3A"
say "\x3B"
say "\x3C"
say "\x3D"
say "\x3E"
say "\x3F"
say "\x40"
say "\x41"
say "\x42"
say "\x43"
say "\x44"
say "\x45"
say "\x46"
say "\x47"
say "\x48"
say "\x49"
say "\x4A"
say "\x4B"
say "\x4C"
say "\x4D"
say "\x4E"
say "\x4F"
say "\x50"
say "\x51"
say "\x52"
say "\x53"
say "\x54"
say "\x55"
say "\x56"
say "\x57"
say "\x58"
say "\x59"
say "\x5A"
say "\x5B"
say chr 92
say "\x5D"
say "\x5E"
say "\x5F"
say "\x60"
put "\x61"
say "\x62"
say "\x63"
say "\x64"
say "\x65"
say "\x66"
say "\x67"
say "\x68"
say "\x69"
say "\x6A"
say "\x6B"
say "\x6C"
say "\x6D"
say "\x6E"
say "\x6F"
say "\x70"
say "\x71"
say "\x72"
put "\x73"
say "\x74"
say "\x75"
say "\x76"
say "\x77"
say chr 120
put "\x79"
say "\x7A"
say "\x7B"
say "\x7C"
say "\x7D"
say "\x7E"
Here's the code I used to test the above listing, and count the score:
#!/usr/bin/env perl6
my $file = 'print_ascii_characters.p6';
my @expected = ' ' .. '~';
my @code = $file.IO.lines;
my $code = @code.join: ';';
my @got = (run 'perl6', '-e', $code, :out).out.lines.map: |*.comb;
given +@expected, +@got, +@code -> ($e, $g, $c) {
say "WRONG COUNT: Expected $e / output $g / source $c" and exit if not $e == $g == $c;
}
for @expected Z @got -> ($e, $g) {
say "WRONG OUTPUT: Expected {$e.perl}, got {$g.perl}" and exit if $e ne $g;
}
for @expected Z @code -> ($char, $code) {
say "COLLISION: {$char.perl} contained in {$code.perl}" if $code.match($char);
}
say "SCORE: ", @code.map(*.chars).sum;
-
\$\begingroup\$ @sch In Perl 5 that would work, but I tried to do it in Perl 6, where the space after
say
is required and octal escape sequences are written as\o77
. Feel free to post a separate Perl 5 solution... :) \$\endgroup\$smls– smls2016年08月23日 12:30:13 +00:00Commented Aug 23, 2016 at 12:30 -
\$\begingroup\$ Sorry, I missed the perl 6 part in your answer. \$\endgroup\$sch– sch2016年08月23日 13:16:44 +00:00Commented Aug 23, 2016 at 13:16
Jelly (non-competitive), 406 bytes
32Ọ
33Ọ
34Ọ
35Ọ
36Ọ
37Ọ
38Ọ
39Ọ
40Ọ
41Ọ
42Ọ
43Ọ
44Ọ
45Ọ
46Ọ
47Ọ
48Ọ
49Ọ
50Ọ
51Ọ
52Ọ
49+4Ọ
54Ọ
55Ọ
56Ọ
57Ọ
58Ọ
59Ọ
60Ọ
61Ọ
62Ọ
63Ọ
64Ọ
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Ọ
91Ọ
92Ọ
93Ọ
94Ọ
95Ọ
96Ọ
97Ọ
98Ọ
99Ọ
3Ọ
101Ọ
102Ọ
103Ọ
104Ọ
105Ọ
106Ọ
107Ọ
108Ọ
109Ọ
110Ọ
111Ọ
112Ọ
113Ọ
114Ọ
115Ọ
116Ọ
117Ọ
118Ọ
119Ọ
120Ọ
121Ọ
122Ọ
123Ọ
124Ọ
125Ọ
126Ọ
This prints all characters from 32 - 126. The byte count is calculated with https://mothereff.in/byte-counter.
-
1\$\begingroup\$ I don't think this is a valid answer. First off, you're not allowed to take an input, and second off, this is one program, not 95 programs. The challenge says
In a programming language of your choice, write 95 programs, each of which outputs a different one of the 95 printable ASCII characters without that character occurring anywhere in the program.
\$\endgroup\$DJMcMayhem– DJMcMayhem2016年08月28日 02:46:40 +00:00Commented Aug 28, 2016 at 2:46 -
\$\begingroup\$ @DJMcMayhem Ok, I'll change that \$\endgroup\$Aly– Aly2016年08月28日 02:48:45 +00:00Commented Aug 28, 2016 at 2:48
-
\$\begingroup\$ DJ is correct. This is blatantly invalid. \$\endgroup\$Calvin's Hobbies– Calvin's Hobbies2016年08月28日 02:50:43 +00:00Commented Aug 28, 2016 at 2:50
-
\$\begingroup\$ @HelkaHomba is my byte count the total of all programs? \$\endgroup\$Aly– Aly2016年08月28日 02:53:45 +00:00Commented Aug 28, 2016 at 2:53
-
1\$\begingroup\$ Thanks for fixing it, and welcome to the site! I hope you enjoy it here. Also, just so you know, Jelly uses a custom code page, so in this case it really is 406 chars, even though it would be 503 in UTF-8. \$\endgroup\$DJMcMayhem– DJMcMayhem2016年08月28日 04:48:16 +00:00Commented Aug 28, 2016 at 4:48
R, 1040 bytes
-2 bytes by using as.name
.
The credit for this answer should go to digEmAll, who did 499(!) bytes better than my version (left below). Most characters are printed by using the octal representation, e.g. cat('041円')
prints character number 41 in octal, or 33 in decimal, i.e. !
. There are a couple of minor additional tricks, explained in more detail in my original answer below. For the characters ct
, use as.name
instead of cat
; for the characters ()
redefine the function ?
which has a special syntax and doesn't need brackets.
The solution for a
is
`c141円t`('141円')
since c141円t
in backticks is interpreted as cat
.
The other notable exception is the character \
, for which we have to use the more standard cat(intToUtf8(92))
.
cat('','')
cat('041円')
cat('042円')
cat('043円')
cat('044円')
cat('045円')
cat('046円')
cat("047円")
`?`=cat;?'050円'
`?`=cat;?'051円'
cat('052円')
cat('053円')
cat('054円')
cat('055円')
cat('056円')
cat('057円')
cat(+F)
cat(+T)
cat(1+1)
cat(2+1)
cat(3+1)
cat(4+1)
cat(5+1)
cat(6+1)
cat(7+1)
cat(8+1)
cat('072円')
cat('073円')
cat('074円')
cat('075円')
cat('076円')
cat('077円')
cat('100円')
cat('101円')
cat('102円')
cat('103円')
cat('104円')
cat('105円')
cat('106円')
cat('107円')
cat('110円')
cat('111円')
cat('112円')
cat('113円')
cat('114円')
cat('115円')
cat('116円')
cat('117円')
cat('120円')
cat('121円')
cat('122円')
cat('123円')
cat('124円')
cat('125円')
cat('126円')
cat('127円')
cat('130円')
cat('131円')
cat('132円')
cat('133円')
cat(intToUtf8(92))
cat('135円')
cat('136円')
cat('137円')
cat('140円')
`c141円t`('141円')
cat('142円')
as.name('143円')
cat('144円')
cat('145円')
cat('146円')
cat('147円')
cat('150円')
cat('151円')
cat('152円')
cat('153円')
cat('154円')
cat('155円')
cat('156円')
cat('157円')
cat('160円')
cat('161円')
cat('162円')
cat('163円')
as.name('164円')
cat('165円')
cat('166円')
cat('167円')
cat('170円')
cat('171円')
cat('172円')
cat('173円')
cat('174円')
cat('175円')
cat('176円')
Original version:
R, 1541 bytes
Most non-alphanumeric characters are of the form cat(intToUtf8(33))
. The intToUtf8
part can be made shorter for most alphanumeric characters. The main issue is the characters cat()
, which I will handle last.
For digits, simple operations like cat(1+1)
work.
For letters, the shortest seems to be to use the constants letters
and LETTERS
(the alphabet) whenever possible, e.g. cat(LETTERS[1])
for A
. This doesn't work for the characters LETRSletrs
, for which we move to the slightly longer cat(toupper("l"))
or cat(tolower("S"))
. For elr
we have to revert to cat(intToUtf8(101))
and the like.
The code for the space can be made shorter with cat('','')
, because cat
will by default add spaces between strings (here two empty strings).
The brackets ()
are annoying: not using them seems to disallow calling functions. Here I used a standard R golfing technique, redefining some unary functions which have special syntax: cat(intToUtf8(40))
becomes
`?`=cat;`!`=intToUtf8;?!40
Finally, the letters cat
. We need the cat()
function, otherwise R will add some fluff; for example letters[1]
or print(letters[1])
outputs [1] "a"
instead of a
. We'll need two distinct workarounds.
The function write
is usually used to write to a file, but can be made to write to STDOUT: write(letters[1],'')
works for a
and c
. Unfortunately, that still doesn't work for t
. I almost gave up here...
Let's take a step back. The reason R adds [1]
by default when printing is that most objects are of a vector type (here, a vector of length 1). The main exceptions are functions; in particular, calling for the body()
or args()
of a function doesn't add anything, but I couldn't find a way to use this. There are however internal non-vector types, such as promises, expressions and symbols (the latter are also called names), so a solution is to use as.name
: as.name("t")
converts the string to an object name, and outputs it at just t
. I also used this for c
, since as.name(letters[3])
is shorter than write(letters[3],'')
(but we still need write
for a
).
We now need to find a way of creating the string "t"
, but cannot use letters
, tolower
or intToUtf8
. The best I could come up with is as.name(rawToChar(as.raw(116)))
.
Full list:
cat('','')
cat(intToUtf8(33))
cat(intToUtf8(34))
cat(intToUtf8(35))
cat(intToUtf8(36))
cat(intToUtf8(37))
cat(intToUtf8(38))
cat(intToUtf8(39))
`?`=cat;`!`=intToUtf8;?!40
`?`=cat;`!`=intToUtf8;?!41
cat(intToUtf8(42))
cat(intToUtf8(43))
cat(intToUtf8(44))
cat(intToUtf8(45))
cat(intToUtf8(46))
cat(intToUtf8(47))
cat(1-1)
cat(3-2)
cat(1+1)
cat(2+1)
cat(3+1)
cat(4+1)
cat(5+1)
cat(6+1)
cat(7+1)
cat(8+1)
cat(intToUtf8(58))
cat(intToUtf8(59))
cat(intToUtf8(60))
cat(intToUtf8(61))
cat(intToUtf8(62))
cat(intToUtf8(63))
cat(intToUtf8(64))
cat(LETTERS[1])
cat(LETTERS[2])
cat(LETTERS[3])
cat(LETTERS[4])
cat(toupper("e"))
cat(LETTERS[6])
cat(LETTERS[7])
cat(LETTERS[8])
cat(LETTERS[9])
cat(LETTERS[10])
cat(LETTERS[11])
cat(toupper("l"))
cat(LETTERS[13])
cat(LETTERS[14])
cat(LETTERS[15])
cat(LETTERS[16])
cat(LETTERS[17])
cat(toupper("r"))
cat(toupper("s"))
cat(toupper("t"))
cat(LETTERS[21])
cat(LETTERS[22])
cat(LETTERS[23])
cat(LETTERS[24])
cat(LETTERS[25])
cat(LETTERS[26])
cat(intToUtf8(91))
cat(intToUtf8(92))
cat(intToUtf8(93))
cat(intToUtf8(94))
cat(intToUtf8(95))
cat(intToUtf8(96))
write(letters[1],'')
cat(letters[2])
as.name(letters[3])
cat(letters[4])
cat(intToUtf8(101))
cat(letters[6])
cat(letters[7])
cat(letters[8])
cat(letters[9])
cat(letters[10])
cat(letters[11])
cat(intToUtf8(108))
cat(letters[13])
cat(letters[14])
cat(letters[15])
cat(letters[16])
cat(letters[17])
cat(intToUtf8(114))
cat(tolower("S"))
as.name(rawToChar(as.raw(116)))
cat(letters[21])
cat(letters[22])
cat(letters[23])
cat(letters[24])
cat(letters[25])
cat(letters[26])
cat(intToUtf8(123))
cat(intToUtf8(124))
cat(intToUtf8(125))
cat(intToUtf8(126))
-
\$\begingroup\$ 1042 bytes (1136-94) \$\endgroup\$digEmAll– digEmAll2019年08月21日 12:13:15 +00:00Commented Aug 21, 2019 at 12:13
-
\$\begingroup\$ @digEmAll Impressive! Deserves a separate answer I think. \$\endgroup\$Robin Ryder– Robin Ryder2019年08月21日 12:29:59 +00:00Commented Aug 21, 2019 at 12:29
-
\$\begingroup\$ no need... it's basically like using of intToUtf8 directly in the string literal \$\endgroup\$digEmAll– digEmAll2019年08月21日 12:37:05 +00:00Commented Aug 21, 2019 at 12:37
-
\$\begingroup\$ @digEmAll Still, it shows knowledge of the quirks of the language that I had never heard of until a few minutes ago. \$\endgroup\$Robin Ryder– Robin Ryder2019年08月21日 12:39:29 +00:00Commented Aug 21, 2019 at 12:39
-
1\$\begingroup\$
as.name
printing without the[1]
fluff is a good find ! \$\endgroup\$digEmAll– digEmAll2019年08月22日 11:42:44 +00:00Commented Aug 22, 2019 at 11:42
BBC Basic, (削除) 422 (削除ここまで) 413 bytes
Download interpreter free at http://www.bbcbasic.co.uk/bbcwin/bbcwin.html
9 bytes saved thanks to Leaky Nun.
General form
V.<character code>
32..99 excluding 12 special cases: 56x4= 224 bytes
100..126 : 27x5= 135 bytes
12 special cases : 54 bytes
Most numbers follow the general form, but I included them all here to show where the problem is.
First character is the character to be printed.
. VDU46 :REM Full form of the command used in general form: send character 46 to VDU)
V P.CHR86ドル :REM short for PRINT CHR$(86)
0 V.48
1 V.49
2 V.50
3 V.51
4 V.52
5 P.1+4
6 V.54
7 V.55
8 V.56
9 V.57
-
\$\begingroup\$ Why not use
V.48
for0
? \$\endgroup\$Leaky Nun– Leaky Nun2016年08月21日 15:43:09 +00:00Commented Aug 21, 2016 at 15:43 -
\$\begingroup\$ Woah, have the
V.
andP.
commands always been there? \$\endgroup\$Beta Decay– Beta Decay2016年08月21日 18:16:27 +00:00Commented Aug 21, 2016 at 18:16 -
\$\begingroup\$ @βετѧΛєҫαγ Yes but the editor expands them to the full words VDU and PRINT after typing (but they are interpreted without expansion at the BASIC commandline). Most capital letters followed by
.
will expand into a keyword. This challenge is strict about using nonprintable ASCII but arguably with other challenges you could say the tokenised keywords (ascii 127-255) were one byte. That said I have never tried that argument, and usually give both scores. \$\endgroup\$Level River St– Level River St2016年08月21日 18:58:36 +00:00Commented Aug 21, 2016 at 18:58 -
\$\begingroup\$ @LevelRiverSt I see \$\endgroup\$Beta Decay– Beta Decay2016年08月21日 19:00:01 +00:00Commented Aug 21, 2016 at 19:00
Minkolang 0.15, 604 bytes
For most characters, "<char-1>"1+O.
would be a valid program, perhaps one of the shortest. However, due to the fact that characters are stored as code points on the stack means that many of them can be produced by multiplication and addition, in five bytes or fewer. Also, note that l, 1,ドル 2,ドル 3,ドル 4,ドル 5,ドル 6,ドル $l
are 10, 11, 12, 13, 14, 15, 16, 100
respectively.
Format: <character>: <program>
: 48*O.
!: 13ドル*O.
": 66*2-O.
#: 57*O.
$: 66*O.
%: 66*1+O.
&: 4l*2-O.
': 33ドル*O.
(: 4l*O.
): 4l*1+O.
*: ")"1+O.
+: "*"1+O.
,: 14ドル*O.
-: 59*O.
.: "-"1+d10ドルpO-
/: "."1+O.
0: 68*O.
1: 77*O.
2: 5l*O.
3: 5l*1+O.
4: lZIO.
5: lZdIO.
6: 239**O.
7: 51ドル*O.
8: 44ドル*O.
9: 6l*3-O.
:: 6l*2-O.
;: 6l*1-O.
<: 6l*O.
=: 6l*1+O.
>: 6l*2+O.
?: 79*O.
@: 88*O.
A: 53ドル*O.
B: 61ドル*O.
C: 7l*3-O.
D: 7l*2-O.
E: 7l*1-O.
F: 7l*O.
G: 7l*1+O.
H: 89*O.
I: 89*1+O.
J: 89*2+O.
K: 355**O.
L: 89*4+O.
M: 71ドル*O.
N: 63ドル*O.
O: "N"1+d90pN.
P: 8l*O.
Q: 99*O.
R: 8l*2+O.
S: 8l*3+O.
T: 347**O.
U: 8l*5+O.
V: 8l*6+O.
W: 8l*7+O.
X: 81ドル*O.
Y: 8l*9+O.
Z: 9l*O.
[: $l9-O.
\: $l8-O.
]: $l7-O.
^: $l6-O.
_: $l5-O.
`: 82ドル*O.
a: $l3-O.
b: $l2-O.
c: 91ドル*O.
d: $lO.
e: $l1+O.
f: $l2+O.
g: $l3+O.
h: $l4+O.
i: $l5+O.
j: $l6+O.
k: $l7+O.
l: $l8+O.
m: $l9+O.
n: l1ドル*O.
o: $l1ドル+O.
p: $l2ドル+O.
q: $l3ドル+O.
r: $l4ドル+O.
s: $l5ドル+O.
t: $l6ドル+O.
u: "t"1+O.
v: "u"1+O.
w: 7dl+*O.
x: 358**O.
y: 1ドルd*O.
z: 53;3-O.
{: 53;2-O.
|: 53;1-O.
}: 53;O.
~: 53;1+O.
Special mentions:
.: "-"1+d10ドルpO-
(Try it.) Minkolang has the ability to modify the characters in the code box, so what this program does is that it replaces that -
at the end with .
, which is necessary for stopping the program. "N"1+d90pN.
for O
works the same way.
4: lZIO.
(Try it.) lZ
pushes the uppercase and lowercase alphabets to the stack, and I
pushes the length of the stack, which is 52, precisely the code point of "4". The best part is that I was initially considering the solution of 43ドル*O.
, which multiplies 4 and 13 to get 52, but couldn't because it had a 4 in it, so I ended up finding a golfier solution anyway!
y: 1ドルd*O.
(Try it.) d
duplicates the top of stack, so what this piece of code does is that it pushes 11
, duplicates it, and then multiplies. An alternate way to write this would have been 12ドル;O.
, which has the same byte count.
}: 53;O.
(Try it.) ;
is exponentiation, so this does 5^3 to get 125.
Groovy, 1019 bytes
I had a different Groovy solution written up (see below), but after I submitted it I did a bit more digging into character escapes, hoping to find a way of shortening the program more, and discovered that Groovy has an octal character escape that I did not know of. This significantly simplifies the code, to the point that it unfortunately removes the need for almost all of the quirky workarounds I had come up with.
It also looks almost identical to Copper's Python 2 solution, to the point where it basically looks like I plagiarized their work. Ugh.
Each program has the form print'\<octal value>'
, except:
p
,r
,i
,n
,t
→'print''\<octal value>'
(but with the matching letter of "print" also replaced with the octal value)0
-9
→print~-<next int>
Here is the full list of programs by character.
print'40円'
! print'41円'
" print'42円'
# print'43円'
$ print'44円'
% print'45円'
& print'46円'
' print'47円'
( print'50円'
) print'51円'
* print'52円'
+ print'53円'
, print'54円'
- print'55円'
. print'56円'
/ print'57円'
0 print~-1
1 print~-2
2 print~-3
3 print~-4
4 print~-5
5 print~-6
6 print~-7
7 print~-8
8 print~-9
9 print~-10
: print'72円'
; print'73円'
< print'74円'
= print'75円'
> print'76円'
? print'77円'
@ print'100円'
A print'101円'
B print'102円'
C print'103円'
D print'104円'
E print'105円'
F print'106円'
G print'107円'
H print'110円'
I print'111円'
J print'112円'
K print'113円'
L print'114円'
M print'115円'
N print'116円'
O print'117円'
P print'120円'
Q print'121円'
R print'122円'
S print'123円'
T print'124円'
U print'125円'
V print'126円'
W print'127円'
X print'130円'
Y print'131円'
Z print'132円'
[ print'133円'
\ print'134円'
] print'135円'
^ print'136円'
_ print'137円'
` print'140円'
a print'141円'
b print'142円'
c print'143円'
d print'144円'
e print'145円'
f print'146円'
g print'147円'
h print'150円'
i 'pr151円nt''151円'
j print'152円'
k print'153円'
l print'154円'
m print'155円'
n 'pri156円t''156円'
o print'157円'
p '160円rint''160円'
q print'161円'
r 'p162円int''162円'
s print'163円'
t 'prin164円''164円'
u print'165円'
v print'166円'
w print'167円'
x print'170円'
y print'171円'
z print'172円'
{ print'173円'
| print'174円'
} print'175円'
~ print'176円'
Groovy, 1130 bytes
My previous program, before I discovered that octal escapes exist. Much more interesting, IMO.
Each program has the form print(--'<next char>')
, except:
-
,[
,~
→print(++'<previous char>')
&
→print(--"'")
p
,r
,i
,n
→System.out<<--'<next char>'
t
→'prin\u0074'(--'u')
(
→print'\u0028'
)
→print'\u0029'
0
-9
→print~-<next int>
Here is the full list of programs for each character:
print(--'!')
! print(--'"')
" print(--'#')
# print(--'$')
$ print(--'%')
% print(--'&')
& print(--"'")
' print(--'(')
( print'\u0028'
) print'\u0029'
* print(--'+')
+ print(--',')
, print(--'-')
- print(++',')
. print(--'/')
/ print(--'0')
0 print~-1
1 print~-2
2 print~-3
3 print~-4
4 print~-5
5 print~-6
6 print~-7
7 print~-8
8 print~-9
9 print~-10
: print(--';')
; print(--'<')
< print(--'=')
= print(--'>')
> print(--'?')
? print(--'@')
@ print(--'A')
A print(--'B')
B print(--'C')
C print(--'D')
D print(--'E')
E print(--'F')
F print(--'G')
G print(--'H')
H print(--'I')
I print(--'J')
J print(--'K')
K print(--'L')
L print(--'M')
M print(--'N')
N print(--'O')
O print(--'P')
P print(--'Q')
Q print(--'R')
R print(--'S')
S print(--'T')
T print(--'U')
U print(--'V')
V print(--'W')
W print(--'X')
X print(--'Y')
Y print(--'Z')
Z print(--'[')
[ print(++'Z')
\ print(--']')
] print(--'^')
^ print(--'_')
_ print(--'`')
` print(--'a')
a print(--'b')
b print(--'c')
c print(--'d')
d print(--'e')
e print(--'f')
f print(--'g')
g print(--'h')
h print(--'i')
i System.out<<--'j'
j print(--'k')
k print(--'l')
l print(--'m')
m print(--'n')
n System.out<<--'o'
o print(--'p')
p System.out<<--'q'
q print(--'r')
r System.out<<--'s'
s print(--'t')
t 'prin\u0074'(--'u')
u print(--'v')
v print(--'w')
w print(--'x')
x print(--'y')
y print(--'z')
z print(--'{')
{ print(--'|')
| print(--'}')
} print(--'~')
~ print(++'}')
Fourier, 306 bytes, 1 DNP
Pretty much all of the programs follow the pattern na
where n is the character code of each of the characters. For example:
! 33a
" 34a
# 35a
$ 36a
% 37a
& 38a
' 39a
So I'll just list the exceptions:
0 (Zero)
Since the accumulator is preset to zero, we can display this using a single character:
o
1
Similar to zero, this increments the accumulator to get 1.
^o
5
The ASCII code for 5 is 53, so I had to work around this:
6vo
a
Due to a
being the character output function, there is no other way to produce the character a, so this my only DID NOT PROGRAM.
See all of the programs here
Matlab, (削除) 1238 (削除ここまで) 1224 bytes, 2 DNP
The main pattern is:
disp([<char code> ''])
For digits it's a little shorter:
disp(<sum or difference of two other digits>)
For characters []'
it's:
" " -- disp([0,''])
"[" -- disp(char(91))
"]" -- disp(char(93))
"'" -- disp(char(39))
Characters ds
from disp
are displayed using fprintf
(thanks @Stewie Griffin ); ip
however belong also there, so I'm shifting the string and using eval
:
d -- fprintf([100 ''])
i -- eval(['ejtq)(j(*'-1 ''])
s -- fprintf([115 ''])
p -- eval(['ejtq)(q(*'-1 ''])
Both characters ()
are however necessary for disp
or eval
, so they are DNP.
For reference the whole list:
char char code code length
32 disp([0 '']) 12
! 33 disp([33 '']) 13
" 34 disp([34 '']) 13
# 35 disp([35 '']) 13
$ 36 disp([36 '']) 13
% 37 disp([37 '']) 13
& 38 disp([38 '']) 13
' 39 disp(char(39)) 14
( 40 DNP
) 41 DNP
* 42 disp([42 '']) 13
+ 43 disp([43 '']) 13
, 44 disp([44 '']) 13
- 45 disp([45 '']) 13
. 46 disp([46 '']) 13
/ 47 disp([47 '']) 13
0 48 disp(1-1) 9
1 49 disp(3-2) 9
2 50 disp(5-3) 9
3 51 disp(7-4) 9
4 52 disp(9-5) 9
5 53 disp(2+3) 9
6 54 disp(3+3) 9
7 55 disp(4+3) 9
8 56 disp(5+3) 9
9 57 disp(6+3) 9
: 58 disp([58 '']) 13
; 59 disp([59 '']) 13
< 60 disp([60 '']) 13
= 61 disp([61 '']) 13
> 62 disp([62 '']) 13
? 63 disp([63 '']) 13
@ 64 disp([64 '']) 13
A 65 disp([65 '']) 13
B 66 disp([66 '']) 13
C 67 disp([67 '']) 13
D 68 disp([68 '']) 13
E 69 disp([69 '']) 13
F 70 disp([70 '']) 13
G 71 disp([71 '']) 13
H 72 disp([72 '']) 13
I 73 disp([73 '']) 13
J 74 disp([74 '']) 13
K 75 disp([75 '']) 13
L 76 disp([76 '']) 13
M 77 disp([77 '']) 13
N 78 disp([78 '']) 13
O 79 disp([79 '']) 13
P 80 disp([80 '']) 13
Q 81 disp([81 '']) 13
R 82 disp([82 '']) 13
S 83 disp([83 '']) 13
T 84 disp([84 '']) 13
U 85 disp([85 '']) 13
V 86 disp([86 '']) 13
W 87 disp([87 '']) 13
X 88 disp([88 '']) 13
Y 89 disp([89 '']) 13
Z 90 disp([90 '']) 13
[ 91 disp(char(91)) 14
\ 92 disp([92 '']) 13
] 93 disp(char(93)) 14
^ 94 disp([94 '']) 13
_ 95 disp([95 '']) 13
` 96 disp([96 '']) 13
a 97 disp([97 '']) 13
b 98 disp([98 '']) 13
c 99 disp([99 '']) 13
d 100 fprintf([100 '']) 17
e 101 disp([101 '']) 14
f 102 disp([102 '']) 14
g 103 disp([103 '']) 14
h 104 disp([104 '']) 14
i 105 eval(['ejtq)(j(*'-1 '']) 24
j 106 disp([106 '']) 14
k 107 disp([107 '']) 14
l 108 disp([108 '']) 14
m 109 disp([109 '']) 14
n 110 disp([110 '']) 14
o 111 disp([111 '']) 14
p 112 eval(['ejtq)(q(*'-1 '']) 24
q 113 disp([113 '']) 14
r 114 disp([114 '']) 14
s 115 fprintf([115,'']) 17
t 116 disp([116 '']) 14
u 117 disp([117 '']) 14
v 118 disp([118 '']) 14
w 119 disp([119 '']) 14
x 120 disp([120 '']) 14
y 121 disp([121 '']) 14
z 122 disp([122 '']) 14
{ 123 disp([123 '']) 14
| 124 disp([124 '']) 14
} 125 disp([125 '']) 14
~ 126 disp([126 '']) 14
-
\$\begingroup\$ Does something like
[100 105 115 112]
(char-codes) work fordisp
? \$\endgroup\$Leaky Nun– Leaky Nun2016年08月22日 18:35:34 +00:00Commented Aug 22, 2016 at 18:35 -
\$\begingroup\$ What do you mean exactly?
disp([100 105 115 112])
won't produce a string,eval([100 105 115 112])
neither. \$\endgroup\$pajonk– pajonk2016年08月22日 18:42:06 +00:00Commented Aug 22, 2016 at 18:42 -
\$\begingroup\$ You can use
fprintf
for d ans s:fprintf([115,''])
. Saves 2x7 bytes =) Won't make it a winning submission, but hey: 14 bytes is 14 bytes,,, \$\endgroup\$Stewie Griffin– Stewie Griffin2016年08月24日 07:27:11 +00:00Commented Aug 24, 2016 at 7:27 -
\$\begingroup\$ Also:
disp([0 ''])
contains a space.disp([0,''])
doesn't. \$\endgroup\$Stewie Griffin– Stewie Griffin2016年08月24日 07:34:53 +00:00Commented Aug 24, 2016 at 7:34 -
\$\begingroup\$ @StewieGriffin Thanks, I missed the space one. Also, thanks for the trick with
fprintf
. \$\endgroup\$pajonk– pajonk2016年08月24日 13:41:25 +00:00Commented Aug 24, 2016 at 13:41
Explore related questions
See similar questions with these tags.