Print all ASCII alphanumeric characters without using them

51

10

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.

dkudriavtsev

Posted 2017-01-05T19:47:23.653

Reputation: 5 781

8This 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. – FlipTack – 2017-01-05T19:57:42.370

11So this means that I cannot use any letters or numbers in my source code. Well, that pretty much takes out any non-esoteric languages. – R. Kap – 2017-01-05T20:04:59.440

2What if the language is just raw bytes (as opcodes) that don't have a representation? Am I free to use any characters? – FlipTack – 2017-01-05T22:03:32.380

Duplicates allowed? – user2428118 – 2017-01-05T22:33:06.073

@wat if the ASCII codes are printed does it matter if their underlying data type is int as opposed to actually being a char? That is, can we output the numerical values, or must it be seen on the screen as the printable characters? – briantist – 2017-01-05T23:11:11.800

1@briantist it's fine if they're internally represented by ints, but the characters themselves have to be printed. – dkudriavtsev – 2017-01-05T23:15:44.793

3@R.Kap Javascript could work, provided you don't think of it as eso – Destructible Lemon – 2017-01-05T23:32:41.877

If the code accesses an external file, do you intend to also prohibit those characters (or their codepoints) from appearing in the file? – Greg Martin – 2017-01-05T23:48:17.897

Is it OK to output some characters several times? Or should the output be exactly 26+26+10 characters? – anatolyg – 2017-01-06T00:10:14.733

@user2428118 no – dkudriavtsev – 2017-01-06T00:11:59.607

@anatolyg no;yes – dkudriavtsev – 2017-01-06T00:12:28.663

I meant my question seriously – FlipTack – 2017-01-06T00:20:49.390

@FlipTack You can't use the bytes that correspond to the ASCII codes of those characters. – dkudriavtsev – 2017-01-06T01:04:40.680

1Trying to think of a way to achieve this in Perl 5, supposedly one of the most punctuation-laden of languages, but it's actually quite hard to do anything without letters and numbers. Something like $\->$&($")can eliminate the need to spell outprint(if you can get the values "STDOUT", "print" (or "say"), and your desired output into the three variables).STDOUTis a key in%::, but how does one find it there withoutfororgrep` or anything of the sort? – hobbs – 2017-01-06T07:49:58.047

1I like the clarification "Rules: No cheating" – gcampbell – 2017-01-06T20:44:05.747

Why didn’t https://codegolf.stackexchange.com/a/105784/78446 win

– Arvin Kushwaha – 2018-11-24T19:45:47.833

@ArvinSingh I didn't see it. Fixed. – dkudriavtsev – 2018-11-24T22:46:56.853

Answers

19

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

user41805

Posted 2017-01-05T19:47:23.653

Reputation: 16 320

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) – James – 2017-01-05T20:12:13.760

50

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!

flawr

Posted 2017-01-05T19:47:23.653

Reputation: 40 560

7+1 for being the first non-esoteric language in a challenge very suited to esolangs. – James – 2017-01-05T21:56:26.510

4A 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! – Stewie Griffin – 2017-01-05T22:42:22.760

1When concatenated with an empty string ([...,'']), the numbers again are converted to characters.... very nice – rahnema1 – 2017-01-06T03:46:43.363

29

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.

Dennis

Posted 2017-01-05T19:47:23.653

Reputation: 196 637

Nice golf! I'll link to your answer – FlipTack – 2017-01-06T00:17:03.983

25

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.

histocrat

Posted 2017-01-05T19:47:23.653

Reputation: 20 600

Nice work. I saw this just as I came to post my 60 byte version using the same idea. – AShelly – 2017-01-05T22:49:47.433

