53
\$\begingroup\$

Challenge

Print the following characters:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890

The catch is that you may not use any one of them in your code.

You may print them in arbitrary order, with or without a leading or trailing newline, but you may not print any other characters.

Rules

  • You may not use any characters from the set mentioned above
  • You may use any other characters
  • No cheating
  • Standard loopholes banned
  • This is , shortest answer wins.

Clarifications

  • If your language uses a different charset, you may not use codepoints in that charset that correspond to alphanumeric characters.
  • Returning a string from a function is considered a valid form of output.
  • You may return a char array.
\$\endgroup\$
17
  • 8
    \$\begingroup\$ This is somewhat ambiguous. If you mean output those raw bytes without those bytes in your code, then you should specify that you can't use the codepoints of these characters, even if they map to something else in your language's codepage. \$\endgroup\$
    – FlipTack
    Commented Jan 5, 2017 at 19:57
  • 13
    \$\begingroup\$ So this means that I cannot use any letters or numbers in my source code. Well, that pretty much takes out any non-esoteric languages. \$\endgroup\$
    – R. Kap
    Commented Jan 5, 2017 at 20:04
  • 4
    \$\begingroup\$ What if the language is just raw bytes (as opcodes) that don't have a representation? Am I free to use any characters? \$\endgroup\$
    – FlipTack
    Commented Jan 5, 2017 at 22:03
  • 1
    \$\begingroup\$ @briantist it's fine if they're internally represented by ints, but the characters themselves have to be printed. \$\endgroup\$
    – anna328p
    Commented Jan 5, 2017 at 23:15
  • 3
    \$\begingroup\$ @R.Kap Javascript could work, provided you don't think of it as eso \$\endgroup\$ Commented Jan 5, 2017 at 23:32

53 Answers 53

52
\$\begingroup\$

Octave, 52 46 40 bytes

['['-('"':'+'),'{'-(_='!':':'),_+'@','']

This evaluates to

9876543210ZYXWVUTSRQPONMLKJIHGFEDCBAabcdefghijklmnopqrstuvwxyz

Explanation

Here we are using the fact that characters are implicitly converted to integers when arithmetic operations like +- or the range function : are applied. When concatenated with an empty string ([...,'']), the numbers again are converted to characters.

Try it online!

