56
\$\begingroup\$

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{|}~
\$\endgroup\$
  • \$\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 Aug 21 '16 at 13:08
  • 4
    \$\begingroup\$ What? You need to use printable ASCII. That's just a rule. \$\endgroup\$ – Calvin's Hobbies Aug 21 '16 at 13:10
  • \$\begingroup\$ I believe there are encodings which do not have the exact representation of 0x30 as 0 \$\endgroup\$ – Leaky Nun Aug 21 '16 at 13:17
  • \$\begingroup\$ @LeakyNun EBCDIC \$\endgroup\$ – TuxCrafting Aug 21 '16 at 13:59
  • 2
    \$\begingroup\$ @Tim No. Doesn't follow the independence rule. \$\endgroup\$ – Calvin's Hobbies Aug 22 '16 at 2:21

50 Answers 50

1 2
2
\$\begingroup\$

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

`c\141t`('\141')

since c\141t 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')
`c\141t`('\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')

Try it online!

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))

Try it online!

\$\endgroup\$
  • \$\begingroup\$ 1042 bytes (1136-94) \$\endgroup\$ – digEmAll Aug 21 '19 at 12:13
  • \$\begingroup\$ @digEmAll Impressive! Deserves a separate answer I think. \$\endgroup\$ – Robin Ryder Aug 21 '19 at 12:29
  • \$\begingroup\$ no need... it's basically like using of intToUtf8 directly in the string literal \$\endgroup\$ – digEmAll Aug 21 '19 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 Aug 21 '19 at 12:39
  • 1
    \$\begingroup\$ as.name printing without the [1] fluff is a good find ! \$\endgroup\$ – digEmAll Aug 22 '19 at 11:42
1
\$\begingroup\$

Pip, 294 295 bytes

Most characters are computed using the Chr operator with their ASCII codes. Lowercase letters are (mostly) computed by indexing into z, the lowercase alphabet, since this is shorter for a few of them and breaks even for most of the rest. Here are the other exceptions:

  • s is a builtin for space
  • i is a builtin for 0
  • o is a builtin for 1
  • #t takes the length of the builtin for 10, giving 2
  • #h takes the length of the builtin for 100, giving 3
  • #m takes the length of the builtin for 1000, giving 4
  • t/2 gives 5, avoiding using ASCII code 53
  • AZ@2 indexes into the builtin uppercase alphabet for C, avoiding the Chr operator
  • Ch is shorter for d than z@3
  • z@t is shorter for k than z@10
  • C122 avoids using z for z

Here's the full list:

  s