3You can save one byte with slightly different ranges: $><<([*(?/...?{)]-[(?:..?@),(?[..?`),?/])*'' – AShelly – 2017-01-05T22:53:17.893

This really is pretty. Well, ugly. You know what I mean. Nicely done. – Wayne Conrad – 2017-01-06T13:59:38.420

22

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.

Mitchell Spector

Posted 2017-01-05T19:47:23.653

Reputation: 3 392

16

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.

Laikoni

Posted 2017-01-05T19:47:23.653

Reputation: 23 676

3You can use __ and _' as variables. – xnor – 2017-01-06T05:26:33.830

@xnor Thanks, I didn't know about the Underscore is treated as a lower-case letter rule. – Laikoni – 2017-01-06T09:34:30.820

1You can save some bytes by generalizing the ranges: _'_=[__|[_',__']<-["`{","@[","/:"],__<-[_'..],_'<__,__<__'] (in normal variables z=[x|[a,b]<-["`{","@[","/:"],x<-[a..],a<x,x<b]). – xnor – 2017-01-07T10:29:07.413

@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. – Laikoni – 2017-01-07T11:18:35.810

13

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!

Teal pelican

Posted 2017-01-05T19:47:23.653

Reputation: 1 338

'> is a byte shorter than ">". – Mego – 2017-01-06T23:12:49.907

@Mego yep it is, edited :) thanks. – Teal pelican – 2017-01-09T08:51:50.590

13

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

user62131

Posted 2017-01-05T19:47:23.653

Reputation:

11

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!

Dennis

Posted 2017-01-05T19:47:23.653

Reputation: 196 637

10

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('_'));
  }
}

Olivier Grégoire

Posted 2017-01-05T19:47:23.653

Reputation: 10 647

3Wait, what?? I'm short than all of the JavaScript solutions? o_O – Olivier Grégoire – 2017-01-08T14:41:00.407

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. – Patrick Roberts – 2017-01-09T13:01:02.323

2@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. – Olivier Grégoire – 2017-01-09T15:03:00.350

9

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

FlipTack

Posted 2017-01-05T19:47:23.653

Reputation: 13 242

5Brainfuck was the first language I thought of. Shame I don't know it. Nice answer. – ElPedro – 2017-01-05T20:59:18.260

7

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.

darrylyeo

Posted 2017-01-05T19:47:23.653

Reputation: 6 214

Hey, FYI I posted http://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.

– Patrick Roberts – 2017-01-06T13:35:49.973

No problem, looking good! – darrylyeo – 2017-01-06T20:26:00.577

Nice! That last update helped me get over 100 bytes off mine! – Patrick Roberts – 2017-01-07T04:28:10.730

1If you change your encoding to ISO8859-1, and leave it exactly like this, it will be 769 bytes. – Patrick Roberts – 2017-01-07T09:45:38.510

7

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.

James Holderness

Posted 2017-01-05T19:47:23.653

Reputation: 8 298

1If 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 – MildlyMilquetoast – 2017-01-07T01:43:52.963

-2 bytes by rearranging the check at the beginning of the line – Jo King – 2018-01-19T09:15:54.830

@JoKing Well spotted. We can't use the v since this is restricted-source, but it still works just as well with a ^. Thanks. – James Holderness – 2018-01-19T11:08:27.267

-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 ;) ) – Jo King – 2018-01-20T15:22:02.353

@JoKing Wow, you really are way better at this golfing than me! Thanks again. – James Holderness – 2018-01-20T17:32:05.560

6

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 '`').

Dennis

Posted 2017-01-05T19:47:23.653

Reputation: 196 637

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 – FlipTack – 2017-01-05T20:29:31.113

@FlipTack IIRC Jelly's codepage is compatible with printable ASCII. – PurkkaKoodari – 2017-01-05T20:36:04.663

@FlipTack Pietu1998 is right. And even if he weren't, the spec bans characters, not bytes. – Dennis – 2017-01-05T21:19:27.697

@Dennis In fact, it bans bytes per the comments, although this is still valid (ASCII-compatible).

– Erik the Outgolfer – 2017-01-07T10:50:31.613

6

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

Patrick Roberts

Posted 2017-01-05T19:47:23.653

Reputation: 2 475

6

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  ]<<[-<+.>]`.@./.

Erik the Outgolfer

Posted 2017-01-05T19:47:23.653

Reputation: 38 134

What does the @/ do? – Yytsi – 2017-01-06T18:43:18.203

@TuukkaX The last 6 characters \\x1a@\x1a/\n` are there because their codepoints are really useful in golfing. You can't remove them. – Erik the Outgolfer – 2017-01-06T18:47:21.653

@downvoter: If you stumble upon this post, please remove your downvote. This has been since fixed. – Erik the Outgolfer – 2017-01-08T10:01:29.933

I'm glad I'm not the only one who uses SMBF. :) – mbomb007 – 2017-01-13T18:24:59.023

@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 .+. – Erik the Outgolfer – 2017-01-13T18:26:55.060

6

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.

Anonymous

Posted 2017-01-05T19:47:23.653

Reputation: 161

5

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.

Magic Octopus Urn

Posted 2017-01-05T19:47:23.653

Reputation: 19 422

1You may print them in arbitrary order says the challenge. – AdmBorkBork – 2017-01-05T20:30:16.223

1Does •£•Ýç©á®þ«˜ also work? – Adnan – 2017-01-06T00:00:37.170

@Adnan nice, didn't know it uses 0 when there is no b. – Magic Octopus Urn – 2017-01-09T20:06:49.080

5

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".

Riley

Posted 2017-01-05T19:47:23.653

Reputation: 11 345

5

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!

Dennis

Posted 2017-01-05T19:47:23.653

Reputation: 196 637

5

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.

Conor O'Brien

Posted 2017-01-05T19:47:23.653

Reputation: 36 228

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 – miles – 2017-01-06T13:31:40.840

5

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

primo

Posted 2017-01-05T19:47:23.653

Reputation: 30 891

5

Perl 6, 43 bytes - noncompeting

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

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, don't allow answers to compete in such a situation, so I marked it as noncompeting.

smls

Posted 2017-01-05T19:47:23.653

Reputation: 4 352

41 bytes – Jo King – 2018-11-06T00:11:02.397

4

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",';'^']'^@_));

Ismael Miguel

Posted 2017-01-05T19:47:23.653

Reputation: 6 797

3

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   

insert_name_here

Posted 2017-01-05T19:47:23.653

Reputation: 816

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. – dkudriavtsev – 2017-01-07T03:18:37.083

@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? – insert_name_here – 2017-01-07T03:35:48.540

I guess so... ._. – dkudriavtsev – 2017-01-07T06:24:53.757

@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 – Patrick Roberts – 2017-01-07T06:48:55.630

3

Javascript, 1273 1351 1610 bytes

This solution works essentially the same way as the other two answers on this thread here and here, where it uses letters from the true, false, undefined, and [object Object] strings to build the functions that it needs to generate the other letters.

Since a good number of the letters are already put into the object, I tried adding all of the remaining minuscule letters and the numbers to the object, and then applied toUpperCase to all of the values in the object to generate the missing majuscule letters.

Update:

I was able to improve the way that the octal values were being set, but they're still taking up 13 x 30 bytes (or they will be 30 bytes each after I changes the numbers to different keys), each one now follows this general pattern: $.ž=\'\\'+$.一+$.七+$.二+'\';.

An additional 49 bytes can be easily taken out by switching the keys for the numbers to 2 byte characters.

Current submission:

$=~[];_={ť:!""+"",ň:![]+"",û:$._+'',ô:{}+"",ø:''};$={零:++$,ƒ:_.ň[$],ť:_.ť[$],一:++$,â:_.ň[$],ř:_.ť[$],ô:_.ô[$],ň:_.û[$],二:++$,ľ:_.ň[$],û:_.ť[$],ƅ:_.ô[$],ď:_.û[$],三:++$,ŝ:_.ň[$],ĵ:_.ô[$],四:++$,ě:_.ň[$],五:++$,ĉ:_.ô[$],î:_.û[$],六:++$,七:++$,八:++$,Ô:_.ô[$],九:++$};_.ĉ=$.ĉ+$.ô+$.ň+$.ŝ+$.ť+$.ř+$.û+$.ĉ+$.ť+$.ô+$.ř;_.ř=$.ř+$.ě+$.ť+$.û+$.ř+$.ň;_.ƒ=(0)[_.ĉ][_.ĉ];_.ƒ(_.ƒ(_.ř+' "$.Û=\'\\'+$.一+$.二+$.五+'\';$.Ĉ=\'\\'+$.一+$.零+$.三+'\';$.Ě=\'\\'+$.一+$.零+$.五+'\';$.ĝ=\'\\'+$.一+$.四+$.七+'\';$.ĥ=\'\\'+$.一+$.五+$.零+'\';$.ǩ=\'\\'+$.一+$.五+$.三+'\';$.ӎ=\'\\'+$.一+$.五+$.五+'\';$.ƥ=\'\\'+$.一+$.六+$.零+'\';$.ǫ=\'\\'+$.一+$.六+$.一+'\';$.ư=\'\\'+$.一+$.六+$.六+'\';$.ŵ=\'\\'+$.一+$.六+$.七+'\';$.ӽ=\'\\'+$.一+$.七+$.零+'\';$.ŷ=\'\\'+$.一+$.七+$.一+'\';$.ž=\'\\'+$.一+$.七+$.二+'\';"')())();_.ƒ(_.ƒ(_.ř+' "_.â=\''+$.Ô+$.ƅ+$.ĵ+$.ě+$.ĉ+$.ť+'.'+$.ǩ+$.ě+$.ŷ+$.ŝ+'($).'+$.ƒ+$.ô+$.ř+$.Ě+$.â+$.ĉ+$.ĥ+'\';_.ƅ=\''+$.ť+$.ô+$.Û+$.ƥ+$.ƥ+$.ě+$.ř+$.Ĉ+$.â+$.ŝ+$.ě+'\';"')())();_.ƒ(_.ƒ(_.ř+' "'+_.â+'((ǩ)=>{$[ǩ.'+_.ƅ+"()]=($[ǩ]+'')."+_.ƅ+"()});"+_.â+"((ǩ)=>{_.ø+=$[ǩ];});"+$.â+$.ľ+$.ě+$.ř+$.ť+'(_.ø);"')())()

martin

Posted 2017-01-05T19:47:23.653

Reputation: 191

1This seems interesting, but as it is, it's not very golfed. Just removing whitespace would save 74 bytes, single quotes could be used for strings that contain double quotes, and 3-byte Unicode characters could be replaced with less expensive ones. – Dennis – 2017-01-08T01:15:38.853

@Dennis true, though I think the biggest problem with this method right now is that there are so many characters being set with octal codes. – martin – 2017-01-08T02:03:02.437

3

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

izabera

Posted 2017-01-05T19:47:23.653

Reputation: 879

+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. – Digital Trauma – 2017-01-08T19:55:49.850

3

C (clang), 164 bytes

é,ú,í,ó;_(*$){ú-=ú;ú++;í=ú+ú;ó=í<<í*í<<ú;!é?é++,é<<=í*í+ú,é+=í<<í+ú:é;*$++=é++;é+=é==ó-(í*í+í)?(í<<í)-ú:ú-ú;é+=é==ó+(í<<í<<í)-í*í-ú?í*í+í:ú-ú;é<í*ó-(í*í)-ú?_($):ú;}

Try it online!

This is a recursive function that gets the characters by starting with a value of 1 (subtracting from self and incrementing), and creates all other numbers from that.

Ungolfed/Explaination:

é,ú,í,ó;
_(*$){ //function "_" taking a pointer "$"
	ú-=ú;ú++; //constant ú=1
	í=ú+ú; //constant í=2
	ó=í<<í*í<<ú; //constant ó=64
	!é?é++,é<<=í*í+ú,é+=í<<í+ú:é; //if é isn't initialized, seek to character '0'
	*$++=é++; //write to string and increase string index
	é+=é==ó-(í*í+í)?(í<<í)-ú:ú-ú; //skip to 'A'
	é+=é==ó+(í<<í<<í)-í*í-ú?í*í+í:ú-ú; //skip to 'a'
	é<í*ó-(í*í)-ú?_($):ú; //keep recursing until end of alphabet
}

Logern

Posted 2017-01-05T19:47:23.653

Reputation: 845

2

CJam, 15 bytes

"{`[@:/"_:,:^\-

Try it online!

Explanation

"{`[@:/" e# Push this string. Note that these are the characters just above and
         e# below the a-z, A-Z and 0-9 ranges, respectively.
_        e# Get a copy of the string.
:,       e# Turn each character into a range, i.e. all characters from the null byte
         e# to the the character below the given one. E.g. { is turned into "...xyz".
:^       e# Fold symmetric set difference over the list. Gives us the characters that
         e# appear in an odd number of the strings. Those are the letters, the digits
         e# as well as `, @ and /.
\        e# Pull the other copy of the string on top.
-        e# Remove these characters from the string. That leaves only the alphanumerics.

Martin Ender

Posted 2017-01-05T19:47:23.653

Reputation: 184 808

2

, 8 chars / 19 bytes

ᶐ+ᶛ+⩥Ⅹă⬯

Try it here!

is the uppercase alphabet, is the lowercase alphabet, and ⩥Ⅹă⬯ is range () from 0 to 10 (, the unicode roman numeral) minus 1, joined by (ă) nothing ().

Conor O'Brien

Posted 2017-01-05T19:47:23.653

Reputation: 36 228

2

JavaScript, 371 bytes

(ÿ=(À=!($={})+(ø=""))[ò=ì=+[]],ý=(Þ=!ò+ø)[++ì],ó=(Ó=$+ø)[ì],Ú=$.$+ø,ú=Þ[í=ì+ì],é=Þ[î=í+ì],ç=Ó[Ì=î+í],þ=Þ[ò],Î=Ì+í,$=$[Ç=ç+ó+Ú[ì]+À[î]+þ+ý+ú+ç+þ+ó+ý][Ç],$($((È=ý+é+þ+ú+ý+Ú[ì])+`"${ÿ+ó+ý}(_=ò;_<Ì<<Ì;)ø+=${(ß="\\")+ì+í+î+þ+ý+(Ð=(ð=ß+ì)+Ì)+ì+Ç[í]+(æ=ð+í*í+Î)}.${ÿ+ý+ó+Ð+Ì+ð+ò+î+Ð+ò+À[ì]+ý+ð+ò+î+ó+Ú[í]+é}(_++);${È} ø.${ý+é+ð+í*î+ò+À[í]+À[ì]+ç+é}(/${ß+ß+ð+í+Î}|_/${æ},'')"`)()))()

The (...)() scaffolding is only there to make it easier to paste it into the F12 console, and doesn't count toward the total, as per the rules. Output:

"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

This is based on the same method as the other JavaScript solutions: using string coercion to get at some internal string constants to build a string to get at the constructor of the constructor of an object. A constructor is a function, so its constructor is Function, which allows us to build a new one, essentially like eval.

One difference with previous solutions is that I tried to use more ‘sensible’ variable names, which made it easier to try out new ideas:

ç   c         Ç   constructor        ò   0      ß   \
é   e         Ó   [object Object]    ì   1      ð   \1
ó   o         Ú   undefined          í   2      Ð   \15
þ   t         Þ   true               î   3
ú   u                                Ì   5
                                     Î   7
ÿ   f         À   false 
ý   r         È   return 
æ   \147 = g

The trick that ended up saving the most was to first generate way too much and then filtering out all the characters I didn't need.

Anonymous

Posted 2017-01-05T19:47:23.653

Reputation: 21

1Does this print with the "s around the text? – Post Rock Garf Hunter – 2017-01-08T01:08:09.077

It looks like you're using ISO-8859-1 charset. Am I wrong? Can you clarify? – Olivier Grégoire – 2017-01-08T19:06:40.030

2

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

Charlie

Posted 2017-01-05T19:47:23.653

Reputation: 11 448

1

WSF, 145 bytes

Prtty much a direct translation of Dennis's answer.

Stack Exchange cannot display the code, so here is a reversible xxd hexdump:

00000000: 2020 2020 2020 2020 2020 2020 2020 2020                  
00000010: 0a20 200a 2020 200a 2020 2020 2020 2020  .  .   .        
00000020: 2020 2020 200a 2020 2020 2020 2020 200a       .         .
00000030: 2009 0920 0920 0920 0920 2009 0a09 200a   .. . . .  ... .
00000040: 2020 2020 0a20 200a 0909 2020 0920 2009      .  ...  .  .
00000050: 0a09 200a 200a 0a20 200a 2020 200a 2020  .. . ..  .   .  
00000060: 2020 200a 2020 2020 2020 0920 0920 0920     .      . . . 
00000070: 2009 0a09 200a 2020 2020 0a20 200a 2020   ... .    .  .  
00000080: 0909 200a 2020 0909 0920 0920 2009 0a09  .. .  ... .  ...
00000090: 0a

The interpreter runs it perfectly, producing the following output:

0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz

dkudriavtsev

Posted 2017-01-05T19:47:23.653

Reputation: 5 781

1

Stacked, 70 bytes

(π²²~~:' '#.-):'='#.'#'#.%+..#:'/'#.(πτ/~_:π²~~+|>)+#:++$∪#/!

Leaves a character array on the top of the stack. This simply uses some character and pi magic. Try it here!

Conor O'Brien

Posted 2017-01-05T19:47:23.653

Reputation: 36 228

The link doesn't do anything when I paste your code in there... – Patrick Roberts – 2017-01-07T06:51:14.397

@PatrickRoberts yeah, because it's a function. Add put to the end to see the result. – Conor O'Brien – 2017-01-07T07:06:13.823

Ah, neat okay. I don't know Stacked obviously ^^; – Patrick Roberts – 2017-01-07T07:13:06.593

1

x86 machine code, 30 bytes

Hexdump:

8b d7 8b f9 2b c9 b1 1a b0 7b 2a c1 aa 2c 20 aa
2c 11 3c 3a 7d 01 aa e2 ef 88 0f 8b fa c3

Represented as if it had Windows 1252 encoding, with control characters using the Control Pictures visualization:

‹×‹ù+ɱ␚°{*Áª, ª,␑<:}␁ªâïˆ␏‹úÃ

It's 32-bit code (IA-32) using fastcall calling convention - receives the pointer to output in ecx.

Assembly code:

    mov edx, edi;
    mov edi, ecx;
    sub ecx, ecx;
    mov cl, 26;
myloop:
    mov al, 'a' + 26;
    sub al, cl;
    stosb;
    sub al, 'a' - 'A';
    stosb;
    sub al, 'A' - '0';
    cmp al, '9'+1;
    jge myskip;
    stosb;
myskip:
    loop myloop;
    mov [edi], cl;
    mov edi, edx;
    ret;

Does 26 iterations (cl = 26 down to 1). At each iteration, calculates and outputs a lowercase letter, an uppercase letter and a number. If the number is out of range, doesn't output it.

The output is written to address in ecx, and null-terminated.

The result:

aA0bB1cC2dD3eE4fF5gG6hH7iI8jJ9kKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ

Interesting things about this code:

  • Save-restore of the edi register is usually done by push-pop, but push edi is alphanumeric (W) - so I did it with mov edx, edi and mov edi, edx
  • Zeroing a register is usually done by xor, but to avoid an alphanumeric character, I did it with sub; same byte count
  • jge is one of only a few conditional jump instructions that are allowed

anatolyg

Posted 2017-01-05T19:47:23.653

Reputation: 10 719

I don't quite get it. It's definitely not a DOS code (not a single 66 prefix despite 32-bit instructions). Then what's it? A function? Then what calling convention does it follow? – Ruslan – 2017-01-08T16:43:40.160

I've clarified my answer – anatolyg – 2017-01-08T16:46:55.557

1

PHP, 339 bytes (no bitwise string)

Of course not the shortest code, but an alternate method using the Array to string cast.

<?=$_=([]._)[-~-~-~-_],++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,$_=([]._)[_],++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,$_=-_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_;?>

([]._) cast an array to string leading "Array_", then you can take both "A" and "a" and use increment string method.

-~-~-~-_ is giving "3" using multiple minus bitwise not() (maybe this can be improved)

Crypto

Posted 2017-01-05T19:47:23.653

Reputation: 862

1

Pyt, 3 bytes

ɬɳǰ

Explanation:

ɬ           Pushes "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
ɳ          Pushes "0123456789"
ǰ         Joins the strings on the stack with no delimiter
Implicit print

Try it online!

mudkip201

Posted 2017-01-05T19:47:23.653

Reputation: 833

1

Befunge-93, 38 33 bytes

"/*@:`:":^
,\~+:" "->!#$_::%$\~-:

Try it online!

Uses a different method than this answer. The first line pushes these six numbers: (47, 10 + 32), (64, 26 + 32), (96, 26 + 32), representing the 0-9, A-Z and a-z ranges respectively (lengths are summed with 32 so that they can all be printable non-alphanumeric characters, as well as 32 itself), as well as an extra number that gets consumed shortly after (can be any truthy value). Then, execution jumps to the second line, which loops to print all of these ranges.

negative seven

Posted 2017-01-05T19:47:23.653

Reputation: 1 931

1

Perl 6, 50 bytes

{([~] '/'^..^':')~([~] '@'^..^'[')~[~] '`'^..^'{'}

Block that returns the string since I don't think there's any way to print without using alphanumeric characters.

Try it online!

bb94

Posted 2017-01-05T19:47:23.653

Reputation: 1 831

0

GW-BASIC, 109 bytes

Hex dump of file:

FE 88 A9 C5 C2 1A 0E BF  11 A2 17 7B DC 10 87 D6
B8 8D A1 F3 E2 F3 A3 18  2B 1C E7 A1 14 7D 8D 3E
15 27 0C 2C 0B 2E F9 F1  C0 7D C4 5D 00 F1 89 C4
82 A5 D8 3C C9 CF 17 F0  D7 89 AF 40 8A AE 9D 03
8B EE A4 91 91 2F 5B DE  D5 AA 18 FE B9 AD C8 3A
5D F7 04 1A F2 1A 7C EC  DF 2C DD 88 D3 94 3B 40
7F EB B9 2C 1A B2 F3 C0  8C D3 95 10 1A

As you can see, none of the forbidden characters (30..39, 41..5A, 61..7A) are used. To run, use LOAD"filename.bas and then RUN.

Anonymous

Posted 2017-01-05T19:47:23.653

Reputation: 161

Could you include the source, even if that includes the restricted bytes? – MD XF – 2017-06-05T03:16:03.477

0

Charcoal, 10 bytes

βα⪫E…⁰χIιω

Try it online!

Explanation

β            Lowercase alphabet (implicitly printed)
 α           Uppercase alphabet (implicitly printed)
  ⪫        ω Join by ""
   E   Iι  Map with cast
     …⁰χ     Range from 0 to 10

ASCII-only

Posted 2017-01-05T19:47:23.653

Reputation: 4 687

βαFχI﹪⊕ιχ works (9 bytes). might change later – ASCII-only – 2018-11-04T06:35:44.410

0

Stax, 2 bytes

Éè

Run and debug it

This isn't very interesting. Just a built-in constant. I used the packed program encoding to avoid alphanumerics, but normally, this is known as VL.

recursive

Posted 2017-01-05T19:47:23.653

Reputation: 8 616

0

MathGolf, 12 bytes

▄_Äδ☻♥+$♂(Ä└

Try it online!

Explanation

▄              lowercase alphabet as string
 _             duplicate TOS
  Äδ           capitalize each letter and push to the stack
    ☻♥+        push 16+32 = 48
       $       pop(48), push ord(48) = "0"
        ♂(     push 10-1 = 9
          Ä    start block of length 1
           └   push TOS+1 without popping (pushes "1"-"9")

maxb

Posted 2017-01-05T19:47:23.653

Reputation: 5 754