\$\endgroup\$
3
  • 8
    \$\begingroup\$ +1 for being the first non-esoteric language in a challenge very suited to esolangs. \$\endgroup\$
    – DJMcMayhem
    Commented Jan 5, 2017 at 21:56
  • 5
    \$\begingroup\$ A big +1, not for using Octave (it's quite straight forward), but for golfing this very well, and using _ as a variable! I had no idea it was possible... Nice! \$\endgroup\$ Commented Jan 5, 2017 at 22:42
  • 1
    \$\begingroup\$ When concatenated with an empty string ([...,'']), the numbers again are converted to characters.... very nice \$\endgroup\$
    – rahnema1
    Commented Jan 6, 2017 at 3:46
30
\$\begingroup\$

brainfuck, 77 76 75 72 bytes

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

Try it online!

How it works

The interpreter begins with a tape of 0 cells.

++++++++

This sets the first cell to 8, leaving the tape in the following state.

   8
   ^
[>+>++++++>++++>-<<<<-]

This increments the second cell once, the third cell 6 times, the fourth cell 4 times, decrements the fifth cell once, then goes back to the beginning of the tape and decrements the first cell. After 8 iterations, the tape looks like follows.

  0   8  48  32  -8
  ^
>++

We advance to the second cell and increment it twice, getting ready to print the digits.

  0  10  48  32  -8
      ^
[>.+<-]

This prints the third cell, increments it, then goes back to the second cell and decrements it. After 10 iterations, we've printed 0123456789 and the tape looks like follows.

  0   0  58  32  -8
      ^
>>

Time to prep the tape for the letters! We begin by advancing two cells.

  0   0  58  32  -8   0   0
              ^
[>+>++>+++<<<-]

This increments the fifth cell once, the sixth cell twice, the seventh cell thrice, then goes back to the fourth cell and decrements it. After 32 iterations, the tape looks like follows.

  0   0  58   0  24  64  96
              ^
>++

As a last step before printing the letters, we advance to the fifth cell and increment it twice.

  0   0  58   0  26  64  96
                  ^
[>+.>+.<<-]

Finally, we advance to the sixth cell to increment and print it, do the same for the seventh cell, then go back to the fifth cell and decrement it. After 26 iterations, we've printed Aa...Zz.

\$\endgroup\$
1
  • \$\begingroup\$ Nice golf! I'll link to your answer \$\endgroup\$
    – FlipTack
    Commented Jan 6, 2017 at 0:17
26
\$\begingroup\$

Ruby, 42 bytes

->{[*?/...?:,*?@...?[,*?`...?{]-[?/,?@,?`]}

A function that returns a char array. A program that outputs just the characters is 49 bytes:

$><<([*?/...?:,*?@...?[,*?`...?{]-[?/,?@,?`])*''

This simply uses the ascii characters on either side of the relevant ranges to define a range. For example, ?/...?: means the characters between a forward slash and a colon, excluding the end. To get rid of the beginnings, we subtract an array containing the three beginning characters.

\$\endgroup\$
3
  • \$\begingroup\$ Nice work. I saw this just as I came to post my 60 byte version using the same idea. \$\endgroup\$
    – AShelly
    Commented Jan 5, 2017 at 22:49
  • 3
    \$\begingroup\$ You can save one byte with slightly different ranges: $><<([(?/...?{)]-[*(?:..?@),*(?[..?`),?/])'' \$\endgroup\$
    – AShelly
    Commented Jan 5, 2017 at 22:53
  • \$\begingroup\$ This really is pretty. Well, ugly. You know what I mean. Nicely done. \$\endgroup\$ Commented Jan 6, 2017 at 13:59
23
\$\begingroup\$

6502 machine language, 74 70 68 bytes

Hex dump (6502 programs are generally not relocatable; the code here is stored starting at location $0603):

0600:          a9 24 0a 8d 20 06 8d 21 06 8d 23 06 8d 
0610: 25 06 09 20 8d 1a 06 8d 1c 06 ea aa ea a8 a9 00 
0620: ea ea 98 ea 8a ea a2 ff a9 7b a0 60 20 3a 06 a9 
0630: 5b a0 40 20 3a 06 a9 3a a0 2f 85 80 c8 e8 98 95 
0640: 00 c8 c4 80 d0 f7 60

You can see that this uses none of the prohibited bytes: $41 through $5a, $61 through $7a, or $30 through $39.

This is a function with no arguments that, when called, returns a pointer to the character array "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" at the top of the stack, in accordance with standard 6502 calling conventions.

By way of explanation, here's a disassembly:

Address  Hexdump   Disassembly
-------------------------------
$0603    a9 24     LDA #$24
$0605    0a        ASL A
$0606    8d 20 06  STA $0620
$0609    8d 21 06  STA $0621
$060c    8d 23 06  STA $0623
$060f    8d 25 06  STA $0625
$0612    09 20     ORA #$20
$0614    8d 1a 06  STA $061a
$0617    8d 1c 06  STA $061c
$061a    ea        NOP 
$061b    aa        TAX 
$061c    ea        NOP 
$061d    a8        TAY 
$061e    a9 00     LDA #$00
$0620    ea        NOP 
$0621    ea        NOP 
$0622    98        TYA 
$0623    ea        NOP 
$0624    8a        TXA 
$0625    ea        NOP 
$0626    a2 ff     LDX #$ff
$0628    a9 7b     LDA #$7b
$062a    a0 60     LDY #$60
$062c    20 3a 06  JSR $063a
$062f    a9 5b     LDA #$5b
$0631    a0 40     LDY #$40
$0633    20 3a 06  JSR $063a
$0636    a9 3a     LDA #$3a
$0638    a0 2f     LDY #$2f
$063a    85 80     STA $80
$063c    c8        INY 
$063d    e8        INX 
$063e    98        TYA 
$063f    95 00     STA $00,X
$0641    c8        INY 
$0642    c4 80     CPY $80
$0644    d0 f7     BNE $063d
$0646    60        RTS

The machine-language code is self-modifying. For stack manipulation, I needed to use PHA and PLA to push and pop the accumulator, but these instructions have opcodes $48 and $68, which are prohibited (they're the ASCII codes for the letters 'H' and 'h'). So, for PHA, I take the number $24, do an arithmetic shift left (ASL), and store the resulting $48 in the four spots in the code where it needs to be executed. Then, for PLA, I use a bitwise OR on the $48 in the accumulator to compute $68, and store it in the two spots in the code where it's needed.

There were several instructions other than PHA and PLA that I also couldn't use because their opcodes happen to be the same as ASCII letters or digits, but I found direct workarounds for those others.

The desired character array is computed and stored starting at location 0 (it doesn't really matter where it's stored since we just need to be sure that a pointer to it is returned the top of the stack).

You can try this out at Nick Morgan's 6502 assembler and emulator. Here's a screenshot; the monitor box at the bottom shows the output string (in locations $00 through $3D) after the program is run.

\$\endgroup\$
21
\$\begingroup\$

V, 8 7 bytes

1 byte saved thanks to @DJMcMayhem by putting it all in one regex statement

¬/{Ó×ü_

Try it online!

Outputs:

0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

Note: × is not x or X, it is 0xd7

Hexdump:

00000000: ac2f 7bd3 d7fc 5f                        ./{..._

Explanation

¬/{            " inserts every character in the range / to {

Now the output looks like:

/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{

We have to remove all the non-alphanumeric characters and the _ (since it is not included in \W), so let's do that using regex

Ó×ü_           " removes every character that is non-alphanumeric or an underscore _ 
               " vim equivalent of :s/\W\|_//g
\$\endgroup\$
1
  • \$\begingroup\$ Amazing! +1 for beating me to it. :) Also, You could simplify it down to one regex if you did Ó×ü_ (which is equivalent to :s/\W\|_//g) \$\endgroup\$
    – DJMcMayhem
    Commented Jan 5, 2017 at 20:12
18
\$\begingroup\$

Haskell, 75 72 63 58 56 bytes

__=[__|[_',ä]<-["/:","@[","`{"],__<-[_'..],_'<__,__<ä]

Try it online! Call with __. Output:

0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

Thanks to xnor who suggested __ and _' as two byte variable names instead of (!) or similar, saving 9 bytes. I especially like how _' breaks the syntax highlighting. And thanks again to xnor for generalizing the ranges, saving another 4 bytes.
Edit: I found out that Unicode chars are allowed as identifiers in Haskell, so e.g. ä, ö, ... can also be used as two byte identifiers. Since there was one three byte identifier left in the program I replaced it by ä, saving another 2 bytes.

Explanation:

__ and _' are valid variable names. From the language specification:

An identifier consists of a letter followed by zero or more letters, digits, underscores, and single quotes. [...] Underscore, _, is treated as a lower-case letter, and can occur wherever a lower-case letter can. However, _ all by itself is a reserved identifier, used as wild card in patterns.

So the code is equivalent to

s = [x|[a,b]<-["/:", "@[", "`{"], x<-[a..], a<x, x<b]

In the list comprehension a gets bound to '/' and b to ':' ("/:" is equivalent to ['/',':'], so the pattern matching succeeds). Then the range [a..] builds the string of all characters greater equal '/':

"/0123456789:;<=>?@ABCDE ... \1114110\1114111"

For each character x in this string it's then checked whether '/'<x and x<':', resulting in the chars 0123456789. Then a and b are bound to @ and [, yielding the chars ABCDEFGHIJKLMNOPQRSTUVWXYZ and so on.

\$\endgroup\$
4
  • 3
    \$\begingroup\$ You can use __ and _' as variables. \$\endgroup\$
    – xnor
    Commented Jan 6, 2017 at 5:26
  • \$\begingroup\$ @xnor Thanks, I didn't know about the Underscore is treated as a lower-case letter rule. \$\endgroup\$
    – Laikoni
    Commented Jan 6, 2017 at 9:34
  • 1
    \$\begingroup\$ You can save some bytes by generalizing the ranges: _'_=[__|[_',__']<-["`{","@[","/:"],__<-[_'..],_'<__,__<__'] (in normal variables z=[x|[a,b]<-["`{","@[","/:"],x<-[a..],a<x,x<b]). \$\endgroup\$
    – xnor
    Commented Jan 7, 2017 at 10:29
  • \$\begingroup\$ @xnor Thanks again! Great idea to combine the start and end of the ranges into a string. I also tried to generalize the ranges but always ended up longer without this idea. An additional byte can be saved by binding the string to __ instead of _'_ even though __ is used as identifier inside the list comprehension. \$\endgroup\$
    – Laikoni
    Commented Jan 7, 2017 at 11:18
15
\$\begingroup\$

Perl (5.10 or 5.12), 30 29 bytes

This program consists mostly of unprintable characters, so here's a hexdump:

00000000: 5f 3d 7e 7e 22 d7 c0 84 8c 9e 86 df 9e d1 d1 85 _=~~"...........
00000010: d3 be d1 d1 a5 d3 cf d1 d1 c6 82 d6 22          ............"

This program's very simple: we're regexing (=~) an underscore (_; thanks @Dennis for pointing out that this works) against a regex. The regex is specified as an expression, rather than literally; specifically, we're taking the bitwise complement (~) of a string. Reversing the bitwise complement to get at the underlying string, we get the following regex that's being executed:

(?{say a..z,A..Z,0..9})

In Perl versions 5.10 and 5.12, the (?{…}) syntax was an experimental syntax for allowing regexes to run arbitrary code at runtime. In this case, we use it to run a straightforward Perl program to print the desired output. (Versions earlier than 5.10 can't be used because they don't have say.)

Modern versions of Perl have disabled (?{…}) by default for security reasons, but if you have such a version of Perl, you can disable the check (and thus run this program) via -Mre=eval as a command-line argument (together with the standard -M5.010 that specifies the version of the language to implement, and which doesn't count against the bytecount).

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

Java (OpenJDK 9), 277 bytes

Yes, Java, you read that well!

$->""+($='='+'=')+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+($='-'+'-')+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+--$+($='_'-'&')+--$+--$+--$+--$+--$+--$+--$+--$+--$

Try it online!

This prints the ranges, but reversed, since the order has no importance.

zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA9876543210

I played on the absence of "no input" rule to implicitly define a char which is required to make the whole thing work. If that's cheating, please say so.

Ungolfed & testing

public class PCG105781 {
  interface X { String apply(char x); }

  public static void main(String[] args) {
    X x = $
        -> "" // Force the result as a String.
        // The line below appends "zyxwvutsrqponmlkjihgfedcba"
        // '=' + '=' is 122 as int. $=122 casts 122 as a char, 'z'
        + ($ = '=' + '=') + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$
        // The line below appends "ZYXWVUTSRQPONMLKJIHGFEDCBA"
        // '-' + '-' is 90 as int. $=90 casts 90 as a char, 'Z'
        + ($ = '-' + '-') + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$
        // The line below appends "9876543210"
        // '_' - '&' is 57 as int. $=57 casts 57 as a char, '9'
        + ($ = '_' - '&') + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$ + --$
      ;

    System.out.println(x.apply('_'));
  }
}
\$\endgroup\$
3
  • 4
    \$\begingroup\$ Wait, what?? I'm short than all of the JavaScript solutions? o_O \$\endgroup\$ Commented Jan 8, 2017 at 14:41
  • 1
    \$\begingroup\$ That's because JavaScript doesn't have char, otherwise it'd be a piece of cake. And to be fair, my answer is shorter than your initial answer. Take a look at my explanation for all the overhead I have to go through. \$\endgroup\$ Commented Jan 9, 2017 at 13:01
  • 2
    \$\begingroup\$ @PatrickRoberts To be fair, we should compare initial edit to initial edit or last edit to last edit, not initial edit to last... ;) I carefully read what was done for JavaScript, especially because I didn't understand how I could get a shorter answer than all of the JS ones. \$\endgroup\$ Commented Jan 9, 2017 at 15:03
12
\$\begingroup\$

Actually 8 5 4 bytes

'>┘▀

How it works:

 '>    Pushes > onto the stack as a string
           STACK: [>]
    ┘  Converts the top item of the stack to it's ordinal
           STACK: [62]
     ▀ Push all digits from base n(top item of the stack)
           STACK: [012...xyz]

Print is implicit at the end of the program.

Edit 1: Replaced putting the alphabet in lower/uppercase and then the number range(10) with just getting base 62's printable characters.

Edit 2: changed ">" to '> thanks to Mego :) saved 1 byte.

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ '> is a byte shorter than ">". \$\endgroup\$
    – user45941
    Commented Jan 6, 2017 at 23:12
  • \$\begingroup\$ @Mego yep it is, edited :) thanks. \$\endgroup\$ Commented Jan 9, 2017 at 8:51
11
\$\begingroup\$

PHP, 69 bytes

<?=~"ÏÎÍÌËÊÉÈÇƾ½¼»º¹¸·¶µ´³²±°¯®­¬«ª©¨§¦¥žœ›š™˜—–•”“’‘ŽŒ‹Š‰ˆ‡†…";

The code is stylized using Windows-1252 here. Below is a reversible xxd hexdump.

00000000: 3c 3f 3d 7e 22 cf ce cd cc cb ca c9 c8 c7 c6 be  <?=~"...........
00000010: bd bc bb ba b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 af ae  ................
00000020: ad ac ab aa a9 a8 a7 a6 a5 9e 9d 9c 9b 9a 99 98  ................
00000030: 97 96 95 94 93 92 91 90 8f 8e 8d 8c 8b 8a 89 88  ................
00000040: 87 86 85 22 3b                                   ...";

Try it online!

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

Brainfuck, 89 85 bytes

Because brainfuck ignores alphanumeric characters anyway, this is just a constant-output challenge... (Edit: See Dennis' Solution for a version which is 10 bytes shorter)

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

Try it online!

This code is a good example of basic counted loops in brainfuck:

+[-[--<]>>--]   Create value 47: char just before '0'
++++++++++      Set adjacent cell to 10: to be used as a counter

[               While the counter is not 0:
 <+.              Increment and print the char
    >-            Decrement the counter
       ]        (End loop: Exits when all digits have been printed)


<++++++++>           The char is now at '9' so add 8 to make it 'A'
+[-[---<]>>-]<-      In another cell create lowercase 'a'
<<+++++[>+++++<-]>+  Create 26: the number of times to loop

[                While the counter is not 0:
 >.+               Print and increment the lowercase char
    <<<.+          Print and increment the uppercase char
         >>-       Decrement the counter
            ]    (End loop: Exits when all letters have been printed)

Note that this uses wrapping shortcuts to generate numbers, meaning that the interpreter needs to have 8-bit wrapping cells (such as the one I linked to).

\$\endgroup\$
1
  • 5
    \$\begingroup\$ Brainfuck was the first language I thought of. Shame I don't know it. Nice answer. \$\endgroup\$
    – ElPedro
    Commented Jan 5, 2017 at 20:59
7
\$\begingroup\$

JavaScript (ES6), 983 bytes

Turns out in ES6 there's a lot of characters you can use in JavaScript variable names! Works great after you exhaust the six 1-2 byte variable names with $ and _.

_=~[]
$={}
Á=++_
À=![]+""
Â=À[_]
Ã=++_
Ä=À[_]
Å=++_
Æ=($+"")[_]
Ç=(_[_]+"")[_]
È=++_
É=(!""+"")[_]
Ë=++_
Ì=++_
Ê=($+"")[_]
Í=++_
µ=++_
Î=++_
Ï=++_
_="\\"
Ð=$.$
È_=(!""+"")[Ã]
Å_=$+""
Ñ=Å_[Ã]
Ò=(Ð+"")[Ã]
__=Å_[Í]
Ó=(!""+"")[Å]
$_=Å_[Ì]+Ñ+Ò+(!$+"")[È]+__+È_+Ó+Å_[Ì]+__+Ñ+È_
$$=È_+(!""+"")[È]+__+Ó+È_+Ò
$=Á[$_][$_]
$($($$+"\""+Ê+Ñ+_+Ã+Ì+Í+_+Ã+Í+È+Ñ+À[Å]+É+"."+À[Å]+Ñ+_+Ã+Ë+µ+"('"+Ä+Æ+Ê+Ç+É+Â+_+Ã+Ë+µ+_+Ã+Ì+Á+_+Ã+Ì+Ã+_+Ã+Ì+Å+_+Ã+Ì+È+À[Å]+_+Ã+Ì+Ì+_+Ã+Ì+Í+Ñ+_+Ã+Í+Á+_+Ã+Í+Ã+_+Ã+Í+Å+_+Ã+Í+È+__+Ó+_+Ã+Í+Í+_+Ã+Í+µ+_+Ã+µ+Á+_+Ã+µ+Ã+_+Ã+µ+Å+_+Ã+Á+Ã+_+Ã+Á+Å+_+Ã+Á+È+_+Ã+Á+Ë+_+Ã+Á+Ì+_+Ã+Á+Í+_+Ã+Á+µ+_+Ã+Ã+Á+_+Ã+Ã+Ã+_+Ã+Ã+Å+_+Ã+Ã+È+_+Ã+Ã+Ë+_+Ã+Ã+Ì+_+Ã+Ã+Í+_+Ã+Ã+µ+_+Ã+Å+Á+_+Ã+Å+Ã+_+Ã+Å+Å+_+Ã+Å+È+_+Ã+Å+Ë+_+Ã+Å+Ì+_+Ã+Å+Í+_+Ã+Å+µ+_+Ã+È+Á+_+Ã+È+Ã+_+Ã+È+Å+Ã+Å+È+Ë+Ì+Í+µ+Î+Ï+Á+"')\"")())()

JavaScript, 1223 bytes

This was my answer before I learned about the above.

_=~[]
$={}
___=++_
____=![]+""
$$$$=____[_]
__$=++_
$_$_=____[_]
_$_=++_
$_$$=($+"")[_]
$$_$=(_[_]+"")[_]
_$$=++_
$$$_=(!""+"")[_]
$__=++_
$_$=++_
$$__=($+"")[_]
$$_=++_
$$$=++_
$___=++_
$__$=++_
_="\\"
_$_$=$.$
_$$_=(!""+"")[__$]
_$__=$+""
_$=_$__[__$]
__$_=(_$_$+"")[__$]
__=_$__[$$_]
___$=(!""+"")[_$_]
$_=_$__[$_$]+_$+__$_+(!$+"")[_$$]+__+_$$_+___$+_$__[$_$]+__+_$+_$$_
$$=_$$_+(!""+"")[_$$]+__+___$+_$$_+__$_
$=___[$_][$_]
$($($$+"\""+$$__+_$+_+__$+$_$+$$_+_+__$+$$_+_$$+_$+____[_$_]+$$$_+"."+____[_$_]+_$+_+__$+$__+$$$+"('"+$_$_+$_$$+$$__+$$_$+$$$_+$$$$+_+__$+$__+$$$+_+__$+$_$+___+_+__$+$_$+__$+_+__$+$_$+_$_+_+__$+$_$+_$$+____[_$_]+_+__$+$_$+$_$+_+__$+$_$+$$_+_$+_+__$+$$_+___+_+__$+$$_+__$+_+__$+$$_+_$_+_+__$+$$_+_$$+__+___$+_+__$+$$_+$$_+_+__$+$$_+$$$+_+__$+$$$+___+_+__$+$$$+__$+_+__$+$$$+_$_+_+__$+___+__$+_+__$+___+_$_+_+__$+___+_$$+_+__$+___+$__+_+__$+___+$_$+_+__$+___+$$_+_+__$+___+$$$+_+__$+__$+___+_+__$+__$+__$+_+__$+__$+_$_+_+__$+__$+_$$+_+__$+__$+$__+_+__$+__$+$_$+_+__$+__$+$$_+_+__$+__$+$$$+_+__$+_$_+___+_+__$+_$_+__$+_+__$+_$_+_$_+_+__$+_$_+_$$+_+__$+_$_+$__+_+__$+_$_+$_$+_+__$+_$_+$$_+_+__$+_$_+$$$+_+__$+_$$+___+_+__$+_$$+__$+_+__$+_$$+_$_+__$+_$_+_$$+$__+$_$+$$_+$$$+$___+$__$+___+"')\"")())()

I ran console.log('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890') through jjencode and golfed the result manually. There are definitely more optimizations that can be done.

\$\endgroup\$
4
  • \$\begingroup\$ Hey, FYI I posted codegolf.stackexchange.com/a/105854/42091 because I put a lot of work into it and I think it's sufficiently different from your answer. \$\endgroup\$ Commented Jan 6, 2017 at 13:35
  • \$\begingroup\$ No problem, looking good! \$\endgroup\$
    – darrylyeo
    Commented Jan 6, 2017 at 20:26
  • \$\begingroup\$ Nice! That last update helped me get over 100 bytes off mine! \$\endgroup\$ Commented Jan 7, 2017 at 4:28
  • 1
    \$\begingroup\$ If you change your encoding to ISO8859-1, and leave it exactly like this, it will be 769 bytes. \$\endgroup\$ Commented Jan 7, 2017 at 9:45
7
\$\begingroup\$

Self-modifying Brainfuck, 32 bytes

<[-<+.>]<<[-<+.>]<<[-<+.>]`@/

Try it online!

xxd -r-reversible hexdump (contains unprintables):

00000000: 3c5b 2d3c 2b2e 3e5d 3c3c 5b2d 3c2b 2e3e  <[-<+.>]<<[-<+.>
00000010: 5d3c 3c5b 2d3c 2b2e 3e5d 601a 401a 2f0a  ]<<[-<+.>]`.@./.
\$\endgroup\$
5
  • \$\begingroup\$ What does the @/ do? \$\endgroup\$
    – Yytsi
    Commented Jan 6, 2017 at 18:43
  • \$\begingroup\$ @TuukkaX The last 6 characters `\x1a@\x1a/\n are there because their codepoints are really useful in golfing. You can't remove them. \$\endgroup\$ Commented Jan 6, 2017 at 18:47
  • \$\begingroup\$ @downvoter: If you stumble upon this post, please remove your downvote. This has been since fixed. \$\endgroup\$ Commented Jan 8, 2017 at 10:01
  • \$\begingroup\$ I'm glad I'm not the only one who uses SMBF. :) \$\endgroup\$
    – mbomb007
    Commented Jan 13, 2017 at 18:24
  • \$\begingroup\$ @mbomb007 Practicality :) I was thinking of BF, and them SMBF came to mind, so that I have the codepoints ready. The restriction didn't cost me bytes, as I used +. instead of .+. \$\endgroup\$ Commented Jan 13, 2017 at 18:26
7
\$\begingroup\$

Befunge, 73 72 59 57 55 53 bytes

"{"< ^+`"`"\+*`\":"\`"/":\*`\"["\`"@":::::-!!
#@_^,_!

Try it online!

This is a single loop counting down from { (i.e. one character after z). On the first iteration, the "{"< sequence pushes two copies of { onto the stack - one being the the initial loop counter, and the other being used to decrement that counter using the sequence !!- (two NOTs make 1, which is then subtracted) . On subsequent iterations, the loop counter is already on the stack, so only one { is required to setup the decrement sequence.

The rest of the code is just a long boolean expression calculating if the character is in range. If it is, the branch on the second line splits left to write out the value. If not, the right branch wraps around to test if we've reached zero and should terminate. The two branches merge in the middle to go up and repeat the loop. Note that all vertical direction commands go upwards, since we can't use a v, but that's fine because the instruction pointer automatically wraps at the top of the playfield.

Thanks to Mistah Figgins for initially coming up with a better technique for the loop increment.

But special thanks to Jo King for an even better approach counting down rather than up, as well as a more compact branch layout.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ If there is nothing else except the counter on the stack, you can change your increment part to \!+ If there is, you can do :!!+. for non-zero values \$\endgroup\$ Commented Jan 7, 2017 at 1:43
  • \$\begingroup\$ -2 bytes by rearranging the check at the beginning of the line \$\endgroup\$
    – Jo King
    Commented Jan 19, 2018 at 9:15
  • \$\begingroup\$ @JoKing Well spotted. We can't use the v since this is restricted-source, but it still works just as well with a ^. Thanks. \$\endgroup\$ Commented Jan 19, 2018 at 11:08
  • \$\begingroup\$ -2 bytes by counting down instead of up, and using the extra copy of the counter on the second line to check if the loop is over (remembered about the restricted source this time ;) ) \$\endgroup\$
    – Jo King
    Commented Jan 20, 2018 at 15:22
  • \$\begingroup\$ @JoKing Wow, you really are way better at this golfing than me! Thanks again. \$\endgroup\$ Commented Jan 20, 2018 at 17:32
6
\$\begingroup\$

Jelly, 17 16 bytes

“:[{“/@`‘Ḷḟ"/ỌḊ€

Try it online!

How it works

“:[{“/@`‘Ḷḟ"/ỌḊ€  Main link. No arguments.

“:[{“/@`‘         Yield [[58, 91, 123], [47, 64, 96]].
         Ḷ        Unlength; map each n to [0, ..., n-1].
          ḟ"/     Reduce by vectorizing filter-false.
                  This yields [[47, ..., 57], [64, ..., 90], [96, ..., 122]].
             Ọ    Unordinal; replace each n with the corr. Unicode character.
              Ḋ€  Deqeue each; remove the first character of each of the three
                  generated strings ('/', '@', and '`').
\$\endgroup\$
4
  • \$\begingroup\$ Because jelly has its own codepage, it would help if you attached a hexdump, for easy verification that you're not using the banned bytes \$\endgroup\$
    – FlipTack
    Commented Jan 5, 2017 at 20:29
  • \$\begingroup\$ @FlipTack IIRC Jelly's codepage is compatible with printable ASCII. \$\endgroup\$ Commented Jan 5, 2017 at 20:36
  • \$\begingroup\$ @FlipTack Pietu1998 is right. And even if he weren't, the spec bans characters, not bytes. \$\endgroup\$
    – Dennis
    Commented Jan 5, 2017 at 21:19
  • \$\begingroup\$ @Dennis In fact, it bans bytes per the comments, although this is still valid (ASCII-compatible). \$\endgroup\$ Commented Jan 7, 2017 at 10:50
6
\$\begingroup\$

Julia 0.4, 46 bytes

_()=['¥':'®';'¶':'Ï';'Ö':'ï'].-['~'-'	']

This is a generic function that returns a character array.

Try it online!

Alternate version, 47 bytes, ASCII-only

_(_=_==_)=['/'+_:':'-_;'@'+_:'['-_;'`'+_:'{'-_]

Try it online!

\$\endgroup\$
6
\$\begingroup\$

bash (on linux), 507 493 490 485 bytes

this stores an array of characters in the global variable __

: {_}>_ {_}>_ {_}>_ {_}>_ {_}>_ {_}>_ {_}>_ {_}>_ {_}>_ {_}>_
__=(/????/????/??/??)
___=${__%??}
__=(${__[@]#$___?})
____=${___#/*/?}
____=${____%?/*/}
_____=${____%?}
____=${____#?}
___=${___%??/}
______=($___*_??)
______=${______#$___???????}
______=${______%??_*}
_______=($___$_____???*)
_______=${_______#$___??}
_______=${_______%????}
___=$#
___=$((++___))$((___+++++___+___--))$___
$_____$_______$______$____{,} ___="\({$______..$'\\$___'}\)"
__=(${__[@]} ${___[@]} ${___[@]^})

it needs to be executed on a freshly booted linux machine with /proc, or something like a pid namespace

explanation:

# {var}>file opens a file descriptor >= 10 to that file
: {_}>_ {_}>_ {_}>_ {_}>_ {_}>_ {_}>_ {_}>_ {_}>_ {_}>_ {_}>_
# at startup no pid is > 999 so there's no other /proc/pid/fd/??
__=(/????/????/??/??)                                 # /proc/self/fd/1[0-9]
___=${__%??}                                          # /proc/self/fd/
__=(${__[@]#$___?})                                   # {0..9}
____=${___#/*/?}                                      # elf/fd/
____=${____%?/*/}                                     # el
_____=${____%?}                                       # e
____=${____#?}                                        # l
___=${___%??/}                                        # /proc/self/
______=($___*_??)                                     # /proc/self/timerslack_ns
______=${______#$___???????}                          # ack_ns
______=${______%??_*}                                 # a
_______=($___$_____???*)                              # /proc/self/environ
_______=${_______#$___??}                             # viron
_______=${_______%????}                               # v

___=$#                                                # 0
___=$((++___))$((___+++++___+___--))$___              # 172 (z in octal)

# eval eval                   ___="\({a..$'\172'}\)"
$_____$_______$______$____{,} ___="\({$______..$'\\$___'}\)"
#   {0..9}   {a..z}    {A..Z}
__=(${__[@]} ${___[@]} ${___[@]^})

to try it out we can add declare -p __ at the end to display the result

$ sudo unshare --fork --pid --mount-proc bash golf
declare -a __=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5" [6]="6" [7]="7" [8]="8" [9]="9" [10]="a" [11]="b" [12]="c" [13]="d" [14]="e" [15]="f" [16]="g" [17]="h" [18]="i" [19]="j" [20]="k" [21]="l" [22]="m" [23]="n" [24]="o" [25]="p" [26]="q" [27]="r" [28]="s" [29]="t" [30]="u" [31]="v" [32]="w" [33]="x" [34]="y" [35]="z" [36]="A" [37]="B" [38]="C" [39]="D" [40]="E" [41]="F" [42]="G" [43]="H" [44]="I" [45]="J" [46]="K" [47]="L" [48]="M" [49]="N" [50]="O" [51]="P" [52]="Q" [53]="R" [54]="S" [55]="T" [56]="U" [57]="V" [58]="W" [59]="X" [60]="Y" [61]="Z")
\$\endgroup\$
2
  • \$\begingroup\$ +1. I think you should state this as Bash on Linux as other OSes (e.g. MacOS) don't have /proc. In fact /proc is not strictly necessary on Linux, though you'd probably be hard pressed to find a modern distro without it. \$\endgroup\$ Commented Jan 8, 2017 at 19:55
  • \$\begingroup\$ This stores the output as a global variable, which isn't allowed. \$\endgroup\$
    – allxy
    Commented Apr 22, 2022 at 5:47
6
\$\begingroup\$

C, 128 bytes

Yes, C. And it even is shorter than a few of the esoteric ones.

__($$,_,$,_$,$_){$>_$?_$=_$?!$:$,$=*(""-_+$_++)&*"{":_;_$?*(""-_+$$++)=$++:_;$&&__($$,_,$,_$,$_);}_(_){__(_,"",_,!!_,"½´ÞÅþå");}

Call _ on a sufficiently large, empty char * buffer.

May be a teensy wee bit compiler dependent. Tested using GCC; file was saved in codepage 1252.

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

JavaScript (ES6), 812 745 657 650 536 520 416 bytes

(À=(Á=!($={})+(Ø=""))[Â=_=+[]],Ã=(Ä=!_+Ø)[Å=++_],Æ=(Ç=$+Ø)[_],È=(É=$.$+Ø)[_],Ê=Ä[Ë=++_],Ì=Ä[Í=++_],Î=++_,Ï=Ç[Ð=++_],Ñ=Ç[Ò=++_],Ó=++_,$=$[Ô=Ï+Æ+È+Á[Í]+Ñ+Ã+Ê+Ï+Ñ+Æ+Ã][Ô],$($((Õ=Ã+Ä[Í]+Ñ+Ê+Ã+È)+`"${Ù=($=À)+Æ+(Ö=Ô[Ð])}($ ${[Æ+$+"[["+Î+ ++_,Ø+Ð+_+"],["+Ò+Ð,Ø+ ++_+Å+"],["+_+Ó,Ú=Ø+Å+Ë+Í]}]])${Ù}(_=$[Â];_<$[Å];)Ø+=${(_="\\")+Ú+Ñ+Ö+(Û=(_=_+Å)+Ð)+Å+Ô[Ë]+_+Î+Ó}.${$+Ö+Æ+Û+Ð+_+Â+Í+Û+Â+Á[Å]+Ö+_+Â+Í+Æ+É[Ë]+Ì}(_++);${Õ} Ø"`)()))

Edit: Using ISO8859-1 encoding, this solution is 416 bytes instead of 520 bytes. The full program is 432 bytes, taking into account the extra 16 bytes for

f=\r\n
416 byte submission here\r\n
alert(f())

This is a function submission, as opposed to a full program. I spent quite a long time golfing JJEncode (hat-tip to darrylyeo for that), but instead of golfing

console.log('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')

I golfed

for($ of[[48,58],[65,91],[97,123]])for(_=$[0];_<$[1];)Ø+=String.fromCharCode(_++);return Ø

where Ø is initialized to "" in the overhead.

Rewritten with comma operators converted to newlines:

À=(Á=!($={})+(Ø=""))[Â=_=+[]]
Ã=(Ä=!_+Ø)[Å=++_]
Æ=(Ç=$+Ø)[_]
È=(É=$.$+Ø)[_]
Ê=Ä[Ë=++_]
Ì=Ä[Í=++_]
Î=++_
Ï=Ç[Ð=++_]
Ñ=Ç[Ò=++_]
Ó=++_
$=$[Ô=Ï+Æ+È+Á[Í]+Ñ+Ã+Ê+Ï+Ñ+Æ+Ã][Ô]
// function that returns string
$($((Õ=Ã+Ä[Í]+Ñ+Ê+Ã+È)+`"${Ù=($=À)+Æ+(Ö=Ô[Ð])}($ ${[Æ+$+"[["+Î+ ++_,Ø+Ð+_+"],["+Ò+Ð,Ø+ ++_+Å+"],["+_+Ó,Ú=Ø+Å+Ë+Í]}]])${Ù}(_=$[Â];_<$[Å];)Ø+=${(_="\\")+Ú+Ñ+Ö+(Û=(_=_+Å)+Ð)+Å+Ô[Ë]+_+Î+Ó}.${$+Ö+Æ+Û+Ð+_+Â+Í+Û+Â+Á[Å]+Ö+_+Â+Í+Æ+É[Ë]+Ì}(_++);${Õ} Ø"`)())

Explanation

This script starts by initializing a few built-in types and coercing them into strings. The strings we can get without using alphanumeric characters are:

{}+""     -> "[object Object]"
!{}+""    -> "false"
!+[]+""   -> "true"
{}[{}]+"" -> "undefined"

From these strings, and the necessary digits in order to reference individual characters, we can obtain the strings return and constructor, which can be used like:

$={}[Ô="constructor"][Ô]
$(("return"+`"encoded script"`)())

The object's constructor is Object(), and its constructor is Function(), which we can use essentially like eval().

In this case, the encoded script to be executed is the nested for loops concatenating all the alphanumeric characters to a string using their code points and returning it.

For alphabetical characters in the encoded script that can't be accessed using the built-ins, JJEncode uses octal escapes to represent them, then decodes the entire string by returning it from an inner function. The outer function can then be called to execute the source.

Demo

f=
(À=(Á=!($={})+(Ø=""))[Â=_=+[]],Ã=(Ä=!_+Ø)[Å=++_],Æ=(Ç=$+Ø)[_],È=(É=$.$+Ø)[_],Ê=Ä[Ë=++_],Ì=Ä[Í=++_],Î=++_,Ï=Ç[Ð=++_],Ñ=Ç[Ò=++_],Ó=++_,$=$[Ô=Ï+Æ+È+Á[Í]+Ñ+Ã+Ê+Ï+Ñ+Æ+Ã][Ô],$($((Õ=Ã+Ä[Í]+Ñ+Ê+Ã+È)+`"${Ù=($=À)+Æ+(Ö=Ô[Ð])}($ ${[Æ+$+"[["+Î+ ++_,Ø+Ð+_+"],["+Ò+Ð,Ø+ ++_+Å+"],["+_+Ó,Ú=Ø+Å+Ë+Í]}]])${Ù}(_=$[Â];_<$[Å];)Ø+=${(_="\\")+Ú+Ñ+Ö+(Û=(_=_+Å)+Ð)+Å+Ô[Ë]+_+Î+Ó}.${$+Ö+Æ+Û+Ð+_+Â+Í+Û+Â+Á[Å]+Ö+_+Â+Í+Æ+É[Ë]+Ì}(_++);${Õ} Ø"`)()))
console.log(f())

\$\endgroup\$
5
\$\begingroup\$

Brain-Flak, 171 bytes

Includes +3 for -A

(((((()()()){}){}){}){})(((()()())){}{}){({}[()]<(({})())>)}{}(({})(()()()()){})(((((()()()){}){}){}())<{({}[()]<(({})())>)}{}(({})(()()()){}())>){({}[()]<(({})())>)}{}

Try it online!

(((((()()()){}){}){}){}) # push 48
(((()()())){}{})         # push 9
{({}[()]<                # for 9..0
(({})())                 # pop a, push a, push a+1
>)}{}                    # end for
(({})(()()()()){})       # pop a, push a, push a + 8
(((((()()()){}){}){}())< # push 26 and save a 26 for later
{({}[()]<                # for 26..0
(({})())                 # pop a, push a, push a+1
>)}{}                    # end for
(({})(()()()){}())       # pop a, push a, push a + 7
>)                       # push that 26 that we held
{({}[()]<                # for 26..0
(({})())                 # pop a, push a, push a+1
>)}{}                    # end for

There is probably a way to do this without having to repeat the add 1 "function".

\$\endgroup\$
5
\$\begingroup\$

J, 171 bytes

(+:>.+:^^*_){.".(':',~(+:+:>.^*_){(*:>.^*_)!:(+:<.^+:*_)''),',',(":(>:*:+:+:+:*_),(<.^<:^<:^*_),<:*:<.^+:*_),'+/',('.',~(+:<.+:^*_){(*:>.^*_)!:(+:<.^+:*_)''),":+:<.*:>:^*_

Ow... my brain hurts... Try it online!

Here's so you can see all of it one line (it won't run, though, with line breaks.)

(+:>.+:^^*_){.".(':',~(+:+:>.^*_){(*:>.^*_)!:(+:<.^+:*_)''),',',(":(>:*:+:+:+:*_),(<.^<:^<:^*
_),<:*:<.^+:*_),'+/',('.',~(+:<.+:^*_){(*:>.^*_)!:(+:<.^+:*_)''),":+:<.*:>:^*_

Only guaranteed to work with J version j805/j64/linux/release/commercial/www.jsoftware.com/2016-12-11T08:02:52, in that order. (Only the first 12 characters matter.)

Explanation

Most of the program is devoted to constant generation. With those constants replaced with their values, the program looks like this:

(62){.".(':',~(12){(9)!:(14)''),',',(":(65),(97),48),'+/',('.',~(10){(9)!:(14)''),":26

With some parentheses removed, and some numbers made nicer:

62{.".(':',~12{9!:14''),',',(":65 97 48),'+/',('.',~10{9!:14''),":26

This is composed of a bunch of , and ,~s, which append and prepend arguments. Here are the separate values:

  1. ":26
  2. ('.',~10{9!:14'')
  3. '+/'
  4. (":65 97 48)
  5. ','
  6. (':',~12{9!:14'')

1 is 26 as a string.

9!:14'' generates the following string on TIO:

j805/j64/linux/release/commercial/www.jsoftware.com/2016-12-11T08:02:52

with 2, we obtain the 10th character (i from linux), and add a . to the end of it, yielding i..

3 and 5 are self-explanatory.

4 is the list of numbers 65 97 48 as a string.

6 is similar to 2, except it's the 12th character (u from linux) and adds a : to the end, yielding u:.

This, all together, yields u:,65 97 48+/i.26. ". evaluates this, giving us:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789:;<=>?@ABCDEFGHI

(Note: +/ is tabulated addition.)

Then, with 62{., we take the first 62 characters from this, giving us ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.

\$\endgroup\$
1
  • \$\begingroup\$ You can get the constant 14 using <:<.^^*_ which saves a byte. Also, I tried generating the entire range and removing the symbols to get ':;<=>?@[\]^_`'-.~".(':',~(+:+:>.^*_){(*:>.^*_)!:(<:<.^^*_)''),":(#@}.@}.@}.@,~(+#\)],,~)(*:@#$])'+++++' at 104 bytes. I'm sure it can get much shorter \$\endgroup\$
    – miles
    Commented Jan 6, 2017 at 13:31
5
\$\begingroup\$

05AB1E, 18 15 11 bytes

-4 thanks to Adnan, because if the input size is 1, 05AB1E will use 0 for b on first command.

•£•Ýç©á®þ«˜

Try it online!

•£•Ÿ            # Push [0..122] using implicit 0 and the base-214 of `£`.
    ç           # Convert to ASCII chars.
     ©          # Store full array in register.
      á         # Push the same array with ONLY letters.
       ®        # Push contents of register (char)[0..122].
        þ       # Push only the digits.
         «˜     # Concat to list, flatten it. 

I tried so many different approaches, but the key points here that made it hard:

- Basic commands will not work, only extended and a select few of the basics.
- Extended commands are pretty complex.
- Eval (.V) will not work.
- To push numbers you can do a base 214 compression.
- ALL sequence pushes (E.G. žK) won't work.
- ALL number pushes won't work, except for compression and the -1 an empty register pushes.
\$\endgroup\$
3
  • 1
    \$\begingroup\$ You may print them in arbitrary order says the challenge. \$\endgroup\$ Commented Jan 5, 2017 at 20:30
  • 1
    \$\begingroup\$ Does •£•Ýç©á®þ«˜ also work? \$\endgroup\$
    – Adnan
    Commented Jan 6, 2017 at 0:00
  • \$\begingroup\$ @Adnan nice, didn't know it uses 0 when there is no b. \$\endgroup\$ Commented Jan 9, 2017 at 20:06
5
\$\begingroup\$

Brainfuck, 55 bytes

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

Output:

aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789

Try it online!


Initializes the tape to 3·2n, and works from there.

+++[[<+>->++<]>]    initialize the tape
                    |   0 |   3 |   6 |  12 |  24 |  48 |  96 | 192 | 128 |   0 |   0 |
                                                                                    ^
<<[-<->]            subract 128 from 192
                    |   0 |   3 |   6 |  12 |  24 |  48 |  96 |  64 |   0 |   0 |   0 |
                                                                        ^
<<<<++              increment 24 twice
                    |   0 |   3 |   6 |  12 |  26 |  48 |  96 |  64 |   0 |   0 |   0 |
                                                ^
[->>+.>+.<<<]       output aAbBcC ~ zZ
                    |   0 |   3 |   6 |  12 |   0 |  48 | 122 |  90 |   0 |   0 |   0 |
                                                ^
<--[->>.+<<]        decrement 12 twice; output 0 ~ 9
                    |   0 |   3 |   6 |   0 |   0 |  58 | 122 |  90 |   0 |   0 |   0 |
                                          ^
\$\endgroup\$
5
\$\begingroup\$

MAWP, 197 bytes

Here's a funny solution.

__________________________________________________________________________________________________________________________;;;;;;;;;;;;;;;;;;;;;;;;;;%%%%%%;;;;;;;;;;;;;;;;;;;;;;;;;;%%%%%%%;;;;;;;;;;

MAWP almost exclusively uses alphanumeric characters to print values, so instead we spam the _(stack length) operator to generate ASCII values till 122.

The rest is printing the required characters and removing the unnecessary ASCII values. The whole thing is printed in reverse to conserve bytes.

Try it!

\$\endgroup\$
5
\$\begingroup\$

Python 3, 2188 bytes

_=𝓸𝓻𝓭('/')
𝓹𝓻𝓲𝓷𝓽(𝓬𝓱𝓻(𝓸𝓻𝓭('')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('‘')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('’')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('“')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('”')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('•')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('–')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('—')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭(':')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭(';')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('<')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('=')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('>')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('?')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('@')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('Ÿ')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭(' ')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('¡')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('¢')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('£')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('¤')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('¥')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('¦')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('§')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('¨')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('©')-_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭(' ')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('!')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('"')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('#')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('$')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('%')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('&')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭("'")+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('(')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭(')')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('*')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('+')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('	')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('''
''')+_)+𝓬𝓱𝓻(𝓸𝓻𝓭('')+_),𝓮𝓷𝓭='')

The code contains some unprintable characters that may not display properly. See the TIO link for the actual code.

Try it online!

There doesn't seem to be a way to do any sort of looping without access to keywords, so I had to make this monster.

Here is an explanation of why this works.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Various golfing suggestions: 𝓬𝓱𝓻 is 12 bytes while ᶜʰʳ is only 7. Also, you could put something like ª=ᶜʰʳ;º=ºʳᵈ at the top to save tons of bytes. You could replace ord('''\n''') with something like -~ord('\t'). If you set _=ord('[') and both add and subtract from it, then all arguments to ord could be ASCII. All that aside, it is possible to loop with builtins. This answer has two 119-byte solutions, one that loops with map, range, etc., and one that __import__s the string module. \$\endgroup\$
    – benrg
    Commented Apr 20, 2022 at 21:13
5
\$\begingroup\$

Perl 6, 43 bytes

{|('`'^..^'{'),|('@'^..^'['),|('/'^..^':')}

A lambda that returns a list of characters.
Explanation:

   '`'                                       # The character before "a" (in Unicode order)
          '{'                                # The character after "z"
      ^..^                                   # Endpoint-exclusive range between them
 |(          )                               # Slip the range into the outer list
               |('@'^..^'[')                 # Same thing for "A" to "Z"
                             |('/'^..^':')}  # Same thing for "0" to "9"

Depends on a bugfix to the Rakudo Perl 6 interpreter which was only committed to the git repo today, and isn't part of an official Rakudo release yet. In fact, I encountered the bug while answering this challenge, and managed to get fixed with the help of one of the Perl 6 core devs. The rules of this site, as I understand them, did't allow answers to compete in such a situation, so I marked it as noncompeting but now it's fine.

\$\endgroup\$
1
  • \$\begingroup\$ 41 bytes \$\endgroup\$
    – Jo King
    Commented Nov 6, 2018 at 0:11
4
\$\begingroup\$

PHP 7.0+, 110 bytes

God bless bitwise strings!

<?=($__='`@`@'^'*/).')(($_='->.<:'^'__@[_')('>'^_,'%'^_)),$__($_('|'^'=','|'^'&')),$__($_(':'^"\n",';'^']'^_));

Replace the \n with a real *NIX-style newline.
It is present in the code to avoid problems with newlines, but isn't counted in the score.

This throws a bunch of warnings, but those could be supressed by appending an @ in front of every stray _.


Warning free, 113 bytes

<?=($__='`@`@'^'*/).')(($_='->.<:'^'__@[_')('>'^@_,'%'^@_)),$__($_('|'^'=','|'^'&')),$__($_(':'^"\n",';'^']'^@_));
\$\endgroup\$
4
\$\begingroup\$

65c02 machine language + Apple ][ ROM, 25 bytes

A9 E0 20 0F 80 A9 C0 20 0F 80 A2 0A A9 AF 2C A2 1A 1A 20 ED FD CA D0 F9 60

Prints abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.

Should start at $8000.

Disassembly

8000-   A9 E1       LDA   #$E0
8002-   20 0F 80    JSR   $800F
8005-   A9 C1       LDA   #$C0
8007-   20 0F 80    JSR   $800F
800A-   A2 0A       LDX   #$0A
800C-   A9 B0       LDA   #$AF
800E-   2C          HEX   2C     ; SKIPS NEXT 2 BYTES
800F-   A2 1A       LDX   #$1A
8011    1A          INC   
8012-   20 ED FD    JSR   $FDED
8015-   CA          DEX   
8016-   D0 F9       BNE   $8011
8018-   60          RTS   
\$\endgroup\$
4
  • \$\begingroup\$ This violates the codepoint rule- you're just using the characters in a different character set. Bytes are OK as long as they aren't iterals or read by the code. \$\endgroup\$
    – anna328p
    Commented Jan 7, 2017 at 3:18
  • \$\begingroup\$ @wat Ah, OK. I've edited my code so that it doesn't use any machine code bytes that map to alphanumeric characters in "normal" (positive) ASCII and doesn't use any positive or negative ASCII alphanumeric literals; is it valid now? \$\endgroup\$ Commented Jan 7, 2017 at 3:35
  • \$\begingroup\$ I guess so... ._. \$\endgroup\$
    – anna328p
    Commented Jan 7, 2017 at 6:24
  • \$\begingroup\$ @wat The code points in ascending order used currently are 10, 15, 26, 32, 44, 96, 128, 162, 169, 175, 192, 202, 208, 224, 237, 249, 253, which maps to the characters ↵.. ,`.¢©¯ÀÊÐàíùý where the .s are unprintable characters. It's valid \$\endgroup\$ Commented Jan 7, 2017 at 6:48
4
\$\begingroup\$

MarioLANG, 255 233 199 bytes

+
+
+
+
+
+
+
+
)
><
+"
+
+(
+(
+(
+(
++
+)
)+
++
++
++
+)
++
++
++
++
++
++
++
+)
()
()
-
[!)+)+)-)--)+++((
=#==============
>((+(+      >((+
"======<    "====<
![-)).).((((![-)).
#===========#=====

Try it online!

The more time Mario spends in the air, the less floor you have to draw and the less characters you use for the solution...

\$\endgroup\$
4
\$\begingroup\$

C (clang), 116 bytes

"Arbitrary order" indeed.

The function _ takes a pointer to target string as an argument. Since that pointer is to int, it is assumed that sizeof(int) == 4.

In the TiO link the result is printed as-is, as well as sorted, for easier ocular inspection.

$;*ö;Å(å,ä){(å+=$)<ä?*ö++=å,Å(å,ä):$;}_(*ä){ö=ä;$='&&&&'^'$$$$';Å('?_@`','[{\\|');$+=$;Å('/.-,','?>=<');*--ö&=';:';}

Try it online!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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