! C33
" C34
# C35
$ C36
% C37
& C38
' C39
( C40
) C41
* C42
+ C43
, C44
- C45
. C46
/ C47
0 i
1 o
2 #t
3 #h
4 #m
5 t/2
6 C54
7 C55
8 C56
9 C57
: C58
; C59
< C60
= C61
> C62
? C63
@ C64
A C65
B C66
C AZ@2
D C68
E C69
F C70
G C71
H C72
I C73
J C74
K C75
L C76
M C77
N C78
O C79
P C80
Q C81
R C82
S C83
T C84
U C85
V C86
W C87
X C88
Y C89
Z C90
[ C91
\ C92
] C93
^ C94
_ C95
` C96
a z@0
b z@1
c z@2
d Ch
e z@4
f z@5
g z@6
h z@7
i z@8
j z@9
k z@t
l z@11
m z@12
n z@13
o z@14
p z@15
q z@16
r z@17
s z@18
t z@19
u z@20
v z@21
w z@22
x z@23
y z@24
z C122
{ C123
| C124
} C125
~ C126
\$\endgroup\$
  • \$\begingroup\$ Your code to output a 'z' uses the character 'z': "z@v" \$\endgroup\$ – Florian Bach Aug 22 '16 at 9:46
  • \$\begingroup\$ @FlorianBach Fixed \$\endgroup\$ – DLosc Aug 22 '16 at 17:36
1
\$\begingroup\$

Fission, 455 bytes

Most programs are 5 bytes long and of the following form:

  R'!_O
! R'"_O
" R'#_O
...

These work simply by creating a right-going atom with R, setting its mass to a character one greater than the one we want print with 'X, decrementing it with _ and then printing it with O, which also destroys the atom and terminates the program.

There are a few exceptions. ' requires a two-line program:

+> vLR+
O/;

And there are the following exceptions using single-line programs:

C R'B+O
K R'J+O
O R'P_!*
Q R'P+O
R O_S'L
T R'S+O
` Ra_O
a Rb_O
b Rc_O
...
y Rz_O
z Ry+O
{ Rz+O
~ R'}+O

Explanation for these (not in order):

  • Lower-case letters actually set the atom's mass to their character code without requiring the use of ', so we can actually save a byte on all lower-case letters and the two adjacent characters:

    ` Ra_O
    a Rb_O
    b Rc_O
    ...
    y Rz_O
    z Ry+O
    { Rz+O
    

    That's 4 bytes each.

  • For ~, we can't use the next larger character, so we use the previous one and increment it: R'}+O. We also do this for _ to avoid using it in the code, i.e. R'^+O. We also do this for each of CKQT, because otherwise the corresponding DLRU in the code would create another, unwanted atom. These are still 5 bytes.
  • For O, we can't use O for printing. Hence we use !. But this doesn't destroy the atom, so we need to terminate the program explicitly: R'P_!*. That's 6 bytes.
  • For R, we start with a left-going atom and reverse the code: O_S'L. Still 5 bytes.
  • Finally, there's ' which is by far the trickiest one. The shortest I've found is 11 bytes:

    +> vLR+
    O/;
    

    R and L both create an atom (initially with mass 1). The right-going one's mass is incremented twice to 3 (note that the grid wraps around) and stored inside the fission reactor >. The fission reactor can now be used for division by 3 (as opposed to the default of 2).

    Meanwhile, the left-going atom gets its value set to v (118). When it now hits the Fission reactor, it is split into two parts, one with mass 39 (') going south and one with mass 79 (O) going north. Since the grid wraps around, they both hit the ;. The O atom is deflected onto the ; where it is destroyed. The ' is deflected onto the O which (as usual) prints the character and destroys the atom.

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

dc, 314 287 286 bytes

Every character save for '5' and 'P' can be output via xxP where xx is the ASCII code point. 32P, 65P, 112P, etc. For 32-99, excepting 53 ('5') and 80 ('P'), that's 198 bytes. 100-126 gives us an additional 108 bytes, subtotal 306 bytes. Thanks to @Deliot for making me realize I'm sane... dc reserves the words/digits A-F for base >10 input, and doesn't really do any checks relating to inputting a digit beyond the scope of the input radix. This doesn't seem to work with cygwin's dc, but does with Darwin's and Ubuntu's: dc still interprets the number as decimal, but replaces A-F digits with 10-15 including a carry. So A0 becomes 100, AF becomes 115, etc. This adds 81 bytes for a subtotal of 279.

xxa converts a value on the stack to a single character, and n will print it, so that takes care of 'P' - 80an with an additional 4 bytes, subtotal 310 283.

For '5' we can rely on UCHAR_MAX overflow. 53+256=309, which has no 5s in it, so 309P it is use the same A-F behavior with 4DP (thanks @Joe), add 4 3 bytes for a total of 314 287 286.

All of it:

32P
33P
34P
35P
36P
37P
38P
39P
40P
41P
42P
43P
44P
45P
46P
47P
48P
49P
50P
51P
52P
4DP
54P
55P
56P
57P
58P
59P
60P
61P
62P
63P
64P
65P
66P
67P
68P
69P
70P
71P
72P
73P
74P
75P
76P
77P
78P
79P
80an
81P
82P
83P
84P
85P
86P
87P
88P
89P
90P
91P
92P
93P
94P
95P
96P
97P
98P
99P
A0P
A1P
A2P
A3P
A4P
A5P
A6P
A7P
A8P
A9P
B0P
B1P
B2P
B3P
B4P
B5P
B6P
B7P
B8P
B9P
C0P
C1P
C2P
C3P
C4P
C5P
C6P
\$\endgroup\$
  • 3
    \$\begingroup\$ You can shave some bytes off if you represent some numbers in hex (dc will automagically interpret them as such if they contain a-f)- 106-111, 122-127 \$\endgroup\$ – Delioth Aug 23 '16 at 17:44
  • \$\begingroup\$ @Delioth I thought that too and gave it a try, but at least on the implementation available to me ATM (cygwin), if input radix is set to 10 as it is by default, entering A-F (a-f won't ever work as a, c, d, and f are commands) always return '9' unless it's just that digit on its own, in which case it returns its value. Ap yields 10; 6Ap yields 69; 6AP yields E; Fp yields 15 6Fp yields 69; 6FP yields E \$\endgroup\$ – brhfl Aug 23 '16 at 18:18
  • \$\begingroup\$ @Delioth Alright, now that I'm on a better environment, I'm getting results more in line with what I expected - on both my Mac and Ubuntu, 6F is 75… That is, it's not hex per se, but any given decimal place can represent 0-15 with a carry. I'll suss out what I can exploit in this way and update accordingly… Actually, that simplifies everything >99. Thanks! \$\endgroup\$ – brhfl Aug 24 '16 at 1:14
  • 1
    \$\begingroup\$ 4DP works for 5. Also, I thought it appropriate to link this. \$\endgroup\$ – Joe Aug 24 '16 at 1:42
  • \$\begingroup\$ And here, dear friend, is a stabler port of dc for Windows. (It's bundled with bc.) :) \$\endgroup\$ – Joe Aug 24 '16 at 1:57
1
\$\begingroup\$

GNU sed, 587 578 572 characters

All 95 programs were possible. An input is absolutely required by sed in order to execute the code. Some programs need the extra n flag to avoid a second trailing \n in the output.

Run:

echo | sed -f program_filename

List of all programs with additional details:

Char	Program code		Size	n flag	Total size
 	c\\x20			6	0	6
!	c\\x21			6	0	6
"	c\\x22			6	0	6
#	c\\x23			6	0	6
$	c\\x24			6	0	6
%	c\\x25			6	0	6
&	c\\x26			6	0	6
'	c\\x27			6	0	6
(	c\\x28			6	0	6
)	c\\x29			6	0	6
*	c\\x2A			6	0	6
+	c\\x2B			6	0	6
,	c\\x2C			6	0	6
-	c\\x2D			6	0	6
.	c\\x2E			6	0	6
/	c\\x2F			6	0	6
0	c\\d48			6	0	6
1	=			1	1	2	*
2	c\\d50			6	0	6
3	c\\d51			6	0	6
4	c\\d52			6	0	6
5	c\\d309			7	0	7	*
6	c\\d54			6	0	6
7	c\\d55			6	0	6
8	c\\d56			6	0	6
9	c\\d57			6	0	6
:	c\\x3A			6	0	6
;	c\\x3B			6	0	6
<	c\\x3C			6	0	6
=	c\\x3D			6	0	6
>	c\\x3E			6	0	6
?	c\\x3F			6	0	6
@	c\\x40			6	0	6
A	c\\x41			6	0	6
B	c\\x42			6	0	6
C	c\\x43			6	0	6
D	c\\x44			6	0	6
E	c\\x45			6	0	6
F	c\\x46			6	0	6
G	c\\x47			6	0	6
H	c\\x48			6	0	6
I	c\\x49			6	0	6
J	c\\x4A			6	0	6
K	c\\x4B			6	0	6
L	c\\x4C			6	0	6
M	c\\x4D			6	0	6
N	c\\x4E			6	0	6
O	c\\x4F			6	0	6
P	c\\x50			6	0	6
Q	c\\x51			6	0	6
R	c\\x52			6	0	6
S	c\\x53			6	0	6
T	c\\x54			6	0	6
U	c\\x55			6	0	6
V	c\\x56			6	0	6
W	c\\x57			6	0	6
X	c\\x58			6	0	6
Y	c\\x59			6	0	6
Z	c\\x5A			6	0	6
[	c\\x5B			6	0	6
\	edc -e92P		9	0	9	*
]	c\\x5D			6	0	6
^	c\\x5E			6	0	6
_	c\\x5F			6	0	6
`	c\\x60			6	0	6
a	c\\x61			6	0	6
b	c\\x62			6	0	6
c	a\\x63			6	1	7
d	c\\x64			6	0	6
e	c\\x65			6	0	6
f	c\\x66			6	0	6
g	c\\x67			6	0	6
h	c\\x68			6	0	6
i	c\\x69			6	0	6
j	c\\x6A			6	0	6
k	c\\x6B			6	0	6
l	c\\x6C			6	0	6
m	c\\x6D			6	0	6
n	c\\x6E			6	0	6
o	c\\x6F			6	0	6
p	c\\x70			6	0	6
q	c\\x71			6	0	6
r	c\\x72			6	0	6
s	c\\x73			6	0	6
t	c\\x74			6	0	6
u	c\\x75			6	0	6
v	c\\x76			6	0	6
w	c\\x77			6	0	6
x	c\\d120			7	0	7
y	c\\x79			6	0	6
z	c\\x7A			6	0	6
{	c\\x7B			6	0	6
|	c\\x7C			6	0	6
}	c\\x7D			6	0	6
~	c\\x7E			6	0	6

Notes:

  • all entries are complete programs. Almost every one prints the character based on its ASCII code. Those that deviated are marked with an *.
  • to print 1 I used the = command, that prints the current input line number (in this case a single newline was the input)
  • to print \ I called a shell script using e (the only non pure sed program)
\$\endgroup\$
1
\$\begingroup\$

Forth, 694 bytes

Try it online

The general form is:

<char-code> emit

Like 33 emit for !.

Exceptions:

  -> SPACE
5 -> 106 2/ emit (or 49 4 + emit)
e -> 101 EMIT
i -> 105 EMIT
m -> 109 EMIT
t -> 116 EMIT

Unfortunately, using . prints a space at the end. If it were usable, I could save 10 bytes, one for each digit 0-9. They would've been printed using these:

1 1- .
2 2/ .
1 1+ .
2 1+ .
3 1+ .
4 1+ .
5 1+ .
6 1+ .
7 1+ .
8 1+ .
\$\endgroup\$
1
\$\begingroup\$

SmileBASIC, 863 bytes

Almost every program will be of the form ?CHR$(number), except:

$ : ?LOAD("TXT:SYS/SBWAV",0)[394]
( : CHR$40OUT A$?A$
) : CHR$41OUT A$?A$
0 : ?.
1 : ?!.
2 : ?1+1
3 : ?2+1
Other digits: Continue pattern of 2 and 3
? : PRINT CHR$(63)
C : ?HEX$(12)
H : ?ChR$(72)
R : ?CHr$(82)
\$\endgroup\$
1
\$\begingroup\$

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 - ('%A$9]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"
\$\endgroup\$
1
\$\begingroup\$

Reg (a.k.a. Unofficial Keg), 221 bytes

All programs here follow the pattern:

<character+1>;

However, there are some exceptions:

  • Reg has 25 characters that are recognized as instructions. Therefore, they have to be escaped. These are:
!   Pushes the length of the stack onto the stack
:   Duplicates the last item on the stack
_   Removes the last item on the stack
,   Prints the last item on the stack as a character
.   Prints the last item on the stack as an integer
?   Gets input from the user
'   Left shifts the stack
"   Right shifts the stack
~   Pushes a random number onto the stack
^   Reverses the stack
$   Swaps the top two items on the stack
#   Starts a comment
|   Branches to the next section of a structure
\   Escapes the next command, and pushes it as a string
&   Gets/sets the register value
@   Define/call a function
+   Pops x and y and pushes y + x
-   Pops x and y and pushes y - x
*   Pops x and y and pushes y * x
/   Pops x and y and pushes y / x
%   Pops x and y and pushes y % x
<   Pops x and y and pushes y < x
>   Pops x and y and pushes y > x
=   Pops x and y and pushes y == x
;   Decrement the top of the stack

{}[]() also needs escaping.

Length = 2*95+25+6=221B

\$\endgroup\$
  • \$\begingroup\$ Why not just have \<char+1>; for everything \$\endgroup\$ – Lyxal Aug 18 '19 at 22:12
  • \$\begingroup\$ You don't need to escape everything. There are also non-commands in Reg. \$\endgroup\$ – user85052 Aug 19 '19 at 0:54
  • \$\begingroup\$ (In order to shorten byte count) \$\endgroup\$ – user85052 Aug 19 '19 at 1:54
  • \$\begingroup\$ I realised that my suggestion was longer than your idea, so I went to delete it but my phone was special and posted the comment. \$\endgroup\$ – Lyxal Aug 19 '19 at 4:49
  • \$\begingroup\$ This seems to be the shortest answer right now! \$\endgroup\$ – Lyxal Aug 19 '19 at 10:44
0
\$\begingroup\$

Reng, 564 560 bytes, non-competing

Try them here!

Reng uses ISO-8859-1, and in this submission, it uses those characters.

Wo~
Xo~
Yo~
Zo~
6²o~
KH+o~
KI+o~
KJ+o~
K2*o~
KL+o~
KM+o~
43¹o~
44¹o~
45¹o~
46¹o~
47¹o~
n~
7²o~
1|~n+
51¹o~
2|~n+
41+n~
3|~n+
55¹o~
4|~n+
57¹o~
58¹o~
59¹o~
60¹o~
61¹o~
62¹o~
63¹o~
8²o~
65¹o~
66¹o~
67¹o~
68¹o~
69¹o~
70¹o~
71¹o~
72¹o~
73¹o~
74¹o~
75¹o~
76¹o~
77¹o~
78¹o~
79¹o~
80¹o~
9²o~
82¹o~
83¹o~
84¹o~
85¹o~
86¹o~
87¹o~
88¹o~
89¹o~
90¹o~
91¹o~
92¹o~
93¹o~
94¹o~
95¹o~
96¹o~
97¹o~
98¹o~
99¹o~
A0¹o~
A1¹o~
A2¹o~
A3¹o~
A4¹o~
A5¹o~
A6¹o~
A7¹o~
A8¹o~
A9¹o~
1A¹o~
B1¹:70g ~
B2¹o~
B3¹o~
B4¹o~
B5¹o~
B6¹o~
B7¹o~
B8¹o~
B9¹o~
C0¹o~
B²o~
C2¹o~
C3¹o~
C4¹o~
C5¹o~
C6¹:00go

All of these are mostly writing out the hex code of the character (¹ is "manhattan addition", e.g. digit concatenation), but here are some highlights:

C6¹:00go

This prints ~:

C6¹:00go
C6¹       push 126 (C = 12, 6 = 6, 12 +M 6 = 126)
   :      duplicate
    00g   place in first slot
       o  output tilde

(modified code, it wraps around)

~6¹:00go
~         terminate the program

This prints o:

B1¹:70g ~
B1¹        push 111 (B = 11, 1 = 1, B +M 1 = 111)
   :       duplicate
    70g    place at seventh character
       o   (this was just placed) - output
        ~  terminate
\$\endgroup\$
0
\$\begingroup\$

FerNANDo, 1786 (19x94) bytes (1 DNP)

Did not program  (space).

The programs follow a pattern. The first one (!) is as follows:

b a
a a b a a a a b

This sets b to 1 (a is by default 0), and then outputs the ASCII character represented by the binary 00100001 (constructed using a and b). This can be repeated for any ASCII character using the same length of source code. To make the programs that print a and b, use the same code but name the variables c and d instead:

a:

d c
c d d c c c c d

b:

d c
c d d c c c d c

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Deadfish, 43 bytes, 85 DNP

o        #0
io       #1
iio      #2
iiio     #3
iiso     #4
iisio    #5
iisiio   #6
iiisddo  #7
iiisdo   #8
iiiso    #9

Doesn't fit the definition of programming language, but this IS constant output...

\$\endgroup\$
  • \$\begingroup\$ @DJMcMayhem deadfish can only output 10 characters, hence only 10 programs and 85 DNP \$\endgroup\$ – Destructible Lemon Sep 2 '16 at 0:24
  • \$\begingroup\$ Oh, Okay I misunderstood that. \$\endgroup\$ – James Sep 2 '16 at 0:25
0
\$\begingroup\$

Sesos, 285 bytes (non-competing)

Every program is compiled by using this syntax:

add <decimal-ascii-code>
put

Try it online!

The exception to that is h, which is this code instead (the other one contained an h):

set mask
sub 152
put

Then, compile it to an SBIN file and run (those are all 3 bytes, so the score is calculated as 3 * 94 + 1 * 3 = 285 B.) Note that the SBIN file is the real program, not the pre-assembly syntax shown here.

\$\endgroup\$
0
\$\begingroup\$

G++, 2970B+1DNP

It may be possible to output t by asm, but I do not quite know about the one on tio

    #import<cstdio>-Df=putchar(32)
!   #import<cstdio>-Df=putchar(33)
"   #import<cstdio>-Df=putchar(34)
#   extern"C"{int puts(...);}-Df=puts("\63")
$   #import<cstdio>-Df=putchar(36)
%   #import<cstdio>-Df=putchar(37)
&   #import<cstdio>-Df=putchar(38)
'   #import<cstdio>-Df=putchar(39)
(   #import<iostream>-Df=std::cout<<'\70'
)   #import<iostream>-Df=std::cout<<'\71'
*   #import<cstdio>-Df=putchar(42)
+   #import<cstdio>-Df=putchar(43)
,   #import<cstdio>-Df=putchar(44)
-   #import<cstdio> #define f putchar(45)
.   #import<cstdio>-Df=putchar(46)
/   #import<cstdio>-Df=putchar(47)
0   #import<cstdio>-Df=putchar(48)
1   #import<cstdio>-Df=putchar(49)
2   #import<cstdio>-Df=putchar(50)
3   #import<cstdio>-Df=putchar(51)
4   #import<cstdio>-Df=putchar(52)
5   #import<cstdio>-Df=putchar(48+6)
6   #import<cstdio>-Df=putchar(54)
7   #import<cstdio>-Df=putchar(55)
8   #import<cstdio>-Df=putchar(56)
9   #import<cstdio>-Df=putchar(57)
:   #import<cstdio>-Df=putchar(58)
;   #import<cstdio>-Df=putchar(59)
<   #import"cstdio"-Df=putchar(60)
=   #import<cstdio> #define f putchar(61)
>   #import"cstdio"-Df=putchar(62)
?   #import<cstdio>-Df=putchar(63)
@   #import<cstdio>-Df=putchar(64)
A   #import<cstdio>-Df=putchar(65)
B   #import<cstdio>-Df=putchar(66)
C   #import<cstdio>-Df=putchar(67)
D   #import<cstdio> #define f putchar(68)
E   #import<cstdio>-Df=putchar(69)
F   #import<cstdio>-Df=putchar(70)
G   #import<cstdio>-Df=putchar(71)
H   #import<cstdio>-Df=putchar(72)
I   #import<cstdio>-Df=putchar(73)
J   #import<cstdio>-Df=putchar(74)
K   #import<cstdio>-Df=putchar(75)
L   #import<cstdio>-Df=putchar(76)
M   #import<cstdio>-Df=putchar(77)
N   #import<cstdio>-Df=putchar(78)
O   #import<cstdio>-Df=putchar(79)
P   #import<cstdio>-Df=putchar(80)
Q   #import<cstdio>-Df=putchar(81)
R   #import<cstdio>-Df=putchar(82)
S   #import<cstdio>-Df=putchar(83)
T   #import<cstdio>-Df=putchar(84)
U   #import<cstdio>-Df=putchar(85)
V   #import<cstdio>-Df=putchar(86)
W   #import<cstdio>-Df=putchar(87)
X   #import<cstdio>-Df=putchar(88)
Y   #import<cstdio>-Df=putchar(89)
Z   #import<cstdio>-Df=putchar(90)
[   #import<cstdio>-Df=putchar(91)
\   #import<cstdio>-Df=putchar(92)
]   #import<cstdio>-Df=putchar(93)
^   #import<cstdio>-Df=putchar(94)
_   #import<cstdio>-Df=putchar(95)
`   #import<cstdio>-Df=putchar(96)
a   #import<cstdio>-Df=puts("\x61")
b   #import<cstdio>-Df=putchar(98)
c   #import<stdio.h>-Df=puts("\x63")
d   extern"C"{int puts(...);}-Df=puts("\x64")
e   #import<cstdio>-Df=putchar(101)
f   #import<cstdio>-Dg=putchar(102)
g   #import<cstdio>-Df=putchar(103)
h   #import<cstdio>-Df=puts("\x68")
i   extern"C"{char puts(...);}-Df=puts("\x69")
j   #import<cstdio>-Df=putchar(106)
k   #import<cstdio>-Df=putchar(107)
l   #import<cstdio>-Df=putchar(108)
m   #include<cstdio>-Df=putchar(109)
n   #import<cstdio>-Df=putchar(110)
o   extern"C"{int puts(...);}-Df=puts("\x6f")
p   #include<iostream>-Df=std::cout<<'\x70'
q   #import<cstdio>-Df=putchar(113)
r   #include<cstdio>-Df=puts("\x72")
s   extern"C"{int putchar(...);}-Df=putchar("\x73")
t   
u   #import<cstdio>-Df=fwrite("\x75",1,1,&stdin[-2])
v   #import<cstdio>-Df=putchar(118)
w   #import<cstdio>-Df=putchar(119)
x   #import<cstdio>-Df=putchar(120)
y   #import<cstdio>-Df=putchar(121)
z   #import<cstdio>-Df=putchar(122)
{   #import<cstdio>-Df=putchar(123)
|   #import<cstdio>-Df=putchar(124)
}   #import<cstdio>-Df=putchar(125)
~   #import<cstdio>-Df=putchar(126)
\$\endgroup\$
  • \$\begingroup\$ @JoKing print, put, write, cout all contain t \$\endgroup\$ – l4m2 Nov 11 '18 at 11:14
  • \$\begingroup\$ @JoKing That's what +1char meant \$\endgroup\$ – l4m2 Nov 11 '18 at 11:21
0
\$\begingroup\$

Add++, 505 bytes

Almost all of the programs have the format

+<char code>
H

Try it online!

With the exception of 3, the programs that generate "5", "+" and "H", which are, respectively

+4
+1
O

Try it online!

x:43
H

Try it online!

+72
h

Try it online!

How they work:

  • Most work by setting that active variable to their charcode, and H converts numbers to characters when outputting
  • "5" works simply by adding \$4\$ and \$1\$ and outputting the numerical result.
  • "+" works by setting the variable explicitly, rather than adding the value
  • "H" works by using h, which outputs the same result as H, without a trailing newline

The bytecount was calculated using this program.

\$\endgroup\$
0
\$\begingroup\$

Pushy, 267 bytes

This answer takes advantage of the many output commands available.

  • Most programs are in the format <char code>" or <char code>', which print the character with that char code.

  • 0: Z#

  • 5: 4h#

  • The first ten letters of the uppercase alphabet are printed using <index>Q, where <index> is the letter's 0-based index in the alphabet: 0Q, 1Q, 2Q... 9Q, TQ.

  • All letters in the lowercase alphabet are pritned using <index>q, apart from of course q, which is printed using the first method.

The complete list of programs is below:

32"
33"
34'
35"
36"
37"
38"
39"
40"
41"
42"
43"
44"
45"
46"
47"
Z#
49"
50"
51"
52"
4h#
54"
55"
56"
57"
58"
59"
60"
61"
62"
63"
64"
0Q
1Q
2Q
3Q
4Q
5Q
6Q
7Q
8Q
9Q
TQ
76"
77"
78"
79"
80"
81"
82"
83"
84"
85"
86"
87"
88"
89"
90"
91"
92"
93"
94"
95"
96"
0q
1q
2q
3q
4q
5q
6q
7q
8q
9q
Tq
11q
12q
13q
14q
15q
113"
17q
18q
19q
20q
21q
22q
23q
24q
25q
123"
124"
125"
126"
\$\endgroup\$
0
\$\begingroup\$

33, 539 bytes, 3 DNP

Most programs take the form of: <Number>cktp, so I'll list the programs that are different:

The digit 0:

Since the accumulator is initialised to 0, I can just use o for it.

The digit 1:

Adding 1 to the accumulator isn't an option, so I evaluate 3 - 2 instead: 3c2mo

The digits 2 and 3:

Repeatedly adding 1 to the accumulator is shorter than printing the character code, so 1aao and 1aaao are used

The digit 4:

Repeatedly adding 2 to the accumulator works here: 2aao

The digit 5:

5 is the only number whose decimal representation in ASCII contains itself. What I can do instead is add 2 and 3: 2c3ao

The digit 6:

Double 3: 3aao

The digits 7 and 9:

These work much the same way as 5: 3c4ao and 5c4ao

The digit 8:

Double 4: 4aao

The letter c:

To get the number from the counter into the accumulator, I use c. This is replaceable with a, so there is very little problem there: 99aktp

The letters k, t, and p:

It is not possible to get a character into the source string and print it without these letters, so that's 3 DNP's.

Full listing:

This is full list of the programs, separated by newlines

32cktp
33cktp
34cktp
35cktp
36cktp
37cktp
38cktp
39cktp
40cktp
41cktp
42cktp
43cktp
44cktp
45cktp
46cktp
47cktp
o
3c2mo
1aao
1aaao
2aao
2c3ao
3aao
3c4ao
4aao
5c4ao
58cktp
59cktp
60cktp
61cktp
62cktp
63cktp
64cktp
65cktp
66cktp
67cktp
68cktp
69cktp
70cktp
71cktp
72cktp
73cktp
74cktp
75cktp
76cktp
77cktp
78cktp
79cktp
80cktp
81cktp
82cktp
83cktp
84cktp
85cktp
86cktp
87cktp
88cktp
89cktp
90cktp
91cktp
92cktp
93cktp
94cktp
95cktp
96cktp
97cktp
98cktp
99aktp
100cktp
101cktp
102cktp
103cktp
104cktp
105cktp
106cktp
108cktp
109cktp
110cktp
111cktp
113cktp
114cktp
115cktp
117cktp
118cktp
119cktp
120cktp
121cktp
122cktp
123cktp
124cktp
125cktp
126cktp
\$\endgroup\$
0
\$\begingroup\$

Python3, 2646 characters

In Python3.7.1, the following program code returns all 95 printable-ascii characters on each line using the following format starting with the empty space " " character for 32, and ending with the Tilde character "~" for 127.

The following code added to a .py file will execute the output of all printable ascii, with seven instances that don't conform (labeled DNF) for the seven characters here print() and modifications were made for the characters bytesrangin order to avoid duplicates:

print(bytes(range(32,33))),
print(bytes(range(33,34))),
print(bytes(range(34,35))),
print(bytes(range(35,36))),
print(bytes(range(36,37))),
print(bytes(range(37,38))),
print(bytes(range(38,39))),
print(bytes(range(39,40))),
print(bytes(range(40,41))),#( DNP
print(bytes(range(41,42))),#) DNP
print(bytes(range(42,43))),
print(bytes(range(43,44))),
print(chr(44)), 
print(bytes(range(45,46))),
print(bytes(range(46,47))),
print(bytes(range(47,48))),
print(bytes(range(48,49))),
print(bytes(range(49,50))),
print(bytes(range(50,51))),
print(bytes(range(51,52))),
print(bytes(range(52,53))),
print(bytes(range(53,54))),
print(bytes(range(54,55))),
print(bytes(range(55,56))),
print(bytes(range(56,57))),
print(bytes(range(57,58))),
print(bytes(range(58,59))),
print(bytes(range(59,60))),
print(bytes(range(60,61))),
print(bytes(range(61,62))),
print(bytes(range(62,63))),
print(bytes(range(63,64))),
print(bytes(range(64,65))),
print(bytes(range(65,66))),
print(bytes(range(66,67))),
print(bytes(range(67,68))),
print(bytes(range(68,69))),
print(bytes(range(69,70))),
print(bytes(range(70,71))),
print(bytes(range(71,72))),
print(bytes(range(72,73))),
print(bytes(range(73,74))),
print(bytes(range(74,75))),
print(bytes(range(75,76))),
print(bytes(range(76,77))),
print(bytes(range(77,78))),
print(bytes(range(78,79))),
print(bytes(range(79,80))),
print(bytes(range(80,81))),
print(bytes(range(81,82))),
print(bytes(range(82,83))),
print(bytes(range(83,84))),
print(bytes(range(84,85))),
print(bytes(range(85,86))),
print(bytes(range(86,87))),
print(bytes(range(87,88))),
print(bytes(range(88,89))),
print(bytes(range(89,90))),
print(bytes(range(90,91))),
print(bytes(range(91,92))),
print(bytes(range(92,93))),
print(bytes(range(93,94))),
print(bytes(range(94,95))),
print(bytes(range(95,96))),
print(bytes(range(96,97))),
print(chr(97)), #a
print(chr(98)), #b
print(bytes(range(99,100))),
print(bytes(range(100,101))),
print(chr(101)),#e
print(bytes(range(102,103))),
print(chr(103)),#g
print(bytes(range(104,105))),
print(bytes(range(105,106))), #i DNP
print(bytes(range(106,107))),
print(bytes(range(107,108))),
print(bytes(range(108,109))),
print(bytes(range(109,110))),
print(bytes(range(110,111))), #n DNP
print(bytes(range(111,112))),  
print(bytes(range(112,113))),#p DNP
print(bytes(range(113,114))),
print(bytes(range(114,115))),#r DNP
print(chr(115)),#s
print(bytes(range(116,117))),#t DNP
print(bytes(range(117,118))),
print(bytes(range(118,119))),
print(bytes(range(119,120))),
print(bytes(range(120,121))),
print(chr(121)),#y
print(bytes(range(122,123))),
print(bytes(range(123,124))),
print(bytes(range(124,125))),
print(bytes(range(125,126))),
print(bytes(range(126,127))),

Note: I didn't make an exception for the ascii comma character (i.e. 44) as that isn't necessary in the program except when all programs are run from one file, as a line separator). And the letters after the # symbol are just comments.

The output (contains b to denote byte format, followed by quotation marks'):

b' '
b'!'
b'"'
b'#'
b'$'
b'%'
b'&'
b"'"
b'('
b')'
b'*'
b'+'
b','
b'-'
b'.'
b'/'
b'0'
b'1'
b'2'
b'3'
b'4'
b'5'
b'6'
b'7'
b'8'
b'9'
b':'
b';'
b'<'
b'='
b'>'
b'?'
b'@'
b'A'
b'B'
b'C'
b'D'
b'E'
b'F'
b'G'
b'H'
b'I'
b'J'
b'K'
b'L'
b'M'
b'N'
b'O'
b'P'
b'Q'
b'R'
b'S'
b'T'
b'U'
b'V'
b'W'
b'X'
b'Y'
b'Z'
b'['
b'\\'
b']'
b'^'
b'_'
b'`'
a
b
b'c'
b'd'
e
b'f'
g
b'h'
b'i'
b'j'
b'k'
b'l'
b'm'
b'n'
b'o'
b'p'
b'q'
b'r'
s
b't'
b'u'
b'v'
b'w'
b'x'
y
b'z'
b'{'
b'|'
b'}'
b'~'
\$\endgroup\$
  • \$\begingroup\$ 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\$ – Jo King Aug 19 '19 at 8:24
  • \$\begingroup\$ Thanks @JoKing, I just modified the submission so that there would be 95 programs (each on one line). \$\endgroup\$ – Steven Hatzakis Aug 19 '19 at 8:35
  • \$\begingroup\$ without that character occurring anywhere in the program \$\endgroup\$ – Jo King Aug 19 '19 at 8:50
  • 1
    \$\begingroup\$ For example, the program for b contains a b. Similarly for the rest of ytes(rang,5) \$\endgroup\$ – Jo King Aug 19 '19 at 9:10
  • 1
    \$\begingroup\$ Additionally the challenge says: “• The programs must be actual, full programs, according to your language's standard conventions. Functions and REPL snippets are not allowed.” \$\endgroup\$ – manatwork Aug 19 '19 at 9:33
0
\$\begingroup\$

Pyth, 285 bytes

Most characters are just C<codepoint in decimal>: <space> (C32)-c (C99) are 3 characters each, d (C100)-~ (C126) are 4 characters each, for a base count of 3*68+4*27=312 bytes.

Exceptions

space: d           (-2)
    ": N           (-2)
    0: Z           (-2)
  1-9: h0 ... h8   (-9, -1 each)
    C: r\c1        (+1)
    a: hG          (-1)
  d-j: @G3 ... @G9 (-7, -1 each)
    k: @GT         (-1)
    y: ePG         (-1)
    z: eG          (-2)

Total from exceptions: -26 bytes, for a grand total of 286 bytes.

\$\endgroup\$
0
\$\begingroup\$

Runic Enchantments, Score: (95*6)+3-(9*2)-(32*1) = 523

All programs:

25pk@
b3*k@
3´4k@
3´5k@
c3*k@
3´7k@
3´8k@
d3*k@
4Xk@
4´1k@
e3*k@
4´3k@
b4*k@
f3*k@
4´6k@
4´7k@
c4*k@
4´9k@
5Xk@
5´1k@
d4*k@
4´dk@
5´4k@
b5*k@
e4*k@
5´7k@
5´8k@
5´9k@
6Xk@
6´1k@
6´2k@
6´3k@
26pk$;
d5*k@
b6*k@
6´7k@
6´8k@
6´9k@
7Xk@
7´1k@
c6*k@
7´3k@
7´4k@
f5*k@
7´6k@
b7*k@
d6*k@
7´9k@
8Xk@
34pk@
8´2k@
8´3k@
e6*k@
8´5k@
8´6k@
8´7k@
b8*k@
8´9k@
9Xk@
d7*k@
9´2k@
9´3k@
9´4k@
9´5k@
c8*k@
9´7k@
e7*k@
b9*k@
aXk@
a´1k@
a´2k@
a´3k@
d8*k@
f7*k@
a´6k@
a´2E3%@
c9*k@
a´9k@
bXk@
b´1k@
e8*k@
b´3k@
b´4k@
b´5k@
b´6k@
d9*k@
b´8k@
b´9k@
cXk@
bb*k@
c´2k@
c´3k@
c´4k@
53pk@
e9*k@

´ does cost 2 bytes, but for a sequence like this, its convenient, and works out to be "as good as or shorter" for encoding nearly all number literals with values greater than 15. We can even cheat here and there with some values due to the way that the operation works. For example, the program that outputs 5 is written as 4´dk@ instead of 5´3k@, using the literal 13 instruction (4*10+13 vs 5*10+3). Only values that are a multiple of 10 (4X vs 4´0)(†) or that can be constructed using two values <16 and one basic math operation (+-*/%^)(‡) are cheaper without using ´.

The only one that gave me more than a moment's pause was k, as without k there's no way to convert a number to a character. I can't even use reflection to write it into the grid. But I can extract one from a string! a´2E3%@ pulls word 102 out of the dictionary ("back") and slices out its 3rd index ("k") and prints it.

\$\endgroup\$
1 2

Your Answer

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

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